mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 15:47:35 +00:00
refactor: lookup, rm defaults (#69)
prep work for #38 Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import {Config} from '../config';
|
||||
import {sendEmail} from './email';
|
||||
import {sendSMS} from './sms';
|
||||
import {playSound} from './sound';
|
||||
import {sendSlackMessage} from './slack';
|
||||
|
||||
export function sendNotification(cartUrl: string) {
|
||||
if (Config.notifications.email.username && Config.notifications.email.password) {
|
||||
sendEmail(cartUrl);
|
||||
}
|
||||
|
||||
if (Config.notifications.slack.channel && Config.notifications.slack.token) {
|
||||
sendSlackMessage(cartUrl);
|
||||
}
|
||||
|
||||
if (Config.notifications.phone.number) {
|
||||
const carrier = Config.notifications.phone.carrier.toLowerCase();
|
||||
if (carrier && Config.notifications.phone.availableCarriers.has(carrier)) {
|
||||
sendSMS(cartUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.notifications.playSound) {
|
||||
playSound();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user