From 2b3305c8673c469289b0af3a113841a558248045 Mon Sep 17 00:00:00 2001 From: likhith Date: Mon, 21 Oct 2024 12:21:16 +0400 Subject: [PATCH 1/4] fix: notification status --- packages/core/src/Stores/notification-store.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/core/src/Stores/notification-store.js b/packages/core/src/Stores/notification-store.js index f868e19756ab..3d214641b955 100644 --- a/packages/core/src/Stores/notification-store.js +++ b/packages/core/src/Stores/notification-store.js @@ -232,15 +232,19 @@ export default class NotificationStore extends BaseStore { } addVerificationNotifications(identity, document, has_restricted_mt5_account, has_mt5_account_with_rejected_poa) { - if (identity.status === 'verified') { + const status = this.root_store.client.account_status.status; + if (identity.status === 'verified' && !status.includes('allow_poi_resubmission')) { //identity this.addNotificationMessage(this.client_notifications.poi_verified); - } else if (!['none', 'pending', 'expired'].includes(identity.status)) { + } else if ( + !['none', 'pending', 'expired'].includes(identity.status) || + status.includes('allow_poi_resubmission') + ) { this.addNotificationMessage(this.client_notifications.poi_failed); } // document - if (document.status === 'verified') { + if (document.status === 'verified' && !status.includes('allow_poa_resubmission')) { this.addNotificationMessage(this.client_notifications.poa_verified); } else if (has_restricted_mt5_account) { if (document.status === 'pending') { @@ -250,7 +254,10 @@ export default class NotificationStore extends BaseStore { } } else if (has_mt5_account_with_rejected_poa) { this.addNotificationMessage(this.client_notifications.poa_rejected_for_mt5); - } else if (!['none', 'pending', 'expired'].includes(document.status)) { + } else if ( + !['none', 'pending', 'expired'].includes(document.status) || + status.includes('allow_poa_resubmission') + ) { this.addNotificationMessage(this.client_notifications.poa_failed); } } From 9a8424ff82aebbcd5964a4126702a0461d4f1398 Mon Sep 17 00:00:00 2001 From: likhith Date: Mon, 21 Oct 2024 15:17:40 +0400 Subject: [PATCH 2/4] fix: poa resubmission --- .../account/src/Configs/get-status-badge-config.tsx | 13 ++++++++++--- .../appstore/src/components/cfds-listing/index.tsx | 1 + .../src/components/containers/trading-app-card.tsx | 6 +++++- .../failed-verification-modal.tsx | 10 +++++----- packages/appstore/src/types/common.types.ts | 5 +++++ packages/core/src/Stores/client-store.js | 7 +++++++ packages/core/src/Stores/traders-hub-store.js | 5 +++++ packages/stores/types.ts | 6 ++++++ 8 files changed, 44 insertions(+), 9 deletions(-) diff --git a/packages/account/src/Configs/get-status-badge-config.tsx b/packages/account/src/Configs/get-status-badge-config.tsx index 1b2d2c24df5b..26795c8a239a 100644 --- a/packages/account/src/Configs/get-status-badge-config.tsx +++ b/packages/account/src/Configs/get-status-badge-config.tsx @@ -7,8 +7,8 @@ import { Link } from 'react-router-dom'; const getStatusBadgeConfig = ( mt5_account_status: TMT5AccountStatus, - openFailedVerificationModal?: (selected_account_type: string) => void, - selected_account_type?: string, + openFailedVerificationModal?: (selected_account_type: any) => void, + selected_account_type?: any, setIsVerificationModalVisible?: (value: boolean) => void, user_account_status?: { poi_status: TAuthStatusCodes; poa_status: TAuthStatusCodes } ) => { @@ -36,7 +36,14 @@ const getStatusBadgeConfig = ( key={1} className='link-verification-failed' onClick={() => { - openFailedVerificationModal?.(selected_account_type ?? ''); + if (selected_account_type) { + selected_account_type.client_kyc_status = { + poi_status: user_account_status?.poi_status, + poa_status: user_account_status?.poa_status, + }; + selected_account_type; + openFailedVerificationModal?.(selected_account_type ?? ''); + } }} />, ]} diff --git a/packages/appstore/src/components/cfds-listing/index.tsx b/packages/appstore/src/components/cfds-listing/index.tsx index 899b77f67fc0..52e751fd9e74 100644 --- a/packages/appstore/src/components/cfds-listing/index.tsx +++ b/packages/appstore/src/components/cfds-listing/index.tsx @@ -275,6 +275,7 @@ const CFDsListing = observer(() => { return ( { diff --git a/packages/appstore/src/components/modals/failed-veriification-modal/failed-verification-modal.tsx b/packages/appstore/src/components/modals/failed-veriification-modal/failed-verification-modal.tsx index d359e637109b..05a44c99586d 100644 --- a/packages/appstore/src/components/modals/failed-veriification-modal/failed-verification-modal.tsx +++ b/packages/appstore/src/components/modals/failed-veriification-modal/failed-verification-modal.tsx @@ -77,7 +77,7 @@ const FailedVerificationModal = () => { open_failed_verification_for, startTrade, } = traders_hub; - const { account_status } = client; + const { account_status, client_kyc_status } = client; const { toggleCFDVerificationModal, current_list } = cfd; const { disableApp, enableApp, is_mt5_verification_failed_modal, setIsMT5VerificationFailedModal } = ui; const is_from_multipliers = open_failed_verification_for === 'multipliers'; @@ -85,8 +85,7 @@ const FailedVerificationModal = () => { .map(key => current_list[key]) .some(account => account.landing_company_short === Jurisdiction.MALTA_INVEST); - const { poi_resubmit_for_maltainvest, poi_resubmit_for_bvi_labuan_vanuatu, need_poa_resubmission } = - getAuthenticationStatusInfo(account_status); + const { poi_resubmit_for_maltainvest } = getAuthenticationStatusInfo(account_status); const history = useHistory(); const closeModal = () => { @@ -117,9 +116,10 @@ const FailedVerificationModal = () => { if (is_from_multipliers || open_failed_verification_for === 'maltainvest') { return poi_resubmit_for_maltainvest; } - return poi_resubmit_for_bvi_labuan_vanuatu; + return ['rejected', 'expired', 'suspected'].includes(client_kyc_status?.poi_status); }; - const should_resubmit_poa = need_poa_resubmission; + + const should_resubmit_poa = ['rejected', 'expired', 'suspected'].includes(client_kyc_status?.poa_status); const from_account_label = is_from_multipliers ? localize('Multipliers') : localize('MT5'); return ( diff --git a/packages/appstore/src/types/common.types.ts b/packages/appstore/src/types/common.types.ts index a420bd38eb5d..4813d0bb1cd4 100644 --- a/packages/appstore/src/types/common.types.ts +++ b/packages/appstore/src/types/common.types.ts @@ -65,6 +65,11 @@ export type TDetailsOfEachMT5Loginid = DetailsOfEachMT5Loginid & { product?: 'swap_free' | 'zero_spread' | 'derivx' | 'ctrader'; openFailedVerificationModal?: (from_account: string) => void; market_type: NonNullable | TMarketType; + client_kyc_status?: { + poa_status: string; + poi_status: string; + valid_tin: 0 | 1; + }; }; export type TTradingPlatformAvailableAccount = { diff --git a/packages/core/src/Stores/client-store.js b/packages/core/src/Stores/client-store.js index 2a0757625183..95836f4164d0 100644 --- a/packages/core/src/Stores/client-store.js +++ b/packages/core/src/Stores/client-store.js @@ -169,6 +169,7 @@ export default class ClientStore extends BaseStore { subscriptions = {}; exchange_rates = {}; + client_kyc_status = {}; constructor(root_store) { const local_storage_properties = ['device_data']; @@ -433,6 +434,8 @@ export default class ClientStore extends BaseStore { setTradersHubTracking: action.bound, account_time_of_closure: computed, is_account_to_be_closed_by_residence: computed, + setClientKYCStatus: action.bound, + client_kyc_status: observable, }); reaction( @@ -2934,4 +2937,8 @@ export default class ClientStore extends BaseStore { get is_account_to_be_closed_by_residence() { return this.account_time_of_closure && this.residence && this.residence === 'sn'; } + + setClientKYCStatus(client_kyc_status) { + this.client_kyc_status = client_kyc_status; + } } diff --git a/packages/core/src/Stores/traders-hub-store.js b/packages/core/src/Stores/traders-hub-store.js index 2ab2458450e5..c5739e6cc1fa 100644 --- a/packages/core/src/Stores/traders-hub-store.js +++ b/packages/core/src/Stores/traders-hub-store.js @@ -823,11 +823,16 @@ export default class TradersHubStore extends BaseStore { openFailedVerificationModal(selected_account_type) { const { common, + client, modules: { cfd }, } = this.root_store; const { setJurisdictionSelectedShortcode, setAccountType } = cfd; const { setAppstorePlatform } = common; + if (selected_account_type?.client_kyc_status) { + client.setClientKYCStatus(selected_account_type.client_kyc_status); + } + if (selected_account_type?.platform === CFD_PLATFORMS.MT5) { setAppstorePlatform(selected_account_type.platform); setAccountType({ diff --git a/packages/stores/types.ts b/packages/stores/types.ts index efb2ffe82165..30b743491787 100644 --- a/packages/stores/types.ts +++ b/packages/stores/types.ts @@ -646,6 +646,12 @@ export type TClientStore = { account_time_of_closure?: number; is_account_to_be_closed_by_residence: boolean; statement: Statement; + setClientKYCStatus: (status: { poa_status: string; poi_status: string; valid_tin: 0 | 1 }) => void; + client_kyc_status: { + poa_status: string; + poi_status: string; + valid_tin: 0 | 1; + }; }; type TCommonStoreError = { From b52104fab14813385b96adbf67951a40ea50a064 Mon Sep 17 00:00:00 2001 From: likhith Date: Mon, 21 Oct 2024 21:27:21 +0400 Subject: [PATCH 3/4] fix: failing testcase --- .../src/Configs/__test__/get-status-badge-config.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account/src/Configs/__test__/get-status-badge-config.spec.tsx b/packages/account/src/Configs/__test__/get-status-badge-config.spec.tsx index a474bb660098..64c6e7f6b770 100644 --- a/packages/account/src/Configs/__test__/get-status-badge-config.spec.tsx +++ b/packages/account/src/Configs/__test__/get-status-badge-config.spec.tsx @@ -10,7 +10,7 @@ describe('getStatusBadgeConfig', () => { let account_status: TMT5AccountStatus; const openFailedVerificationModal = jest.fn(); const setIsVerificationModalVisible = jest.fn(); - const selected_account_type = 'test type'; + const selected_account_type = {}; const renderCheck = ( account_status: Parameters[0], From 8f7ee75ec7f64eac5fe3e6894585515eeb7179be Mon Sep 17 00:00:00 2001 From: likhith Date: Wed, 23 Oct 2024 07:45:44 +0400 Subject: [PATCH 4/4] fix: types in MT5 --- packages/account/src/Configs/get-status-badge-config.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account/src/Configs/get-status-badge-config.tsx b/packages/account/src/Configs/get-status-badge-config.tsx index 26795c8a239a..2f31d48d6269 100644 --- a/packages/account/src/Configs/get-status-badge-config.tsx +++ b/packages/account/src/Configs/get-status-badge-config.tsx @@ -7,8 +7,8 @@ import { Link } from 'react-router-dom'; const getStatusBadgeConfig = ( mt5_account_status: TMT5AccountStatus, - openFailedVerificationModal?: (selected_account_type: any) => void, - selected_account_type?: any, + openFailedVerificationModal?: (selected_account_type: Record) => void, + selected_account_type?: Record, setIsVerificationModalVisible?: (value: boolean) => void, user_account_status?: { poi_status: TAuthStatusCodes; poa_status: TAuthStatusCodes } ) => {