fix: edge case with suspensions shorter than 1 day

This commit is contained in:
Sérgio Salgado 2021-07-19 19:25:59 +01:00 committed by Josh Harvey
parent c0218e672f
commit fe665f1e9c
5 changed files with 15 additions and 10 deletions

View file

@ -451,7 +451,7 @@ function batch () {
* @returns {array} Array of customers with it's transactions aggregations
*/
function getCustomersList () {
const sql = `select id, authorized_override, days_suspended, front_camera_path, front_camera_override,
const sql = `select id, authorized_override, days_suspended, is_suspended, front_camera_path, front_camera_override,
phone, sms_override, id_card_data, id_card_data_override, id_card_data_expiration,
id_card_photo_path, id_card_photo_override, us_ssn, us_ssn_override, sanctions, sanctions_at,
sanctions_override, total_txs, total_spent, created as last_active, fiat as last_tx_fiat,
@ -459,6 +459,7 @@ function getCustomersList () {
from (
select c.id, c.authorized_override,
greatest(0, date_part('day', c.suspended_until - now())) as days_suspended,
c.suspended_until > now() as is_suspended,
c.front_camera_path, c.front_camera_override,
c.phone, c.sms_override, c.id_card_data, c.id_card_data_override, c.id_card_data_expiration,
c.id_card_photo_path, c.id_card_photo_override, c.us_ssn, c.us_ssn_override, c.sanctions,
@ -489,7 +490,7 @@ function getCustomersList () {
* @returns {array} Array of customers with it's transactions aggregations
*/
function getCustomerById (id) {
const sql = `select id, authorized_override, days_suspended, front_camera_path, front_camera_override,
const sql = `select id, authorized_override, days_suspended, is_suspended, front_camera_path, front_camera_override,
phone, sms_override, id_card_data, id_card_data_override, id_card_data_expiration,
id_card_photo_path, id_card_photo_override, us_ssn, us_ssn_override, sanctions, sanctions_at,
sanctions_override, total_txs, total_spent, created as last_active, fiat as last_tx_fiat,
@ -497,6 +498,7 @@ function getCustomerById (id) {
from (
select c.id, c.authorized_override,
greatest(0, date_part('day', c.suspended_until - now())) as days_suspended,
c.suspended_until > now() as is_suspended,
c.front_camera_path, c.front_camera_override,
c.phone, c.sms_override, c.id_card_data, c.id_card_data_override, c.id_card_data_expiration,
c.id_card_photo_path, c.id_card_photo_override, c.us_ssn, c.us_ssn_override, c.sanctions,