only trade after receiving funds
This commit is contained in:
parent
d5aab9dfd0
commit
b9465a4cf9
1 changed files with 2 additions and 3 deletions
|
|
@ -189,13 +189,12 @@ function preProcess (tx, newTx, pi) {
|
|||
}
|
||||
|
||||
function postProcess (txVector, pi) {
|
||||
const [oldTx, newTx] = txVector
|
||||
|
||||
if (!oldTx) pi.sell(newTx)
|
||||
const [, newTx] = txVector
|
||||
|
||||
if (newTx.dispensed && !newTx.bills) {
|
||||
return pi.buildCartridges()
|
||||
.then(cartridges => {
|
||||
pi.sell(newTx)
|
||||
return _.set('bills', billMath.makeChange(cartridges.cartridges, newTx.fiat), newTx)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue