Merge pull request #933 from SiIky/feat/iCfPSCAQ/cashbox-history-backport

feat: cashbox history backport
This commit is contained in:
Rafael Taranto 2021-11-23 09:08:27 +00:00 committed by GitHub
commit 60e939a4b9
16 changed files with 952 additions and 23 deletions

View file

@ -10,6 +10,7 @@ const express = require('express')
const nmd = require('nano-markdown')
const semver = require('semver')
const cashbox = require('./cashbox-batches')
const dbErrorCodes = require('./db-error-codes')
const options = require('./options')
const logger = require('./logger')
@ -222,6 +223,14 @@ function stateChange (req, res, next) {
.catch(next)
}
function notifyCashboxRemoval (req, res, next) {
return machineLoader.getMachine(req.deviceId)
.then(machineLoader => cashbox.createCashboxBatch(req.deviceId, machineLoader.cashbox))
.then(() => machineLoader.setMachine({ deviceId: req.deviceId, action: 'emptyCashInBills' }))
.then(() => res.status(200).send({ status: 'OK' }))
.catch(next)
}
function verifyUser (req, res, next) {
const pi = plugins(req.settings, req.deviceId)
pi.verifyUser(req.body)
@ -546,6 +555,7 @@ app.use(filterOldRequests)
app.get('/poll', poll)
app.get('/terms_conditions', getTermsConditions)
app.post('/state', stateChange)
app.post('/cashbox/removal', notifyCashboxRemoval)
app.post('/network/heartbeat', networkHeartbeat)
app.post('/network/performance', networkPerformance)