Skip to content

Commit

Permalink
fix: display the status for manual upload (#6093)
Browse files Browse the repository at this point in the history
* fix: display the status for manual upload

* ref: reverted changes

* fix: incorporated POI status change for manual update

* fix: added null check

* fix: after onfido submission fails multiple times, user must be sent to manual upload

* trigger build

* fix: incorporated review comment

* fix: incorporated review comments

* fix: incorporated review comments

* fix: included a check regd resubmission for Manual upload

* fix: added verified and expired status

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>
  • Loading branch information
likhith-deriv and carolsachdeva committed Sep 27, 2022
1 parent 488f3ee commit 1f5392f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import classNames from 'classnames';
import { localize } from '@deriv/translations';
import { Timeline } from '@deriv/components';
import { isMobile } from '@deriv/shared';
import { identity_status_codes } from 'Sections/Verification/ProofOfIdentity/proof-of-identity-utils.js';
import Verified from 'Components/poi/status/verified';
import Limited from 'Components/poi/status/limited';
import Expired from 'Components/poi/status/expired';
import DetailComponent from './detail-component.jsx';
import { Documents } from './documents.jsx';
import { getDocumentIndex, DOCUMENT_TYPES } from './constants';
import UploadComplete from '../upload-complete';

const checkNimcStep = documents => {
let has_nimc = false;
Expand All @@ -20,11 +25,28 @@ const checkNimcStep = documents => {
const Unsupported = ({ country_code, ...props }) => {
const [detail, setDetail] = React.useState(null);
const toggleDetail = index => setDetail(index);

const documents = getDocumentIndex({
setDetail,
country_code,
});

if (props?.manual) {
if (props.manual.status === identity_status_codes.pending) return <UploadComplete />;
else if ([identity_status_codes.rejected, identity_status_codes.suspected].includes(props.manual.status)) {
if (!props?.allow_poi_resubmission) return <Limited />;
} else if (props.manual.status === identity_status_codes.verified) {
return <Verified needs_poa={props.needs_poa} redirect_button={props.redirect_button} />;
} else if (props.manual.status === identity_status_codes.expired) {
return (
<Expired
redirect_button={props.redirect_button}
handleRequireSubmission={props.handleRequireSubmission}
/>
);
}
}

if (detail !== null) {
return (
<DetailComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ import UploadComplete from 'Components/poi/status/upload-complete';
import Expired from 'Components/poi/status/expired';
import Verified from 'Components/poi/status/verified';
import RejectedReasons from 'Components/poi/status/rejected-reasons';
import Limited from 'Components/poi/status/limited';
import Unsupported from 'Components/poi/status/unsupported';
import { identity_status_codes } from './proof-of-identity-utils';

const Onfido = ({ handleRequireSubmission, is_from_external, needs_poa, onfido, redirect_button }) => {
const Onfido = ({
handleRequireSubmission,
is_from_external,
needs_poa,
onfido,
redirect_button,
manual,
setIsCfdPoiCompleted,
}) => {
const { status, submissions_left, last_rejected: rejected_reasons } = onfido;

switch (status) {
Expand All @@ -20,7 +28,15 @@ const Onfido = ({ handleRequireSubmission, is_from_external, needs_poa, onfido,
);
case identity_status_codes.rejected:
case identity_status_codes.suspected:
if (Number(submissions_left) < 1) return <Limited handleRequireSubmission={handleRequireSubmission} />;
if (Number(submissions_left) < 1) {
return (
<Unsupported
manual={manual}
is_from_external={is_from_external}
setIsCfdPoiCompleted={setIsCfdPoiCompleted}
/>
);
}
return (
<RejectedReasons
rejected_reasons={rejected_reasons}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ const ProofOfIdentityContainer = ({
} else if (
!identity_last_attempt ||
// Prioritise verified status from back office. How we know this is if there is mismatch between current statuses (Should be refactored)
(identity_status === identity_status_codes.verified && identity_status !== identity_last_attempt.status) ||
// Prioritise pending status from back office. We can't rely on last attempt as it doesn't get updated after manual upload (Should be refactored)
identity_status === identity_status_codes.pending
(identity_status === identity_status_codes.verified && identity_status !== identity_last_attempt.status)
) {
switch (identity_status) {
case identity_status_codes.pending:
Expand Down Expand Up @@ -186,6 +184,8 @@ const ProofOfIdentityContainer = ({
is_from_external={!!is_from_external}
needs_poa={needs_poa}
onfido={onfido}
manual={manual}
setIsCfdPoiCompleted={setIsCfdPoiCompleted}
redirect_button={redirect_button}
/>
);
Expand All @@ -195,6 +195,9 @@ const ProofOfIdentityContainer = ({
manual={manual}
is_from_external={is_from_external}
setIsCfdPoiCompleted={setIsCfdPoiCompleted}
needs_poa={needs_poa}
redirect_button={redirect_button}
handleRequireSubmission={handleRequireSubmission}
/>
);
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const POISubmission = ({
country_code={selected_country.value}
is_from_external={is_from_external}
setIsCfdPoiCompleted={setIsCfdPoiCompleted}
allow_poi_resubmission={allow_poi_resubmission}
/>
);
default:
Expand Down

1 comment on commit 1f5392f

@vercel
Copy link

@vercel vercel bot commented on 1f5392f Sep 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
deriv-app.binary.sx
binary.sx
deriv-app-git-master.binary.sx

Please sign in to comment.