|
|
|
|
@ -21,26 +21,37 @@ class SMSIR extends NotificationProvider {
|
|
|
|
|
};
|
|
|
|
|
config = this.getAxiosConfigWithProxy(config);
|
|
|
|
|
|
|
|
|
|
let formattedMobile = notification.smsirNumber;
|
|
|
|
|
if (formattedMobile.length === 11 && formattedMobile.startsWith("09") && String(parseInt(formattedMobile)) === formattedMobile.substring(1)) {
|
|
|
|
|
// 09xxxxxxxxx Format
|
|
|
|
|
formattedMobile = formattedMobile.substring(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await axios.post(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
mobile: formattedMobile,
|
|
|
|
|
templateId: parseInt(notification.smsirTemplate),
|
|
|
|
|
parameters: [
|
|
|
|
|
const formattedMobiles = notification.smsirNumber
|
|
|
|
|
.split(",")
|
|
|
|
|
.map(mobile => {
|
|
|
|
|
if (mobile.length === 11 && mobile.startsWith("09") && String(parseInt(mobile)) === mobile.substring(1)) {
|
|
|
|
|
// 09xxxxxxxxx Format
|
|
|
|
|
return mobile.substring(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mobile;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Run multiple network requests at once
|
|
|
|
|
const requestPromises = formattedMobiles
|
|
|
|
|
.map(mobile => {
|
|
|
|
|
axios.post(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
name: "uptkumaalert",
|
|
|
|
|
value: msg
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
config
|
|
|
|
|
);
|
|
|
|
|
mobile: mobile,
|
|
|
|
|
templateId: parseInt(notification.smsirTemplate),
|
|
|
|
|
parameters: [
|
|
|
|
|
{
|
|
|
|
|
name: "uptkumaalert",
|
|
|
|
|
value: msg
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
config
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await Promise.all(requestPromises);
|
|
|
|
|
|
|
|
|
|
return okMsg;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|