Merge pull request #1051 from chaotixkilla/fix-identify-customers-with-pending-data
Identify customers with manual pending data
This commit is contained in:
commit
96f202e868
3 changed files with 54 additions and 8 deletions
|
|
@ -45,6 +45,16 @@ const GET_CUSTOMERS = gql`
|
|||
lastTxFiatCode
|
||||
lastTxClass
|
||||
authorizedOverride
|
||||
frontCameraPath
|
||||
frontCameraOverride
|
||||
idCardPhotoPath
|
||||
idCardPhotoOverride
|
||||
idCardData
|
||||
idCardDataOverride
|
||||
usSsn
|
||||
usSsnOverride
|
||||
sanctions
|
||||
sanctionsOverride
|
||||
daysSuspended
|
||||
isSuspended
|
||||
}
|
||||
|
|
@ -101,6 +111,7 @@ const Customers = () => {
|
|||
|
||||
const configData = R.path(['config'])(customersResponse) ?? []
|
||||
const locale = configData && fromNamespace(namespaces.LOCALE, configData)
|
||||
const triggers = configData && fromNamespace(namespaces.TRIGGERS, configData)
|
||||
const customersData = R.sortWith([
|
||||
R.descend(it => new Date(R.prop('lastActive', it) ?? '0'))
|
||||
])(filteredCustomers ?? [])
|
||||
|
|
@ -195,6 +206,7 @@ const Customers = () => {
|
|||
locale={locale}
|
||||
onClick={handleCustomerClicked}
|
||||
loading={customerLoading}
|
||||
triggers={triggers}
|
||||
/>
|
||||
<CreateCustomerModal
|
||||
showModal={showCreationModal}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { getAuthorizedStatus, getFormattedPhone, getName } from './helper'
|
|||
|
||||
const useStyles = makeStyles(styles)
|
||||
|
||||
const CustomersList = ({ data, locale, onClick, loading }) => {
|
||||
const CustomersList = ({ data, locale, onClick, loading, triggers }) => {
|
||||
const classes = useStyles()
|
||||
|
||||
const elements = [
|
||||
|
|
@ -66,7 +66,7 @@ const CustomersList = ({ data, locale, onClick, loading }) => {
|
|||
{
|
||||
header: 'Status',
|
||||
width: 191,
|
||||
view: it => <MainStatus statuses={[getAuthorizedStatus(it)]} />
|
||||
view: it => <MainStatus statuses={[getAuthorizedStatus(it, triggers)]} />
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import * as Yup from 'yup'
|
|||
import { RadioGroup, TextInput } from 'src/components/inputs/formik'
|
||||
import { H4 } from 'src/components/typography'
|
||||
import { errorColor } from 'src/styling/variables'
|
||||
import { MANUAL } from 'src/utils/constants'
|
||||
|
||||
import { Upload } from './components'
|
||||
|
||||
|
|
@ -39,14 +40,47 @@ const useStyles = makeStyles({
|
|||
|
||||
const CUSTOMER_BLOCKED = 'blocked'
|
||||
|
||||
const getAuthorizedStatus = it =>
|
||||
it.authorizedOverride === CUSTOMER_BLOCKED
|
||||
? { label: 'Blocked', type: 'error' }
|
||||
: it.isSuspended
|
||||
? it.daysSuspended > 0
|
||||
const getAuthorizedStatus = (it, triggers) => {
|
||||
const fields = [
|
||||
'frontCameraPath',
|
||||
'idCardData',
|
||||
'idCardPhotoPath',
|
||||
'usSsn',
|
||||
'sanctions'
|
||||
]
|
||||
|
||||
const isManualField = fieldName => {
|
||||
const manualOverrides = R.filter(
|
||||
ite => R.equals(R.toLower(ite.automation), MANUAL),
|
||||
triggers?.overrides ?? []
|
||||
)
|
||||
|
||||
return (
|
||||
!!R.find(ite => R.equals(ite.requirement, fieldName), manualOverrides) ||
|
||||
R.equals(triggers.automation, MANUAL)
|
||||
)
|
||||
}
|
||||
|
||||
const pendingFieldStatus = R.map(
|
||||
ite =>
|
||||
!R.isNil(it[`${ite}`])
|
||||
? isManualField(ite)
|
||||
? R.equals(it[`${ite}Override`], 'automatic')
|
||||
: false
|
||||
: false,
|
||||
fields
|
||||
)
|
||||
|
||||
if (it.authorizedOverride === CUSTOMER_BLOCKED)
|
||||
return { label: 'Blocked', type: 'error' }
|
||||
if (it.isSuspended)
|
||||
return it.daysSuspended > 0
|
||||
? { label: `${it.daysSuspended} day suspension`, type: 'warning' }
|
||||
: { label: `< 1 day suspension`, type: 'warning' }
|
||||
: { label: 'Authorized', type: 'success' }
|
||||
if (R.any(ite => ite === true, pendingFieldStatus))
|
||||
return { label: 'Pending', type: 'warning' }
|
||||
return { label: 'Authorized', type: 'success' }
|
||||
}
|
||||
|
||||
const getFormattedPhone = (phone, country) => {
|
||||
const phoneNumber =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue