improve cash-in error handling
This commit is contained in:
parent
86adfd0a63
commit
84a93599f5
9 changed files with 263 additions and 47 deletions
|
|
@ -509,6 +509,20 @@ function plugins (settings, deviceId) {
|
|||
.catch(err => logger.error(err))
|
||||
}
|
||||
|
||||
function updateCassettes (tx) {
|
||||
// Note: This is the only place we update config from outside admin,
|
||||
// so should be safe even though it's not an atomic operation.
|
||||
//
|
||||
// However, we should make all config changes atomic in the future.
|
||||
const config = configManager.machineScoped(deviceId, settings.config)
|
||||
config.topCashOutDenomination -= tx.bills[0].actualDispense +
|
||||
tx.bills[0].rejected
|
||||
config.bottomCashOutDenomination -= tx.bills[1].actualDispense +
|
||||
tx.bills[1].rejected
|
||||
|
||||
// save
|
||||
}
|
||||
|
||||
return {
|
||||
pollQueries,
|
||||
sendCoins,
|
||||
|
|
@ -525,6 +539,7 @@ function plugins (settings, deviceId) {
|
|||
sendMessage,
|
||||
checkBalances,
|
||||
buildCartridges,
|
||||
updateCassettes,
|
||||
buy,
|
||||
sell
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue