Merge pull request #1101 from chaotixkilla/fix-cashbox-removal-notification

Fix cashbox removal notification trigger
This commit is contained in:
Rafael Taranto 2022-02-14 23:49:43 +00:00 committed by GitHub
commit 5494fe9600
2 changed files with 12 additions and 18 deletions

View file

@ -2,6 +2,7 @@ const express = require('express')
const router = express.Router()
const cashbox = require('../cashbox-batches')
const notifier = require('../notifier')
const { getMachine, setMachine } = require('../machine-loader')
const { loadLatestConfig } = require('../new-settings-loader')
const { getCashInSettings } = require('../new-config-manager')
@ -9,7 +10,9 @@ const { AUTOMATIC } = require('../constants.js')
function notifyCashboxRemoval (req, res, next) {
const operatorId = res.locals.operatorId
return Promise.all([getMachine(req.deviceId), loadLatestConfig()])
return notifier.cashboxNotify(req.deviceId)
.then(() => Promise.all([getMachine(req.deviceId), loadLatestConfig()]))
.then(([machine, config]) => {
const cashInSettings = getCashInSettings(config)
if (cashInSettings.cashboxReset !== AUTOMATIC) {