Reintroduce cashbox (#535)

* feat: reintroduce cashbox component

* feat: cashbox update on db

* feat: cashbox on notifications

* feat: cashbox on overrides

* fix: cashin notifications

* fix: styling

* feat: cashin bills added to cashbox

* refactor: comment unused code

* fix: new bills length on cashbox

* fix: remove unused code

* chore: remove temporary code
This commit is contained in:
chaotixkilla 2021-01-18 20:23:46 +00:00 committed by GitHub
parent 0d3eb2e392
commit 26c5c427bf
6 changed files with 55 additions and 18 deletions

View file

@ -46,8 +46,14 @@ function insertNewBills (t, billRows, machineTx) {
const dbBills = _.map(cashInLow.massage, bills)
const columns = ['id', 'fiat', 'fiat_code', 'crypto_code', 'cash_in_fee', 'cash_in_txs_id', 'device_time']
const sql = pgp.helpers.insert(dbBills, columns, 'bills')
const deviceID = machineTx.deviceId
const sql2 = `update devices set cashbox = cashbox + $2
where device_id = $1`
return t.none(sql)
return t.none(sql2, [deviceID, dbBills.length])
.then(() => {
return t.none(sql)
})
.then(() => bills)
}