Merge remote-tracking branch 'upstream/release-7.5.0' into chore/merge-release-into-dev

This commit is contained in:
Taranto 2021-11-24 14:53:50 +00:00
commit 0ad2ee362a
109 changed files with 3283 additions and 697 deletions

View file

@ -5,7 +5,9 @@ const CashInTx = require('./cash-in/cash-in-tx')
const CashOutTx = require('./cash-out/cash-out-tx')
const T = require('./time')
const REDEEMABLE_AGE = T.day
// FP operations on Postgres result in very big errors.
// E.g.: 1853.013808 * 1000 = 1866149.494
const REDEEMABLE_AGE = T.day / 1000
function process (tx, pi) {
const mtx = massage(tx, pi)
@ -78,7 +80,7 @@ function customerHistory (customerId, thresholdDays) {
AND fiat > 0
UNION
SELECT txOut.id, txOut.created, txOut.fiat, 'cashOut' AS direction,
(extract(epoch FROM (now() - greatest(txOut.created, txOut.confirmed_at))) * 1000) >= $4 AS expired
(NOT txOut.dispense AND extract(epoch FROM (now() - greatest(txOut.created, txOut.confirmed_at))) >= $4) AS expired
FROM cash_out_txs txOut
WHERE txOut.customer_id = $1
AND txOut.created > now() - interval $2