From 66f79481a295157bb232548a3063e08ac03e6b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Sun, 21 Nov 2021 22:06:00 +0000 Subject: [PATCH] fix: add operator cancel error as cancelled tx state --- lib/cash-in/cash-in-tx.js | 2 +- lib/cash-out/cash-out-helper.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cash-in/cash-in-tx.js b/lib/cash-in/cash-in-tx.js index 19363b04..f76c6fab 100644 --- a/lib/cash-in/cash-in-tx.js +++ b/lib/cash-in/cash-in-tx.js @@ -19,7 +19,7 @@ const WALLET_SCORE_THRESHOLD = 10 const TRANSACTION_STATES = ` case - when operator_completed then 'Cancelled' + when operator_completed and error = 'Operator cancel' then 'Cancelled' when error is not null then 'Error' when send_confirmed then 'Sent' when ((not send_confirmed) and (created <= now() - interval '${PENDING_INTERVAL}')) then 'Expired' diff --git a/lib/cash-out/cash-out-helper.js b/lib/cash-out/cash-out-helper.js index 2620c23c..f43bf62c 100644 --- a/lib/cash-out/cash-out-helper.js +++ b/lib/cash-out/cash-out-helper.js @@ -7,7 +7,8 @@ const BN = require('../bn') const REDEEMABLE_AGE = T.day const CASH_OUT_TRANSACTION_STATES = ` -case +case + when error = 'Operator cancel' then 'Cancelled' when error is not null then 'Error' when dispense then 'Success' when (extract(epoch from (now() - greatest(created, confirmed_at))) * 1000) >= ${REDEEMABLE_AGE} then 'Expired'