refactor: drop getMachineName() from notifier

This commit is contained in:
siiky 2024-02-14 14:46:23 +00:00
parent 374a4272a5
commit d2cdca701a
2 changed files with 5 additions and 10 deletions

View file

@ -13,6 +13,8 @@ const smsFuncs = require('./sms')
const webhookFuncs = require('./webhook')
const { STALE, STALE_STATE } = require('./codes')
const { getMachineName } = require('../machine-loader')
function buildMessage (alerts, notifications) {
const smsEnabled = utils.isActive(notifications.sms)
const emailEnabled = utils.isActive(notifications.email)
@ -158,7 +160,7 @@ function transactionNotify (tx, rec) {
if (!zeroConf && rec.isRedemption) return sendRedemptionMessage(tx.id, rec.error)
return Promise.all([
queries.getMachineName(tx.deviceId),
getMachineName(tx.deviceId),
customerPromise
]).then(([machineName, customer]) => {
return utils.buildTransactionMessage(tx, rec, highValueTx, machineName, customer)
@ -169,7 +171,7 @@ function transactionNotify (tx, rec) {
function complianceNotify (customer, deviceId, action, period) {
return Promise.all([
settingsLoader.loadLatest(),
queries.getMachineName(deviceId)
getMachineName(deviceId)
])
.then(([settings, machineName]) => {
const notifications = configManager.getGlobalNotifications(settings.config)
@ -267,7 +269,7 @@ function sendTransactionMessage (rec, isHighValueTx) {
function cashboxNotify (deviceId) {
return Promise.all([
settingsLoader.loadLatest(),
queries.getMachineName(deviceId)
getMachineName(deviceId)
])
.then(([settings, machineName]) => {
const notifications = configManager.getGlobalNotifications(settings.config)