mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 14:37:41 +00:00
refactor: map sms, fix amazon text
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -4,18 +4,19 @@ import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
|
||||
const subject = 'NVIDIA - BUY NOW';
|
||||
const email = Config.notifications.email;
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
user: Config.notifications.email.username,
|
||||
pass: Config.notifications.email.password
|
||||
user: email.username,
|
||||
pass: email.password
|
||||
}
|
||||
});
|
||||
|
||||
const mailOptions: Mail.Options = {
|
||||
from: Config.notifications.email.username,
|
||||
to: Config.notifications.email.username,
|
||||
from: email.username,
|
||||
to: email.username,
|
||||
subject
|
||||
};
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ export default function sendNotification(cartUrl: string) {
|
||||
}
|
||||
|
||||
if (Config.notifications.phone.number) {
|
||||
const carrier = Config.notifications.phone.carrier?.toLowerCase();
|
||||
if (carrier && Config.notifications.phone.availableCarriers.includes(carrier)) {
|
||||
const carrier = Config.notifications.phone.carrier.toLowerCase();
|
||||
if (carrier && Config.notifications.phone.availableCarriers.has(carrier)) {
|
||||
sendSMS(cartUrl);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-14
@@ -4,20 +4,13 @@ import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
|
||||
const subject = 'NVIDIA - BUY NOW';
|
||||
|
||||
enum carrierAddress {
|
||||
sprint = 'messaging.sprintpcs.com',
|
||||
verizon = 'vtext.com',
|
||||
tmobile = 'tmomail.net',
|
||||
att = 'txt.att.net',
|
||||
google = 'msg.fi.google.com'
|
||||
}
|
||||
const [email, phone] = [Config.notifications.email, Config.notifications.phone];
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
user: Config.notifications.email.username,
|
||||
pass: Config.notifications.email.password
|
||||
user: email.username,
|
||||
pass: email.password
|
||||
}
|
||||
});
|
||||
|
||||
@@ -41,9 +34,8 @@ export default function sendSMS(text: string) {
|
||||
}
|
||||
|
||||
function generateAddress() {
|
||||
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('@');
|
||||
const carrier = phone.carrier.toLowerCase();
|
||||
if (carrier && phone.availableCarriers.has(carrier)) {
|
||||
return [phone.number, phone.availableCarriers.get(carrier)].join('@');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user