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',
'us_ssn_override',
'sanctions_override',
'front_camera_override'
'front_camera_override',
'suspended_until'
],
_.mapKeys(_.snakeCase, data))

View file

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

View file

@ -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 (
<>
<Breadcrumbs
@ -169,21 +172,38 @@ const CustomerProfile = memo(() => {
{!loading && !customerData.isAnonymous && (
<div>
<Label1 className={classes.actionLabel}>Actions</Label1>
<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 className={classes.customerActions}>
{suspended && (
<ActionButton
color="primary"
Icon={suspended ? AuthorizeIcon : BlockIcon}
InverseIcon={
suspended ? AuthorizeReversedIcon : BlockReversedIcon
}
onClick={() =>
updateCustomer({
suspendedUntil: null
})
}>
{`Unsuspend customer`}
</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>
)}
</Box>

View file

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