Skip to content

Commit

Permalink
Hirad/UPM-1681/Account closure and transfer modal issue (deriv-com#17207
Browse files Browse the repository at this point in the history
)

* chore: fixed the transfer and account closure pop up issues

* chore: updated the types
  • Loading branch information
hirad-deriv authored Nov 6, 2024
1 parent ebd3000 commit ac5323a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const ClosingAccountPendingBalance = observer(({ platform, account_balance }: TC
platform,
shortcode: is_mt5_platform ? (account.landing_company_short as TShortcode) : undefined,
is_eu: is_eu_user,
product: account.product,
}) ?? ''
}
value={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const ClosingAccountPendingPositions = observer(
? (account.landing_company_short as TShortcode)
: undefined,
is_eu: is_eu_user,
product: account.product,
}) ?? ''
}
value={
Expand Down
5 changes: 4 additions & 1 deletion packages/account/src/Types/common.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,20 @@ export type TAccounts = {
title?: string;
};

type TProduct = 'financial' | 'synthetic' | 'swap_free' | 'zero_spread' | 'cTrader' | 'derivx';

type TPendingAccountDetails = {
balance?: number;
currency?: string;
display_login?: string;
positions?: number;
withdrawals?: number;
product?: TProduct;
};

export type TDetailsOfDerivAccount = TAccounts & TPendingAccountDetails;
export type TDetailsOfMT5Account = DetailsOfEachMT5Loginid & TPendingAccountDetails;
export type TDetailsOfDerivXAccount = TDetailsOfMT5Account & { account_id?: string };
export type TDetailsOfDerivXAccount = TDetailsOfMT5Account & { account_id?: string; product?: TProduct };
export type TDetailsOfCtraderAccount = DetailsOfEachMT5Loginid & {
display_balance?: string;
platform?: string;
Expand Down
1 change: 1 addition & 0 deletions packages/cashier/src/stores/account-transfer-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ export default class AccountTransferStore {
platform: account.account_type,
is_eu: this.root_store.client.is_eu,
is_transfer_form: true,
product: account.product,
}) || ''
}`;
const account_text_display = is_cfd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const AccountList = ({
is_disabled,
is_virtual,
is_eu,
product,
loginid,
market_type,
redirectAccount,
Expand Down Expand Up @@ -57,6 +58,7 @@ const AccountList = ({
sub_account_type={sub_account_type}
has_error={has_error}
platform={platform}
product={product}
is_dark_mode_on={is_dark_mode_on}
shortcode={shortcode}
should_show_server_name={should_show_server_name}
Expand Down Expand Up @@ -132,12 +134,13 @@ const AccountDisplay = ({
sub_account_type,
platform,
server,
product,
is_dark_mode_on,
is_eu,
shortcode,
should_show_server_name,
}) => {
const account_title = getCFDAccountDisplay({ market_type, sub_account_type, platform, is_eu, shortcode });
const account_title = getCFDAccountDisplay({ market_type, sub_account_type, platform, is_eu, shortcode, product });
// TODO: Remove once account with error has market_type and sub_account_type in details response
const getServerName = React.useCallback(account => {
if (account) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ const AccountSwitcher = observer(({ history, is_mobile, is_visible }) => {
is_disabled={account.is_disabled}
is_virtual={account.is_virtual}
loginid={account.loginid}
product={account.product}
redirectAccount={account.is_disabled ? undefined : () => doSwitch(account.loginid)}
onClickResetVirtualBalance={resetBalance}
selected_loginid={account_loginid}
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/utils/cfd/cfd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const getCFDAccountKey = ({
return 'all_demo';
}
}
if (market_type === 'all') {
if (market_type === 'all' && platform !== CFD_PLATFORMS.MT5) {
switch (platform) {
case CFD_PLATFORMS.CTRADER:
return 'ctrader';
Expand Down

0 comments on commit ac5323a

Please sign in to comment.