feat: allow customer suspension removal

This commit is contained in:
Sérgio Salgado 2021-06-14 10:14:54 +01:00 committed by Josh Harvey
parent 70e09013f5
commit 4003d892fd
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

@ -51,6 +51,7 @@ const typeDef = gql`
lastTxFiat: String
lastTxFiatCode: String
lastTxClass: String
suspendedUntil: Date
}
type Query {

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,6 +172,22 @@ const CustomerProfile = memo(() => {
{!loading && !customerData.isAnonymous && (
<div>
<Label1 className={classes.actionLabel}>Actions</Label1>
<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}
@ -185,6 +204,7 @@ const CustomerProfile = memo(() => {
{`${blocked ? 'Authorize' : 'Block'} customer`}
</ActionButton>
</div>
</div>
)}
</Box>
</div>

View file

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