feat: remove customer suspension

This commit is contained in:
Sérgio Salgado 2021-07-06 21:32:52 +01:00 committed by Josh Harvey
parent 94dbae23bf
commit 442336e306
4 changed files with 48 additions and 16 deletions

View file

@ -107,7 +107,8 @@ async function updateCustomer (id, data, userToken) {
'sms_override', 'sms_override',
'us_ssn_override', 'us_ssn_override',
'sanctions_override', 'sanctions_override',
'front_camera_override' 'front_camera_override',
'suspended_until'
], ],
_.mapKeys(_.snakeCase, data)) _.mapKeys(_.snakeCase, data))

View file

@ -130,6 +130,7 @@ const typeDefs = gql`
lastTxFiat: String lastTxFiat: String
lastTxFiatCode: String lastTxFiatCode: String
lastTxClass: String lastTxClass: String
suspendedUntil: Date
} }
type AccountConfig { type AccountConfig {

View file

@ -55,6 +55,7 @@ const GET_CUSTOMER = gql`
lastTxFiat lastTxFiat
lastTxFiatCode lastTxFiatCode
lastTxClass lastTxClass
daysSuspended
transactions { transactions {
txClass txClass
id id
@ -135,6 +136,8 @@ const CustomerProfile = memo(() => {
const blocked = const blocked =
R.path(['authorizedOverride'])(customerData) === OVERRIDE_REJECTED R.path(['authorizedOverride'])(customerData) === OVERRIDE_REJECTED
const suspended = R.gt(R.path(['daysSuspended'])(customerData), 0)
return ( return (
<> <>
<Breadcrumbs <Breadcrumbs
@ -169,21 +172,38 @@ const CustomerProfile = memo(() => {
{!loading && !customerData.isAnonymous && ( {!loading && !customerData.isAnonymous && (
<div> <div>
<Label1 className={classes.actionLabel}>Actions</Label1> <Label1 className={classes.actionLabel}>Actions</Label1>
<ActionButton <div className={classes.customerActions}>
color="primary" {suspended && (
Icon={blocked ? AuthorizeIcon : BlockIcon} <ActionButton
InverseIcon={ color="primary"
blocked ? AuthorizeReversedIcon : BlockReversedIcon Icon={suspended ? AuthorizeIcon : BlockIcon}
} InverseIcon={
onClick={() => suspended ? AuthorizeReversedIcon : BlockReversedIcon
updateCustomer({ }
authorizedOverride: blocked onClick={() =>
? OVERRIDE_AUTHORIZED updateCustomer({
: OVERRIDE_REJECTED suspendedUntil: null
}) })
}> }>
{`${blocked ? 'Authorize' : 'Block'} customer`} {`Unsuspend customer`}
</ActionButton> </ActionButton>
)}
<ActionButton
color="primary"
Icon={blocked ? AuthorizeIcon : BlockIcon}
InverseIcon={
blocked ? AuthorizeReversedIcon : BlockReversedIcon
}
onClick={() =>
updateCustomer({
authorizedOverride: blocked
? OVERRIDE_AUTHORIZED
: OVERRIDE_REJECTED
})
}>
{`${blocked ? 'Authorize' : 'Block'} customer`}
</ActionButton>
</div>
</div> </div>
)} )}
</Box> </Box>

View file

@ -14,5 +14,15 @@ export default {
}, },
customerDetails: { customerDetails: {
marginBottom: 18 marginBottom: 18
},
customerActions: {
display: 'flex',
flexDirection: 'row',
'& button': {
marginRight: 15
},
'& > :last-child': {
marginRight: 0
}
} }
} }