pswincom-gateway-typed
Version:
Send SMS messages through LINK Mobility / PSWinCom Gateway, TypeScript version.
29 lines • 1.21 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeSmsResult = void 0;
const makeSmsResult = (response, receivers) => {
const result = { logon: undefined, receivers: {}, refs: {} };
if (response.SESSION?.LOGON) {
result.logon = response.SESSION.LOGON;
}
if (response.SESSION?.MSGLST?.MSG) {
if (Array.isArray(response.SESSION.MSGLST.MSG)) {
for (let index = 0, length = receivers.length; index < length; index++) {
let receiver = receivers[index];
if (result.receivers[receiver]) {
receiver =
receiver + '(' + response.SESSION.MSGLST.MSG[index].ID + ')';
}
result.receivers[receiver] = response.SESSION.MSGLST.MSG[index].STATUS;
result.refs[receiver] = response.SESSION.MSGLST.MSG[index].REF;
}
}
else {
result.receivers[receivers[0]] = response.SESSION.MSGLST.MSG.STATUS;
result.refs[receivers[0]] = response.SESSION.MSGLST.MSG.REF;
}
}
return result;
};
exports.makeSmsResult = makeSmsResult;
//# sourceMappingURL=make-sms-result.js.map
;