mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 07:37:39 +00:00
fix: sms carrier config, add google carrier (#44)
This commit is contained in:
@@ -12,8 +12,9 @@ export default function sendNotification(cartUrl: string) {
|
||||
sendSlaskMessage(cartUrl);
|
||||
}
|
||||
|
||||
if (Config.notifications.phone.number && Config.notifications.phone.carrier) {
|
||||
if (Config.notifications.phone.availableCarriers.includes(Config.notifications.phone.carrier.toLowerCase())) {
|
||||
if (Config.notifications.phone.number) {
|
||||
const carrier = Config.notifications.phone.carrier?.toLowerCase();
|
||||
if (carrier && Config.notifications.phone.availableCarriers.includes(carrier)) {
|
||||
sendSMS(cartUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ enum carrierAddress {
|
||||
sprint = 'messaging.sprintpcs.com',
|
||||
verizon = 'vtext.com',
|
||||
tmobile = 'tmomail.net',
|
||||
att = 'txt.att.net'
|
||||
att = 'txt.att.net',
|
||||
google = 'msg.fi.google.com'
|
||||
}
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
@@ -34,16 +35,15 @@ export default function sendSMS(text: string) {
|
||||
Logger.error(error);
|
||||
} else {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
Logger.info(`✔ email sent: ${info.response}`);
|
||||
Logger.info(`✔ sms sent: ${info.response}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function generateAddress() {
|
||||
for (const carrier of Object.keys(carrierAddress)) {
|
||||
if (Config.notifications.phone.carrier && carrier === Config.notifications.phone.carrier.toLowerCase()) {
|
||||
// @ts-expect-error
|
||||
return [Config.phone.number, carrierAddress[carrier]].join('@');
|
||||
}
|
||||
const carrier = Config.notifications.phone.carrier?.toLowerCase();
|
||||
if (carrier && Object.keys(carrierAddress).includes(carrier)) {
|
||||
// @ts-expect-error
|
||||
return [Config.notifications.phone.number, carrierAddress[carrier]].join('@');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user