Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shahzaib/WALL-756/allow idv for vanuatu jurisdiction on MT5 #8907

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f8acbd6
chore: allow idv for vanuatu jurisdiction on MT5
shahzaib-deriv May 26, 2023
00024a9
chore: update document status message in jurisdiction cards regarding…
shahzaib-deriv May 26, 2023
1eadfb5
refactor: shared util function to check idv supported resident
shahzaib-deriv May 26, 2023
a3f9bcc
refactor: util function to get supported verification service
shahzaib-deriv May 29, 2023
68094dc
chore: added flag to check if idv is disallowed
shahzaib-deriv May 29, 2023
da9d06e
fix: failing test cases
shahzaib-deriv May 30, 2023
e0b6dea
refactor: refactoring the condition for better readability and concis…
shahzaib-deriv May 30, 2023
46a9b57
refactor: nullish coalescing operator
shahzaib-deriv May 30, 2023
41fb97c
refactor: updated type for authenticationStatusInfo util function
shahzaib-deriv May 30, 2023
c241aaf
chore: updated conditions regarding the vanuatu idv support in cfd
shahzaib-deriv May 30, 2023
a3c3a86
chore: updated conditions regarding the vanuatu idv support in cfd
shahzaib-deriv May 30, 2023
b68a7ee
chore: minor condition update
shahzaib-deriv May 30, 2023
8e25075
chore: update poa condition to poi in card banner
shahzaib-deriv May 31, 2023
d027e4d
chore: resolve review comments
shahzaib-deriv May 31, 2023
6b01c35
chore: prevent idv for eu region selection
shahzaib-deriv May 31, 2023
14575e7
refactor: condition to check verification status for maltainvest in cfd
shahzaib-deriv May 31, 2023
c76b1cb
refactor: renamed status variable for better readability
shahzaib-deriv May 31, 2023
2388993
refactor: renamed status variable name
shahzaib-deriv Jun 1, 2023
8372119
Merge branch 'shahzaib/KYC-756/enable-idv-for-vanuatu' into kyc-756-i…
likhith-deriv Jun 6, 2023
0c3aa77
chore: update jurisdiction content
shahzaib-deriv Jun 6, 2023
879c1ed
chore: update jurisdiction title indicator
shahzaib-deriv Jun 6, 2023
926ccf1
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jun 16, 2023
5d27fc5
chore: update test case
shahzaib-deriv Jun 19, 2023
7ba75b1
chore: update test case for format-response
shahzaib-deriv Jun 19, 2023
3606376
chore: update test case for cfd-poi
shahzaib-deriv Jun 19, 2023
e8a0f5e
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jun 22, 2023
5e1818e
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jun 23, 2023
58de449
chore: empty commit
shahzaib-deriv Jun 23, 2023
2f02a66
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jun 26, 2023
5f4b822
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jun 30, 2023
f63e19e
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 3, 2023
9e5d59b
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 3, 2023
bd7db56
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 3, 2023
095e903
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jul 5, 2023
9204d9c
fix: :bug: resolved incorrect section display (#5)
likhith-deriv Jul 5, 2023
c50b423
chore: :twisted_rightwards_arrows: synced master
likhith-deriv Jul 5, 2023
5634eeb
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jul 5, 2023
65dfe0f
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jul 6, 2023
b0312ea
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jul 11, 2023
93cdaf1
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jul 14, 2023
0ce012f
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 14, 2023
baaf254
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jul 17, 2023
0cf5e28
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 20, 2023
6aff174
Merge branch 'master' into kyc-756-integration-with-master
likhith-deriv Jul 21, 2023
3055934
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 24, 2023
1459e3e
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 24, 2023
5e2d611
Merge branch 'master' into kyc-756-integration-with-master
shahzaib-deriv Jul 26, 2023
0c895e3
Merge branch master of https://github.com/shahzaib-deriv/deriv-app in…
shahzaib-deriv Jul 26, 2023
930729c
fix: failing test cases
shahzaib-deriv Jul 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ const PoiPoaDocsSubmitted = ({
};

const getDescription = () => {
const { manual_status, poi_verified_for_vanuatu_maltainvest, poi_verified_for_bvi_labuan, poa_pending } =
const { manual_status, poi_verified_for_maltainvest, poi_verified_for_bvi_labuan_vanuatu, poa_pending } =
getAuthenticationStatusInfo(account_status);
const is_vanuatu_or_maltainvest_selected = [Jurisdiction.VANUATU, Jurisdiction.MALTA_INVEST].includes(
jurisdiction_selected_shortcode
);
const is_maltainvest_selected = jurisdiction_selected_shortcode === Jurisdiction.MALTA_INVEST;
if (
(is_vanuatu_or_maltainvest_selected && poi_verified_for_vanuatu_maltainvest && poa_pending) ||
(!is_vanuatu_or_maltainvest_selected && poi_verified_for_bvi_labuan && poa_pending) ||
(is_maltainvest_selected && poi_verified_for_maltainvest && poa_pending) ||
(!is_maltainvest_selected && poi_verified_for_bvi_labuan_vanuatu && poa_pending) ||
manual_status === 'pending'
) {
return localize('We’ll review your documents and notify you of its status within 1 - 3 working days.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const ProofOfIdentityContainerForMt5 = ({
onStateChange,
refreshNotifications,
citizen_data,
jurisdiction_selected_shortcode,
updateAccountStatus,
is_eu_user,
}) => {
const [api_error, setAPIError] = React.useState();
const [residence_list, setResidenceList] = React.useState();
Expand Down Expand Up @@ -88,9 +87,8 @@ const ProofOfIdentityContainerForMt5 = ({
residence_list={residence_list}
citizen_data={citizen_data}
has_idv_error={has_idv_error}
jurisdiction_selected_shortcode={jurisdiction_selected_shortcode}
getChangeableFields={getChangeableFields}
updateAccountStatus={updateAccountStatus}
is_eu_user={is_eu_user}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React from 'react';
import { WS, Jurisdiction, IDV_NOT_APPLICABLE_OPTION } from '@deriv/shared';
import { WS, isVerificationServiceSupported, IDV_NOT_APPLICABLE_OPTION } from '@deriv/shared';
import Unsupported from 'Components/poi/status/unsupported';
import OnfidoUpload from './onfido-sdk-view-container';
import { identity_status_codes, submission_status_code, service_code } from './proof-of-identity-utils';
Expand All @@ -18,22 +18,18 @@ const POISubmissionForMT5 = ({
refreshNotifications,
citizen_data,
has_idv_error,
jurisdiction_selected_shortcode,
residence_list,
is_eu_user,
}) => {
const [submission_status, setSubmissionStatus] = React.useState(); // submitting
const [submission_service, setSubmissionService] = React.useState();
React.useEffect(() => {
if (citizen_data) {
const { submissions_left: idv_submissions_left } = idv;
const { submissions_left: onfido_submissions_left } = onfido;
const is_idv_supported = citizen_data.identity.services.idv.is_country_supported;
const is_onfido_supported = citizen_data.identity.services.onfido.is_country_supported;
if (
is_idv_supported &&
Number(idv_submissions_left) > 0 &&
!is_idv_disallowed &&
jurisdiction_selected_shortcode !== Jurisdiction.VANUATU
) {
const is_idv_supported = isVerificationServiceSupported(residence_list, account_settings, 'idv');
const is_onfido_supported = isVerificationServiceSupported(residence_list, account_settings, 'onfido');
if (is_idv_supported && Number(idv_submissions_left) > 0 && !is_idv_disallowed && !is_eu_user) {
setSubmissionService(service_code.idv);
} else if (onfido_submissions_left > 0 && is_onfido_supported) {
setSubmissionService(service_code.onfido);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const FailedVerificationModal = () => {
const { disableApp, enableApp } = ui;
const is_from_multipliers = open_failed_verification_for === 'multipliers';

const { poi_resubmit_for_vanuatu_maltainvest, poi_resubmit_for_bvi_labuan, need_poa_resubmission } =
const { poi_resubmit_for_maltainvest, poi_resubmit_for_bvi_labuan_vanuatu, need_poa_resubmission } =
getAuthenticationStatusInfo(account_status);
const history = useHistory();

Expand All @@ -88,14 +88,10 @@ const FailedVerificationModal = () => {
};

const should_resubmit_poi = () => {
if (
is_from_multipliers ||
open_failed_verification_for === 'vanuatu' ||
open_failed_verification_for === 'maltainvest'
) {
return poi_resubmit_for_vanuatu_maltainvest;
if (is_from_multipliers || open_failed_verification_for === 'maltainvest') {
return poi_resubmit_for_maltainvest;
}
return poi_resubmit_for_bvi_labuan;
return poi_resubmit_for_bvi_labuan_vanuatu;
};
const should_resubmit_poa = need_poa_resubmission;
const from_account_label = is_from_multipliers ? localize('Multipliers') : localize('MT5');
Expand Down
4 changes: 4 additions & 0 deletions packages/cfd/src/Components/__tests__/cfd-poi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ describe('<CFDPOI />', () => {
form_error: undefined,
height: 'auto',
index: 1,
is_loading: false,
is_switching: false,
is_virtual: false,
is_eu_user: false,
onCancel: jest.fn(),
onSave: jest.fn(),
onSubmit: jest.fn(),
Expand Down
4 changes: 3 additions & 1 deletion packages/cfd/src/Components/cfd-poi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type TCFDPOIProps = {
};

const CFDPOI = observer(({ index, onSave, onSubmit, height, ...props }: TCFDPOIProps) => {
const { client, common, notifications } = useStore();
const { client, common, notifications, traders_hub } = useStore();

const {
account_status,
Expand All @@ -48,6 +48,7 @@ const CFDPOI = observer(({ index, onSave, onSubmit, height, ...props }: TCFDPOIP
} = client;
const { routeBackInApp, app_routing_history } = common;
const { refreshNotifications } = notifications;
const { is_eu_user } = traders_hub;

const poi_props = {
account_status,
Expand All @@ -64,6 +65,7 @@ const CFDPOI = observer(({ index, onSave, onSubmit, height, ...props }: TCFDPOIP
refreshNotifications,
getChangeableFields,
updateAccountStatus,
is_eu_user,
...props,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ describe('<CFDFinancialStpRealAccountSignup />', () => {
storeProofOfAddress: jest.fn(),
},
},
jurisdiction_selected_shortcode: 'svg',
};

it('should render CFDFinancialStpRealAccountSignup component', () => {
Expand All @@ -194,7 +195,7 @@ describe('<CFDFinancialStpRealAccountSignup />', () => {
});

it('should render properly for the first step content', () => {
getAuthenticationStatusInfo.mockReturnValueOnce({ need_poi_for_bvi_labuan: true });
getAuthenticationStatusInfo.mockReturnValueOnce({ need_poi_for_bvi_labuan_vanuatu: true });
render(<CFDFinancialStpRealAccountSignup />, {
wrapper: ({ children }) => <CFDProviders store={mockStore(mockRootStore)}>{children}</CFDProviders>,
});
Expand Down Expand Up @@ -223,7 +224,7 @@ describe('<CFDFinancialStpRealAccountSignup />', () => {
},
};

getAuthenticationStatusInfo.mockReturnValueOnce({ need_poi_for_vanuatu_maltainvest: true });
getAuthenticationStatusInfo.mockReturnValueOnce({ need_poi_for_bvi_labuan_vanuatu: true });

render(<CFDFinancialStpRealAccountSignup />, {
wrapper: ({ children }) => <CFDProviders store={mockStore(new_mock_store)}>{children}</CFDProviders>,
Expand All @@ -243,7 +244,7 @@ describe('<CFDFinancialStpRealAccountSignup />', () => {
},
};

getAuthenticationStatusInfo.mockReturnValueOnce({ need_poi_for_vanuatu_maltainvest: true });
getAuthenticationStatusInfo.mockReturnValueOnce({ need_poi_for_maltainvest: true });

render(<CFDFinancialStpRealAccountSignup />, {
wrapper: ({ children }) => <CFDProviders store={mockStore(new_mock_store)}>{children}</CFDProviders>,
Expand Down
23 changes: 10 additions & 13 deletions packages/cfd/src/Containers/cfd-dbvi-onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,27 @@ const CFDDbviOnboarding = observer(() => {

if (get_account_status?.authentication) {
const {
poi_acknowledged_for_vanuatu_maltainvest,
poi_acknowledged_for_bvi_labuan,
poi_acknowledged_for_maltainvest,
poi_acknowledged_for_bvi_labuan_vanuatu,
poa_acknowledged,
poa_resubmit_for_labuan,
need_poa_submission,
} = getAuthenticationStatusInfo(get_account_status);

if (jurisdiction_selected_shortcode === Jurisdiction.VANUATU) {
setShowSubmittedModal(
poi_acknowledged_for_vanuatu_maltainvest &&
poa_acknowledged &&
has_submitted_cfd_personal_details
);
} else if (jurisdiction_selected_shortcode === Jurisdiction.MALTA_INVEST) {
setShowSubmittedModal(poi_acknowledged_for_vanuatu_maltainvest && poa_acknowledged);
if (jurisdiction_selected_shortcode === Jurisdiction.MALTA_INVEST) {
setShowSubmittedModal(poi_acknowledged_for_maltainvest && poa_acknowledged);
} else if (jurisdiction_selected_shortcode === Jurisdiction.LABUAN) {
/* When verified with IDV+ Photo ID, POA is auto verified */
const is_poa_submitted = poa_resubmit_for_labuan ? false : !need_poa_submission;
setShowSubmittedModal(
poi_acknowledged_for_bvi_labuan && has_submitted_cfd_personal_details && is_poa_submitted
poi_acknowledged_for_bvi_labuan_vanuatu &&
has_submitted_cfd_personal_details &&
is_poa_submitted
);
} else
setShowSubmittedModal(
poi_acknowledged_for_bvi_labuan && poa_acknowledged && has_submitted_cfd_personal_details
poi_acknowledged_for_bvi_labuan_vanuatu &&
poa_acknowledged &&
has_submitted_cfd_personal_details
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const CFDFinancialStpRealAccountSignup = observer(({ onFinish }: TCFDFinancialSt
const state_index = step;
let is_mounted = React.useRef(true).current;

const { need_poi_for_vanuatu_maltainvest, need_poi_for_bvi_labuan } = getAuthenticationStatusInfo(account_status);
const { need_poi_for_maltainvest, need_poi_for_bvi_labuan_vanuatu } = getAuthenticationStatusInfo(account_status);

const is_authenticated_with_idv_photoid = useIsAccountStatusPresent('authenticated_with_idv_photoid');

Expand Down Expand Up @@ -137,10 +137,10 @@ const CFDFinancialStpRealAccountSignup = observer(({ onFinish }: TCFDFinancialSt
};

const should_show_poi = () => {
if ([Jurisdiction.VANUATU, Jurisdiction.MALTA_INVEST].includes(jurisdiction_selected_shortcode)) {
return need_poi_for_vanuatu_maltainvest;
if (jurisdiction_selected_shortcode === Jurisdiction.MALTA_INVEST) {
return need_poi_for_maltainvest;
}
return need_poi_for_bvi_labuan;
return need_poi_for_bvi_labuan_vanuatu;
};

const shouldShowPOA = () => {
Expand Down
10 changes: 4 additions & 6 deletions packages/cfd/src/Containers/cfd-password-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ const CFDPasswordModal = observer(({ form_error, platform }: TCFDPasswordModalPr
const is_password_reset = error_type === 'PasswordReset';
const [is_sent_email_modal_open, setIsSentEmailModalOpen] = React.useState(false);

const { poi_verified_for_bvi_labuan, poi_verified_for_vanuatu_maltainvest, poa_verified, manual_status } =
const { poi_verified_for_bvi_labuan_vanuatu, poi_verified_for_maltainvest, poa_verified, manual_status } =
getAuthenticationStatusInfo(account_status);

const [is_selected_mt5_verified, setIsSelectedMT5Verified] = React.useState(false);
Expand All @@ -649,16 +649,14 @@ const CFDPasswordModal = observer(({ form_error, platform }: TCFDPasswordModalPr
setIsSelectedMT5Verified(true);
break;
case Jurisdiction.BVI:
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan);
break;
case Jurisdiction.VANUATU:
setIsSelectedMT5Verified(poi_verified_for_vanuatu_maltainvest);
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan_vanuatu);
break;
case Jurisdiction.LABUAN:
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan && poa_verified);
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan_vanuatu && poa_verified);
break;
case Jurisdiction.MALTA_INVEST:
setIsSelectedMT5Verified(poi_verified_for_vanuatu_maltainvest && poa_verified);
setIsSelectedMT5Verified(poi_verified_for_maltainvest && poa_verified);
break;
default:
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const JurisdictionModalContentWrapper = observer(({ openPasswordModal }: TJurisd

const {
poi_or_poa_not_submitted,
poi_acknowledged_for_bvi_labuan,
poi_acknowledged_for_vanuatu_maltainvest,
poi_acknowledged_for_bvi_labuan_vanuatu,
poi_acknowledged_for_maltainvest,
poa_acknowledged,
need_poa_resubmission,
poa_resubmit_for_labuan,
Expand Down Expand Up @@ -144,7 +144,7 @@ const JurisdictionModalContentWrapper = observer(({ openPasswordModal }: TJurisd
openPasswordModal(type_of_account);
} else if (is_vanuatu_selected) {
if (
poi_acknowledged_for_vanuatu_maltainvest &&
poi_acknowledged_for_bvi_labuan_vanuatu &&
!poi_or_poa_not_submitted &&
!should_restrict_vanuatu_account_creation &&
poa_acknowledged &&
Expand All @@ -156,7 +156,7 @@ const JurisdictionModalContentWrapper = observer(({ openPasswordModal }: TJurisd
}
} else if (is_bvi_selected) {
if (
poi_acknowledged_for_bvi_labuan &&
poi_acknowledged_for_bvi_labuan_vanuatu &&
!poi_or_poa_not_submitted &&
!should_restrict_bvi_account_creation &&
poa_acknowledged &&
Expand All @@ -168,7 +168,7 @@ const JurisdictionModalContentWrapper = observer(({ openPasswordModal }: TJurisd
}
} else if (is_labuan_selected) {
if (
poi_acknowledged_for_bvi_labuan &&
poi_acknowledged_for_bvi_labuan_vanuatu &&
poa_acknowledged &&
has_submitted_cfd_personal_details &&
!poa_resubmit_for_labuan
Expand All @@ -178,7 +178,7 @@ const JurisdictionModalContentWrapper = observer(({ openPasswordModal }: TJurisd
toggleCFDVerificationModal();
}
} else if (is_maltainvest_selected) {
if (poi_acknowledged_for_vanuatu_maltainvest && poa_acknowledged) {
if (poi_acknowledged_for_maltainvest && poa_acknowledged) {
openPasswordModal(type_of_account);
} else {
toggleCFDVerificationModal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,36 @@ const JurisdictionTitleIndicator = ({
verification_docs,
}: TJurisdictionTitleIndicatorProps) => {
const {
poi_pending_for_bvi_labuan,
poi_resubmit_for_bvi_labuan,
poi_verified_for_bvi_labuan,
poi_pending_for_vanuatu_maltainvest,
poi_resubmit_for_vanuatu_maltainvest,
poi_verified_for_vanuatu_maltainvest,
poi_pending_for_bvi_labuan_vanuatu,
poi_resubmit_for_bvi_labuan_vanuatu,
poi_verified_for_bvi_labuan_vanuatu,
poi_pending_for_maltainvest,
poi_resubmit_for_maltainvest,
poi_verified_for_maltainvest,
poa_pending,
need_poa_resubmission,
poa_verified,
} = getAuthenticationStatusInfo(account_status);

const getVerificationIconVariant = (verification_document: TJurisdictionCardItemVerificationItem): string => {
let icon_variant: TJurisdictionCardVerificationStatus = 'Default';
if ([Jurisdiction.BVI, Jurisdiction.LABUAN].includes(type_of_card)) {
if ([Jurisdiction.BVI, Jurisdiction.LABUAN, Jurisdiction.VANUATU].includes(type_of_card)) {
if (['document_number', 'selfie', 'identity_document'].includes(verification_document)) {
if (poi_pending_for_bvi_labuan) {
if (poi_pending_for_bvi_labuan_vanuatu) {
icon_variant = 'Pending';
} else if (poi_resubmit_for_bvi_labuan) {
} else if (poi_resubmit_for_bvi_labuan_vanuatu) {
icon_variant = 'Failed';
} else if (poi_verified_for_bvi_labuan) {
} else if (poi_verified_for_bvi_labuan_vanuatu) {
icon_variant = 'Verified';
}
}
} else if ([Jurisdiction.VANUATU, Jurisdiction.MALTA_INVEST].includes(type_of_card)) {
} else if (Jurisdiction.MALTA_INVEST === type_of_card) {
if (['document_number', 'selfie', 'identity_document'].includes(verification_document)) {
if (poi_pending_for_vanuatu_maltainvest) {
if (poi_pending_for_maltainvest) {
icon_variant = 'Pending';
} else if (poi_resubmit_for_vanuatu_maltainvest) {
} else if (poi_resubmit_for_maltainvest) {
icon_variant = 'Failed';
} else if (poi_verified_for_vanuatu_maltainvest) {
} else if (poi_verified_for_maltainvest) {
icon_variant = 'Verified';
}
}
Expand Down
Loading