diff --git a/lib/customers.js b/lib/customers.js index e72b8dbc..f6a76337 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -450,7 +450,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, @@ -458,6 +458,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, @@ -488,7 +489,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, @@ -496,6 +497,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, diff --git a/lib/new-admin/graphql/schema.js b/lib/new-admin/graphql/schema.js index f06bb1d0..3575b89b 100644 --- a/lib/new-admin/graphql/schema.js +++ b/lib/new-admin/graphql/schema.js @@ -84,6 +84,7 @@ const typeDefs = gql` id: ID! authorizedOverride: String daysSuspended: Int + isSuspended: Boolean frontCameraPath: String frontCameraOverride: String phone: String diff --git a/new-lamassu-admin/src/pages/Customers/CustomerProfile.js b/new-lamassu-admin/src/pages/Customers/CustomerProfile.js index 74c0e1a2..03ba9093 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerProfile.js +++ b/new-lamassu-admin/src/pages/Customers/CustomerProfile.js @@ -56,6 +56,7 @@ const GET_CUSTOMER = gql` lastTxFiatCode lastTxClass daysSuspended + isSuspended transactions { txClass id @@ -136,7 +137,7 @@ const CustomerProfile = memo(() => { const blocked = R.path(['authorizedOverride'])(customerData) === OVERRIDE_REJECTED - const suspended = R.gt(R.path(['daysSuspended'])(customerData), 0) + const isSuspended = customerData.isSuspended return ( <> @@ -173,7 +174,7 @@ const CustomerProfile = memo(() => {
Actions
- {suspended && ( + {isSuspended && ( it.authorizedOverride === CUSTOMER_BLOCKED ? { label: 'Blocked', type: 'error' } - : it.daysSuspended > 0 - ? { label: `${it.daysSuspended} day suspension`, type: 'warning' } + : it.isSuspended + ? it.daysSuspended > 0 + ? { label: `${it.daysSuspended} day suspension`, type: 'warning' } + : { label: `< 1 day suspension`, type: 'warning' } : { label: 'Authorized', type: 'success' } const getFormattedPhone = (phone, country) => {