Add new unseen tx screen

This commit is contained in:
Rafael Taranto 2019-04-17 20:27:58 -03:00 committed by Josh Harvey
parent 9a43bc4417
commit 8b1480589f

View file

@ -56,6 +56,7 @@ function fetchPhoneTx (phone) {
return db.any(sql, values) return db.any(sql, values)
.then(_.map(toCashOutTx)) .then(_.map(toCashOutTx))
.then(txs => { .then(txs => {
const seenTxs = _.some(it => it.status !== 'notSeen', txs)
const confirmedTxs = txs.filter(tx => _.includes(tx.status, ['instant', 'confirmed'])) const confirmedTxs = txs.filter(tx => _.includes(tx.status, ['instant', 'confirmed']))
if (confirmedTxs.length > 0) { if (confirmedTxs.length > 0) {
const reducer = (acc, val) => { const reducer = (acc, val) => {
@ -67,7 +68,8 @@ function fetchPhoneTx (phone) {
return maxTx return maxTx
} }
if (txs.length > 0) throw httpError('Pending transactions', 412) if (txs.length > 0 && !seenTxs) throw httpError('Transaction not seen', 411)
if (txs.length > 0 && seenTxs) throw httpError('Pending transactions', 412)
throw httpError('No transactions', 404) throw httpError('No transactions', 404)
}) })
} }