lamassu-server/lib/routes/cashboxRoutes.js
2021-07-07 17:46:23 +01:00

17 lines
574 B
JavaScript

const express = require('express')
const router = express.Router()
const cashbox = require('../cashbox-batches')
const machine = require('../machine-loader')
function notifyCashboxRemoval (req, res, next) {
return machine.getMachine(req.deviceId)
.then(machine => cashbox.createCashboxBatch(req.deviceId, machine.cashbox))
.then(() => machine.setMachine({ deviceId: req.deviceId, action: 'emptyCashInBills' }))
.then(() => res.status(200).send({ status: 'OK' }))
.catch(next)
}
router.post('/removal', notifyCashboxRemoval)
module.exports = router