feat: allow customer suspension removal
This commit is contained in:
parent
70e09013f5
commit
4003d892fd
4 changed files with 48 additions and 16 deletions
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ const typeDef = gql`
|
|||
lastTxFiat: String
|
||||
lastTxFiatCode: String
|
||||
lastTxClass: String
|
||||
suspendedUntil: Date
|
||||
}
|
||||
|
||||
type Query {
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -14,5 +14,15 @@ export default {
|
|||
},
|
||||
customerDetails: {
|
||||
marginBottom: 18
|
||||
},
|
||||
customerActions: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
'& button': {
|
||||
marginRight: 15
|
||||
},
|
||||
'& > :last-child': {
|
||||
marginRight: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue