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

[COJ]/likhith/coj-1413/display-correct-jurisdiction-status #17270

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
13 changes: 10 additions & 3 deletions packages/account/src/Configs/get-status-badge-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
likhith-deriv marked this conversation as resolved.
Show resolved Hide resolved
likhith-deriv marked this conversation as resolved.
Show resolved Hide resolved
setIsVerificationModalVisible?: (value: boolean) => void,
user_account_status?: { poi_status: TAuthStatusCodes; poa_status: TAuthStatusCodes }
) => {
Expand Down Expand Up @@ -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 ?? '');
}
}}
/>,
]}
Expand Down
1 change: 1 addition & 0 deletions packages/appstore/src/components/cfds-listing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ const CFDsListing = observer(() => {

return (
<TradingAppCard
client_kyc_status={existing_account?.client_kyc_status}
action_type={existing_account.action_type}
availability={selected_region}
clickable_icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import OpenPositionsSVGModal from '../modals/open-positions-svg-modal';
import './trading-app-card.scss';

const TradingAppCard = ({
client_kyc_status,
availability,
name,
icon,
Expand Down Expand Up @@ -94,7 +95,10 @@ const TradingAppCard = ({
openFailedVerificationModal,
selected_mt5_jurisdiction,
setIsVerificationModalVisible,
{ poi_status: authentication?.identity?.status, poa_status: authentication?.document?.status }
{
poi_status: client_kyc_status?.poi_status ?? authentication?.identity?.status,
poa_status: client_kyc_status?.poa_status ?? authentication?.document?.status,
}
);

const handleStatusBadgeClick = (mt5_acc_auth_status: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,15 @@ 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';
const has_mf_mt5_account = Object.keys(current_list)
.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 = () => {
Expand Down Expand Up @@ -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 (
Expand Down
5 changes: 5 additions & 0 deletions packages/appstore/src/types/common.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ export type TDetailsOfEachMT5Loginid = DetailsOfEachMT5Loginid & {
product?: 'swap_free' | 'zero_spread' | 'derivx' | 'ctrader';
openFailedVerificationModal?: (from_account: string) => void;
market_type: NonNullable<TTradingPlatformAvailableAccount['market_type']> | TMarketType;
client_kyc_status?: {
poa_status: string;
poi_status: string;
valid_tin: 0 | 1;
};
};

export type TTradingPlatformAvailableAccount = {
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export default class ClientStore extends BaseStore {

subscriptions = {};
exchange_rates = {};
client_kyc_status = {};

constructor(root_store) {
const local_storage_properties = ['device_data'];
Expand Down Expand Up @@ -434,6 +435,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(
Expand Down Expand Up @@ -2936,4 +2939,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;
}
}
15 changes: 11 additions & 4 deletions packages/core/src/Stores/notification-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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')
) {
likhith-deriv marked this conversation as resolved.
Show resolved Hide resolved
this.addNotificationMessage(this.client_notifications.poa_failed);
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/Stores/traders-hub-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
6 changes: 6 additions & 0 deletions packages/stores/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading