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

[TRAH] shontzu/TRAH-5356/fe-implementation-api-group-cleanup #17999

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ describe('<CFDCompareAccountsTitleIcon />', () => {
test('should render correct title for EU Clients', () => {
mocked_props.trading_platforms = {
platform: 'mt5',
market_type: 'financial',
market_type: 'gaming',
shortcode: 'maltainvest',
product: 'financial',
};
mocked_props.is_eu_user = true;
render(<CFDCompareAccountsTitleIcon {...mocked_props} />);
expect(screen.getByText('CFDs')).toBeInTheDocument();
expect(screen.getByText('Standard')).toBeInTheDocument();
});

test('should render correct title for standard product type in demo account', () => {
Expand Down Expand Up @@ -159,11 +159,11 @@ describe('<CFDCompareAccountsTitleIcon />', () => {

test('should render correct title for EU clients demo accounts', () => {
mocked_props.trading_platforms.platform = 'mt5';
mocked_props.trading_platforms.market_type = 'financial';
mocked_props.trading_platforms.market_type = 'gaming';
mocked_props.trading_platforms.shortcode = 'svg';
mocked_props.is_demo = true;
mocked_props.is_eu_user = true;
render(<CFDCompareAccountsTitleIcon {...mocked_props} />);
expect(screen.getByText('CFDs demo')).toBeInTheDocument();
expect(screen.getByText('Standard demo')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {

const CFDCompareAccountsTitleIcon = ({ trading_platforms, is_eu_user, is_demo }: TCompareAccountsCard) => {
shontzu-deriv marked this conversation as resolved.
Show resolved Hide resolved
const { isDesktop } = useDevice();
const market_type = !is_eu_user ? getMarketType(trading_platforms) : 'CFDs';
const market_type =
is_eu_user && trading_platforms.market_type === 'financial'
? 'CFDs' // this is for backwards compatibility with BE
: getMarketType(trading_platforms);

const market_type_shortcode = generateMarketTypeShortcode(trading_platforms, market_type);

Expand Down
7 changes: 3 additions & 4 deletions packages/cfd/src/Helpers/compare-accounts-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const getHighlightedIconLabel = (
selected_region?: string
): TInstrumentsIcon[] => {
const market_type = getMarketType(trading_platforms);

const market_type_shortcode =
trading_platforms.product === PRODUCT.GOLD
? market_type.concat('_', trading_platforms.product)
Expand Down Expand Up @@ -129,6 +130,7 @@ const platformsHeaderLabel = {
const getAccountIcon = (shortcode: string, product?: TProducts) => {
switch (shortcode) {
case MARKET_TYPE.SYNTHETIC:
case MARKET_TYPE.GAMING:
return 'Standard';
case MARKET_TYPE.FINANCIAL:
switch (product) {
Expand Down Expand Up @@ -276,7 +278,6 @@ const getEUAvailableAccounts = (available_accounts: TModifiedTradingPlatformAvai
const financial_accounts = available_accounts
.filter(
item =>
item.market_type === MARKET_TYPE.FINANCIAL &&
item.shortcode === JURISDICTION.MALTA_INVEST &&
item.is_default_jurisdiction === 'true' &&
item.product !== PRODUCT.GOLD
Expand Down Expand Up @@ -355,9 +356,7 @@ const getMT5DemoData = (available_accounts: TModifiedTradingPlatformAvailableAcc
item =>
item.market_type === MARKET_TYPE.FINANCIAL && item.product !== PRODUCT.STP && item.product !== PRODUCT.GOLD
);
const gaming_demo_accounts = available_accounts.filter(
item => item.market_type === MARKET_TYPE.GAMING && item.shortcode === JURISDICTION.SVG
);
const gaming_demo_accounts = available_accounts.filter(item => item.market_type === MARKET_TYPE.GAMING);

const gold_demo_accounts = available_accounts.filter(
item => item.market_type === MARKET_TYPE.FINANCIAL && item.product === PRODUCT.GOLD
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/src/features/cfd/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const getMarketTypeDetails = (
title: getMarketTypeDetailsTitle(product, isEuRegion),
},
synthetic: {
availability: 'Non-EU',
availability: 'All',
shontzu-deriv marked this conversation as resolved.
Show resolved Hide resolved
description: localize('CFDs on derived and financial instruments'),
icon: <AccountsDmt5StandardIcon height={48} width={48} />,
title: 'Standard',
Expand Down
Loading