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) {
|
function postProcess (txVector, pi) {
|
||||||
const [oldTx, newTx] = txVector
|
const [, newTx] = txVector
|
||||||
|
|
||||||
if (!oldTx) pi.sell(newTx)
|
|
||||||
|
|
||||||
if (newTx.dispensed && !newTx.bills) {
|
if (newTx.dispensed && !newTx.bills) {
|
||||||
return pi.buildCartridges()
|
return pi.buildCartridges()
|
||||||
.then(cartridges => {
|
.then(cartridges => {
|
||||||
|
pi.sell(newTx)
|
||||||
return _.set('bills', billMath.makeChange(cartridges.cartridges, newTx.fiat), newTx)
|
return _.set('bills', billMath.makeChange(cartridges.cartridges, newTx.fiat), newTx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue