diff --git a/lib/customers.js b/lib/customers.js index 57a3e18c..e89cf2ef 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -107,7 +107,8 @@ async function updateCustomer (id, data, userToken) { 'sms_override', 'us_ssn_override', 'sanctions_override', - 'front_camera_override' + 'front_camera_override', + 'suspended_until' ], _.mapKeys(_.snakeCase, data)) diff --git a/lib/new-admin/graphql/types/customer.type.js b/lib/new-admin/graphql/types/customer.type.js index 0622c3cf..61355266 100644 --- a/lib/new-admin/graphql/types/customer.type.js +++ b/lib/new-admin/graphql/types/customer.type.js @@ -51,6 +51,7 @@ const typeDef = gql` lastTxFiat: String lastTxFiatCode: String lastTxClass: String + suspendedUntil: Date } type Query { diff --git a/new-lamassu-admin/src/pages/Customers/CustomerProfile.js b/new-lamassu-admin/src/pages/Customers/CustomerProfile.js index 2458da66..78e41303 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerProfile.js +++ b/new-lamassu-admin/src/pages/Customers/CustomerProfile.js @@ -55,6 +55,7 @@ const GET_CUSTOMER = gql` lastTxFiat lastTxFiatCode lastTxClass + daysSuspended transactions { txClass id @@ -135,6 +136,8 @@ const CustomerProfile = memo(() => { const blocked = R.path(['authorizedOverride'])(customerData) === OVERRIDE_REJECTED + const suspended = R.gt(R.path(['daysSuspended'])(customerData), 0) + return ( <> { {!loading && !customerData.isAnonymous && (
Actions - - updateCustomer({ - authorizedOverride: blocked - ? OVERRIDE_AUTHORIZED - : OVERRIDE_REJECTED - }) - }> - {`${blocked ? 'Authorize' : 'Block'} customer`} - +
+ {suspended && ( + + updateCustomer({ + suspendedUntil: null + }) + }> + {`Unsuspend customer`} + + )} + + updateCustomer({ + authorizedOverride: blocked + ? OVERRIDE_AUTHORIZED + : OVERRIDE_REJECTED + }) + }> + {`${blocked ? 'Authorize' : 'Block'} customer`} + +
)} diff --git a/new-lamassu-admin/src/pages/Customers/CustomerProfile.styles.js b/new-lamassu-admin/src/pages/Customers/CustomerProfile.styles.js index c6522f58..82346d46 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerProfile.styles.js +++ b/new-lamassu-admin/src/pages/Customers/CustomerProfile.styles.js @@ -14,5 +14,15 @@ export default { }, customerDetails: { marginBottom: 18 + }, + customerActions: { + display: 'flex', + flexDirection: 'row', + '& button': { + marginRight: 15 + }, + '& > :last-child': { + marginRight: 0 + } } }