fix: automatic cashbox batch creation

This commit is contained in:
Sérgio Salgado 2021-04-28 17:11:27 +01:00 committed by Josh Harvey
parent 61cc772816
commit cba519fb4d
2 changed files with 4 additions and 5 deletions

View file

@ -5,12 +5,11 @@ const cashbox = require('../cashbox-batches')
const machine = require('../machine-loader')
function notifyCashboxRemoval (req, res, next) {
Promise.resolve()
.then(() => machine.getMachine(req.deviceId))
return machine.getMachine(req.deviceId)
.then(machine => cashbox.createCashboxBatch(req.deviceId, machine.cashbox))
.then(() => machine.emptyCashInBills(req))
.then(() => machine.setMachine({ deviceId: req.deviceId, action: 'emptyCashInBills' }))
.then(() => res.status(200).send({ status: 'OK' }))
.catch(next)
.catch(next)
}
router.post('/removal', notifyCashboxRemoval)