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

fix: maltainvest should verify through onfido #44

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -31,12 +31,13 @@ const PoiPoaDocsSubmitted = ({
};

const getDescription = () => {
const { manual_status, poi_verified_for_vanuatu, poi_verified_for_bvi_labuan_maltainvest, poa_pending } =
const { manual_status, poi_verified_for_vanuatu_maltainvest, poi_verified_for_bvi_labuan, poa_pending } =
getAuthenticationStatusInfo(account_status);
const is_vanuatu_selected = jurisdiction_selected_shortcode === 'vanuatu';
const is_vanuatu_or_maltainvest_selected =
jurisdiction_selected_shortcode === 'vanuatu' || jurisdiction_selected_shortcode === 'maltainvest';
if (
(is_vanuatu_selected && poi_verified_for_vanuatu && poa_pending) ||
(!is_vanuatu_selected && poi_verified_for_bvi_labuan_maltainvest && poa_pending) ||
(is_vanuatu_or_maltainvest_selected && poi_verified_for_vanuatu_maltainvest && poa_pending) ||
(!is_vanuatu_or_maltainvest_selected && poi_verified_for_bvi_labuan && 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
12 changes: 6 additions & 6 deletions packages/cfd/src/Containers/cfd-dbvi-onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ const CFDDbviOnboarding = ({
const { get_account_status } = response;

if (get_account_status?.authentication) {
const { poi_acknowledged_for_vanuatu, poi_acknowledged_for_bvi_labuan_maltainvest, poa_acknowledged } =
const { poi_acknowledged_for_vanuatu_maltainvest, poi_acknowledged_for_bvi_labuan, poa_acknowledged } =
getAuthenticationStatusInfo(get_account_status);
if (jurisdiction_selected_shortcode === 'vanuatu') {
setShowSubmittedModal(
poi_acknowledged_for_vanuatu && poa_acknowledged && has_submitted_cfd_personal_details
poi_acknowledged_for_vanuatu_maltainvest &&
poa_acknowledged &&
has_submitted_cfd_personal_details
);
} else if (jurisdiction_selected_shortcode === 'maltainvest') {
setShowSubmittedModal(poi_acknowledged_for_bvi_labuan_maltainvest && poa_acknowledged);
setShowSubmittedModal(poi_acknowledged_for_vanuatu_maltainvest && poa_acknowledged);
} else
setShowSubmittedModal(
poi_acknowledged_for_bvi_labuan_maltainvest &&
poa_acknowledged &&
has_submitted_cfd_personal_details
poi_acknowledged_for_bvi_labuan && poa_acknowledged && has_submitted_cfd_personal_details
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const CFDFinancialStpRealAccountSignup = (props: TCFDFinancialStpRealAccountSign
const state_index = step;
let is_mounted = React.useRef(true).current;

const { need_poi_for_vanuatu, need_poi_for_bvi_labuan_maltainvest } = getAuthenticationStatusInfo(account_status);
const { need_poi_for_vanuatu_maltainvest, need_poi_for_bvi_labuan } = getAuthenticationStatusInfo(account_status);

const poi_config: TItemsState = {
body: CFDPOI,
Expand Down Expand Up @@ -112,10 +112,10 @@ const CFDFinancialStpRealAccountSignup = (props: TCFDFinancialStpRealAccountSign
};

const should_show_poi = () => {
if (props.jurisdiction_selected_shortcode === 'vanuatu' && need_poi_for_vanuatu) {
return true;
if (jurisdiction_selected_shortcode === 'vanuatu' || jurisdiction_selected_shortcode === 'maltainvest') {
return need_poi_for_vanuatu_maltainvest;
}
return need_poi_for_bvi_labuan_maltainvest;
return need_poi_for_bvi_labuan;
};
const should_show_poa = !(
authentication_status.document_status === 'pending' || authentication_status.document_status === 'verified'
Expand Down
12 changes: 7 additions & 5 deletions packages/cfd/src/Containers/cfd-password-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ const CFDPasswordModal = ({
const is_password_reset = error_type === 'PasswordReset';
const [is_sent_email_modal_open, setIsSentEmailModalOpen] = React.useState(false);

const { poi_verified_for_bvi_labuan_maltainvest, poi_verified_for_vanuatu, poa_verified, manual_status } =
const { poi_verified_for_bvi_labuan, poi_verified_for_vanuatu_maltainvest, poa_verified, manual_status } =
getAuthenticationStatusInfo(account_status);

const [is_selected_mt5_verified, setIsSelectedMT5Verified] = React.useState(false);
Expand All @@ -619,11 +619,13 @@ const CFDPasswordModal = ({
if (jurisdiction_selected_shortcode === 'svg') {
setIsSelectedMT5Verified(true);
} else if (jurisdiction_selected_shortcode === 'bvi') {
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan_maltainvest);
} else if (['labuan', 'maltainvest'].includes(jurisdiction_selected_shortcode)) {
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan_maltainvest && poa_verified);
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan);
} else if (jurisdiction_selected_shortcode === 'vanuatu') {
setIsSelectedMT5Verified(poi_verified_for_vanuatu);
setIsSelectedMT5Verified(poi_verified_for_vanuatu_maltainvest);
} else if (jurisdiction_selected_shortcode === 'labuan') {
setIsSelectedMT5Verified(poi_verified_for_bvi_labuan && poa_verified);
} else if (jurisdiction_selected_shortcode === 'maltainvest') {
setIsSelectedMT5Verified(poi_verified_for_vanuatu_maltainvest && poa_verified);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const VerificationStatusBanner = ({
real_financial_accounts_existing_data,
}: TVerificationStatusBannerProps) => {
const {
poi_not_submitted_for_vanuatu,
poi_not_submitted_for_vanuatu_maltainvest,
poi_or_poa_not_submitted,
poi_resubmit_for_vanuatu,
poi_resubmit_for_bvi_labuan_maltainvest,
poi_resubmit_for_vanuatu_maltainvest,
poi_resubmit_for_bvi_labuan,
need_poa_resubmission,
need_poi_for_bvi_labuan_maltainvest,
need_poi_for_bvi_labuan,
poa_pending,
} = getAuthenticationStatusInfo(account_status);

Expand All @@ -42,7 +42,8 @@ const VerificationStatusBanner = ({
const is_svg = type_of_card === 'svg';
const is_vanuatu = type_of_card === 'vanuatu';
const is_bvi = type_of_card === 'bvi';
const is_labuan_or_maltainvest = ['labuan', 'maltainvest'].includes(type_of_card);
const is_labuan = type_of_card === 'labuan';
const is_maltainvest = type_of_card === 'maltainvest';

const getTypeTitle = () => {
switch (type_of_card) {
Expand Down Expand Up @@ -119,7 +120,7 @@ const VerificationStatusBanner = ({
</Text>
</div>
);
} else if (is_vanuatu && poi_not_submitted_for_vanuatu) {
} else if (is_vanuatu && poi_not_submitted_for_vanuatu_maltainvest) {
return (
<div className={`${card_classname}__verification-status--not_submitted`}>
<Text as='p' size='xxs' align='center' color='prominent'>
Expand All @@ -128,8 +129,8 @@ const VerificationStatusBanner = ({
</div>
);
} else if (
((is_bvi || is_labuan_or_maltainvest) && need_poa_resubmission && need_poi_for_bvi_labuan_maltainvest) ||
(is_vanuatu && poi_resubmit_for_vanuatu && need_poa_resubmission)
((is_bvi || is_labuan) && need_poi_for_bvi_labuan && need_poa_resubmission) ||
((is_vanuatu || is_maltainvest) && poi_resubmit_for_vanuatu_maltainvest && need_poa_resubmission)
) {
return (
<div className={`${card_classname}__verification-status--failed`}>
Expand All @@ -139,8 +140,8 @@ const VerificationStatusBanner = ({
</div>
);
} else if (
(is_vanuatu && poi_resubmit_for_vanuatu) ||
((is_bvi || is_labuan_or_maltainvest) && poi_resubmit_for_bvi_labuan_maltainvest)
((is_bvi || is_labuan) && poi_resubmit_for_bvi_labuan) ||
((is_vanuatu || is_maltainvest) && poi_resubmit_for_vanuatu_maltainvest)
) {
return (
<div className={`${card_classname}__verification-status--failed`}>
Expand All @@ -149,7 +150,7 @@ const VerificationStatusBanner = ({
</Text>
</div>
);
} else if ((is_bvi || is_vanuatu || is_labuan_or_maltainvest) && need_poa_resubmission) {
} else if (!is_svg && need_poa_resubmission) {
return (
<div className={`${card_classname}__verification-status--failed`}>
<Text size='xxs' color='colored-background'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const JurisdictionModal = ({

const {
poi_or_poa_not_submitted,
poi_acknowledged_for_bvi_labuan_maltainvest,
poi_acknowledged_for_vanuatu,
poi_acknowledged_for_bvi_labuan,
poi_acknowledged_for_vanuatu_maltainvest,
poa_acknowledged,
} = getAuthenticationStatusInfo(account_status);

Expand Down Expand Up @@ -105,7 +105,7 @@ const JurisdictionModal = ({
openPasswordModal(type_of_account);
} else if (is_vanuatu_selected) {
if (
poi_acknowledged_for_vanuatu &&
poi_acknowledged_for_vanuatu_maltainvest &&
!poi_or_poa_not_submitted &&
poa_acknowledged &&
has_submitted_cfd_personal_details
Expand All @@ -116,7 +116,7 @@ const JurisdictionModal = ({
}
} else if (is_bvi_selected) {
if (
poi_acknowledged_for_bvi_labuan_maltainvest &&
poi_acknowledged_for_bvi_labuan &&
!poi_or_poa_not_submitted &&
!should_restrict_bvi_account_creation &&
poa_acknowledged &&
Expand All @@ -126,8 +126,14 @@ const JurisdictionModal = ({
} else {
toggleCFDVerificationModal();
}
} else if (is_labuan_selected || (is_eu && is_maltainvest_selected)) {
if (poi_acknowledged_for_bvi_labuan_maltainvest && poa_acknowledged && has_submitted_cfd_personal_details) {
} else if (is_labuan_selected) {
if (poi_acknowledged_for_bvi_labuan && poa_acknowledged && has_submitted_cfd_personal_details) {
openPasswordModal(type_of_account);
} else {
toggleCFDVerificationModal();
}
} else if (is_maltainvest_selected) {
if (poi_acknowledged_for_vanuatu_maltainvest && poa_acknowledged) {
openPasswordModal(type_of_account);
} else {
toggleCFDVerificationModal();
Expand Down
12 changes: 6 additions & 6 deletions packages/cfd/src/Containers/mt5-compare-table-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ const DMT5CompareModalContent = ({

const {
poi_or_poa_not_submitted,
poi_acknowledged_for_vanuatu,
poi_acknowledged_for_bvi_labuan_maltainvest,
poi_acknowledged_for_vanuatu_maltainvest,
poi_acknowledged_for_bvi_labuan,
poa_acknowledged,
poa_pending,
} = getAuthenticationStatusInfo(account_status);
Expand Down Expand Up @@ -379,7 +379,7 @@ const DMT5CompareModalContent = ({
setAppstorePlatform(CFD_PLATFORMS.MT5);
setJurisdictionSelectedShortcode('bvi');
if (
poi_acknowledged_for_bvi_labuan_maltainvest &&
poi_acknowledged_for_bvi_labuan &&
!poi_or_poa_not_submitted &&
!should_restrict_bvi_account_creation &&
has_submitted_personal_details &&
Expand All @@ -394,7 +394,7 @@ const DMT5CompareModalContent = ({
setAppstorePlatform(CFD_PLATFORMS.MT5);
setJurisdictionSelectedShortcode('vanuatu');
if (
poi_acknowledged_for_vanuatu &&
poi_acknowledged_for_vanuatu_maltainvest &&
!poi_or_poa_not_submitted &&
has_submitted_personal_details &&
poa_acknowledged
Expand All @@ -407,7 +407,7 @@ const DMT5CompareModalContent = ({
case 'financial_labuan':
setAppstorePlatform(CFD_PLATFORMS.MT5);
setJurisdictionSelectedShortcode('labuan');
if (poi_acknowledged_for_bvi_labuan_maltainvest && poa_acknowledged && has_submitted_personal_details) {
if (poi_acknowledged_for_bvi_labuan && poa_acknowledged && has_submitted_personal_details) {
openPasswordModal(type_of_account);
} else {
toggleCFDVerificationModal();
Expand All @@ -416,7 +416,7 @@ const DMT5CompareModalContent = ({
case 'financial_maltainvest':
setAppstorePlatform(CFD_PLATFORMS.MT5);
setJurisdictionSelectedShortcode('maltainvest');
if (poi_acknowledged_for_bvi_labuan_maltainvest && poa_acknowledged && has_submitted_personal_details) {
if (poi_acknowledged_for_vanuatu_maltainvest && poa_acknowledged) {
openPasswordModal(type_of_account);
} else {
toggleCFDVerificationModal();
Expand Down
70 changes: 35 additions & 35 deletions packages/shared/src/utils/cfd/cfd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,54 +236,54 @@ export const getAuthenticationStatusInfo = (account_status: GetAccountStatus) =>
const poi_not_submitted = poi_status === 'none';
const poi_or_poa_not_submitted = poa_not_submitted || poi_not_submitted;

//vanuatu
//vanuatu-maltainvest

const poi_verified_for_vanuatu = [onfido_status, manual_status].includes('verified');
const poi_acknowledged_for_vanuatu =
const poi_verified_for_vanuatu_maltainvest = [onfido_status, manual_status].includes('verified');
const poi_acknowledged_for_vanuatu_maltainvest =
(onfido_status && acknowledged_status.includes(onfido_status)) ||
(manual_status && acknowledged_status.includes(manual_status));

const poi_pending_for_vanuatu =
const poi_pending_for_vanuatu_maltainvest =
onfido_status &&
manual_status &&
[onfido_status, manual_status].includes('pending') &&
!poi_verified_for_vanuatu;
!poi_verified_for_vanuatu_maltainvest;

const need_poi_for_vanuatu = !poi_acknowledged_for_vanuatu;
const poi_not_submitted_for_vanuatu =
const need_poi_for_vanuatu_maltainvest = !poi_acknowledged_for_vanuatu_maltainvest;
const poi_not_submitted_for_vanuatu_maltainvest =
onfido_status && manual_status && [onfido_status, manual_status].every(status => status === 'none');
const poi_resubmit_for_vanuatu =
!poi_pending_for_vanuatu && !poi_not_submitted_for_vanuatu && !poi_verified_for_vanuatu;
const poi_resubmit_for_vanuatu_maltainvest =
!poi_pending_for_vanuatu_maltainvest &&
!poi_not_submitted_for_vanuatu_maltainvest &&
!poi_verified_for_vanuatu_maltainvest;

const poi_poa_verified_for_vanuatu = poi_verified_for_vanuatu && poa_verified;
const poi_poa_verified_for_vanuatu_maltainvest = poi_verified_for_vanuatu_maltainvest && poa_verified;

//bvi-labuan-maltainvest
const poi_acknowledged_for_bvi_labuan_maltainvest =
//bvi-labuan
const poi_acknowledged_for_bvi_labuan =
(idv_status && acknowledged_status.includes(idv_status)) ||
(onfido_status && acknowledged_status.includes(onfido_status)) ||
(manual_status && acknowledged_status.includes(manual_status));

const need_poi_for_bvi_labuan_maltainvest = !poi_acknowledged_for_bvi_labuan_maltainvest;
const poi_not_submitted_for_bvi_labuan_maltainvest =
const need_poi_for_bvi_labuan = !poi_acknowledged_for_bvi_labuan;
const poi_not_submitted_for_bvi_labuan =
idv_status &&
onfido_status &&
manual_status &&
[idv_status, onfido_status, manual_status].every(status => status === 'none');

const poi_verified_for_bvi_labuan_maltainvest = [idv_status, onfido_status, manual_status].includes('verified');
const poi_verified_for_bvi_labuan = [idv_status, onfido_status, manual_status].includes('verified');

const poi_pending_for_bvi_labuan_maltainvest =
const poi_pending_for_bvi_labuan =
idv_status &&
onfido_status &&
manual_status &&
[idv_status, onfido_status, manual_status].includes('pending') &&
!poi_verified_for_bvi_labuan_maltainvest;
!poi_verified_for_bvi_labuan;

const poi_resubmit_for_bvi_labuan_maltainvest =
!poi_pending_for_bvi_labuan_maltainvest &&
!poi_not_submitted_for_bvi_labuan_maltainvest &&
!poi_verified_for_bvi_labuan_maltainvest;
const poi_poa_verified_for_bvi_labuan_maltainvest = poi_verified_for_bvi_labuan_maltainvest && poa_verified;
const poi_resubmit_for_bvi_labuan =
!poi_pending_for_bvi_labuan && !poi_not_submitted_for_bvi_labuan && !poi_verified_for_bvi_labuan;
const poi_poa_verified_for_bvi_labuan = poi_verified_for_bvi_labuan && poa_verified;

return {
poa_status,
Expand All @@ -292,26 +292,26 @@ export const getAuthenticationStatusInfo = (account_status: GetAccountStatus) =>
onfido_status,
manual_status,
acknowledged_status,
poi_acknowledged_for_vanuatu,
poi_poa_verified_for_bvi_labuan_maltainvest,
poi_acknowledged_for_vanuatu_maltainvest,
poi_poa_verified_for_bvi_labuan,
poa_acknowledged,
poi_poa_verified_for_vanuatu,
poi_poa_verified_for_vanuatu_maltainvest,
need_poa_submission,
poi_verified_for_vanuatu,
poi_acknowledged_for_bvi_labuan_maltainvest,
poi_verified_for_bvi_labuan_maltainvest,
poi_verified_for_vanuatu_maltainvest,
poi_acknowledged_for_bvi_labuan,
poi_verified_for_bvi_labuan,
poa_verified,
poi_or_poa_not_submitted,
need_poa_resubmission,
poa_not_submitted,
poi_not_submitted,
need_poi_for_vanuatu,
need_poi_for_bvi_labuan_maltainvest,
poi_not_submitted_for_vanuatu,
poi_pending_for_bvi_labuan_maltainvest,
poi_pending_for_vanuatu,
poi_resubmit_for_vanuatu,
poi_resubmit_for_bvi_labuan_maltainvest,
need_poi_for_vanuatu_maltainvest,
need_poi_for_bvi_labuan,
poi_not_submitted_for_vanuatu_maltainvest,
poi_pending_for_bvi_labuan,
poi_pending_for_vanuatu_maltainvest,
poi_resubmit_for_vanuatu_maltainvest,
poi_resubmit_for_bvi_labuan,
poa_pending,
};
};