feat: add extra (optional) logging
This commit is contained in:
parent
348260931e
commit
288920b927
3 changed files with 10 additions and 2 deletions
|
|
@ -28,6 +28,7 @@ end`
|
|||
module.exports = {post, monitorPending, cancel, PENDING_INTERVAL, TRANSACTION_STATES}
|
||||
|
||||
function post (machineTx, pi) {
|
||||
logger.silly('Updating cashin tx:', machineTx)
|
||||
return cashInAtomic.atomic(machineTx, pi)
|
||||
.then(r => {
|
||||
const updatedTx = r.tx
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ function selfPost (tx, pi) {
|
|||
}
|
||||
|
||||
function post (tx, pi, fromClient = true) {
|
||||
logger.silly('Updating cashout tx:', tx)
|
||||
return cashOutAtomic.atomic(tx, pi, fromClient)
|
||||
.then(txVector => {
|
||||
const [, newTx, justAuthorized] = txVector
|
||||
|
|
@ -57,7 +58,13 @@ function postProcess (txVector, justAuthorized, pi) {
|
|||
if ((newTx.dispense && !oldTx.dispense) || (newTx.redeem && !oldTx.redeem)) {
|
||||
return pi.buildAvailableCassettes(newTx.id)
|
||||
.then(cassettes => {
|
||||
logger.silly('Computing bills to dispense:', {
|
||||
txId: newTx.id,
|
||||
cassettes: cassettes.cassettes,
|
||||
fiat: newTx.fiat
|
||||
})
|
||||
const bills = billMath.makeChange(cassettes.cassettes, newTx.fiat)
|
||||
logger.silly('Bills to dispense:', bills)
|
||||
|
||||
if (!bills) throw httpError('Out of bills', INSUFFICIENT_FUNDS_CODE)
|
||||
return bills
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue