pswincom-gateway-typed
Version:
Send SMS messages through LINK Mobility / PSWinCom Gateway, TypeScript version.
32 lines • 1.06 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeDeliveryResult = void 0;
const makeDeliveryResult = (xmlResponse) => {
if (!xmlResponse.MSGLST?.MSG) {
return [];
}
const results = [];
if (!Array.isArray(xmlResponse.MSGLST.MSG)) {
results.push({
id: xmlResponse.MSGLST.MSG.ID,
ref: xmlResponse.MSGLST.MSG.REF,
receiver: xmlResponse.MSGLST.MSG.RCV,
state: xmlResponse.MSGLST.MSG.STATE,
deliveryTime: xmlResponse.MSGLST.MSG.DELIVERYTIME,
});
}
if (Array.isArray(xmlResponse.MSGLST.MSG)) {
for (const message of xmlResponse.MSGLST.MSG) {
results.push({
id: message.ID,
ref: message.REF,
receiver: message.RCV,
state: message.STATE,
deliveryTime: message.DELIVERYTIME,
});
}
}
return results;
};
exports.makeDeliveryResult = makeDeliveryResult;
//# sourceMappingURL=make-delivery-result.js.map
;