This commit is contained in:
Josh Harvey 2017-03-15 22:54:40 +02:00
parent b4d8f3cd4c
commit 340b39d47d
9 changed files with 189 additions and 72 deletions

View file

@ -71,12 +71,15 @@ function fetchPhoneTx (phone) {
}
function fetchStatusTx (txId, status) {
console.log('DEBUG444')
const sql = 'select * from cash_out_txs where id=$1'
return db.oneOrNone(sql, [txId, status])
return db.oneOrNone(sql, [txId])
.then(toObj)
.then(tx => {
console.log('DEBUG445')
if (!tx) throw httpError('No transaction', 404)
console.log('DEBUG446')
if (tx.status === status) throw httpError('Not Modified', 304)
return tx
})