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',
|
'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))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ const typeDef = gql`
|
||||||
lastTxFiat: String
|
lastTxFiat: String
|
||||||
lastTxFiatCode: String
|
lastTxFiatCode: String
|
||||||
lastTxClass: String
|
lastTxClass: String
|
||||||
|
suspendedUntil: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
type Query {
|
type Query {
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,15 @@ export default {
|
||||||
},
|
},
|
||||||
customerDetails: {
|
customerDetails: {
|
||||||
marginBottom: 18
|
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