feat: new compliance options

This commit is contained in:
Taranto 2020-09-14 23:25:35 +01:00 committed by Josh Harvey
parent ccf7eacfad
commit f2080c32e9
23 changed files with 161 additions and 121 deletions

View file

@ -1,4 +1,5 @@
const _ = require('lodash/fp')
const db = require('./db')
const BN = require('./bn')
const CashInTx = require('./cash-in/cash-in-tx')
const CashOutTx = require('./cash-out/cash-out-tx')
@ -63,4 +64,15 @@ function cancel (txId) {
})
}
module.exports = {post, cancel}
function customerHistory (customerId) {
const sql = ` select txIn.id, txIn.created, txIn.fiat, 'cashIn' as direction from cash_in_txs txIn
where txIn.customer_id = $1
union
select txOut.id, txOut.created, txOut.fiat, 'cashOut' as direction from cash_out_txs txOut
where txOut.customer_id = $1
order by created;`
return db.any(sql, [customerId])
}
module.exports = {post, cancel, customerHistory}