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

[WALL] george / WALL-5105 / Remove the jurisdiction information on compare account table for wallets #17441

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 @@ -13,7 +13,8 @@

@include mobile-or-tablet-screen {
width: 18rem;
height: 66.6rem;
height: 47rem;

&--eu {
height: fit-content;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
.wallets-compare-accounts-text-container {
height: 24.5rem;
height: 8.5rem;

@include mobile-or-tablet-screen {
height: 3rem;
}

&--eu {
height: fit-content;
}

@include mobile-or-tablet-screen {
height: 21rem;
&--eu {
height: fit-content;
&--demo {
height: 11.5rem;

@include mobile-or-tablet-screen {
height: 8rem;
}
}

&--demo {
height: 13.5rem;
}
&__separator {
margin: 0.9rem;
}
Expand Down
heorhi-deriv marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -73,39 +73,6 @@ const CompareAccountsDescription = ({
</Text>
</div>
)}
{!isDemo && !isEuRegion && (
nijil-deriv marked this conversation as resolved.
Show resolved Hide resolved
<React.Fragment>
<div className='wallets-compare-accounts-text-container__separator'>
<Text align='center' as='h1' size={isTablet ? 'md' : 'sm'} weight='bold'>
{jurisdictionData.counterparty_company}
</Text>
<Text align='center' as='p' size='2xs'>
{jurisdictionData.counterparty_company_description}
</Text>
</div>
<div className='wallets-compare-accounts-text-container__separator'>
<Text align='center' as='h1' size={isTablet ? 'xs' : 'sm'} weight='bold'>
{jurisdictionData.jurisdiction}
</Text>
<Text align='center' as='p' size='2xs'>
{jurisdictionData.jurisdiction_description}
</Text>
</div>
<div className='wallets-compare-accounts-text-container__separator'>
<Text align='center' as='h1' size={isTablet ? 'xs' : 'sm'} weight='bold'>
{jurisdictionData.regulator}
</Text>
{jurisdictionData.regulator_license && (
<Text align='center' as='p' size='2xs'>
{jurisdictionData.regulator_license}
</Text>
)}
<Text align='center' as='p' size='2xs'>
{jurisdictionData.regulator_description}
</Text>
</div>
</React.Fragment>
)}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('CompareAccountsCard', () => {
expect(screen.getByText('Maximum leverage')).toBeInTheDocument();
expect(screen.getByText('0.5 pips')).toBeInTheDocument();
expect(screen.getByText('Spreads from')).toBeInTheDocument();
expect(screen.getByText('Deriv (SVG) LLC')).toBeInTheDocument();
});

it('renders the new banner for Zero Spread platform', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@ jest.mock('../compareAccountsConfig', () => ({

describe('CompareAccountsDescription', () => {
const mockJurisdictionData = {
counterparty_company: 'Deriv (SVG) LLC',
counterparty_company_description: 'Counterparty company description',
jurisdiction: 'St. Vincent & Grenadines',
jurisdiction_description: 'Jurisdiction description',
leverage: 'Up to 1:1000',
leverage_description: 'Leverage description',
regulator: 'Financial Commission',
regulator_description: 'Regulator description',
regulator_license: 'License number',
spread: '0.6 pips',
spread_description: 'Spread description',
};
Expand All @@ -42,10 +35,6 @@ describe('CompareAccountsDescription', () => {
expect(screen.getByText('Leverage description')).toBeInTheDocument();
expect(screen.getByText('0.6 pips')).toBeInTheDocument();
expect(screen.getByText('Spread description')).toBeInTheDocument();
expect(screen.getByText('Deriv (SVG) LLC')).toBeInTheDocument();
expect(screen.getByText('St. Vincent & Grenadines')).toBeInTheDocument();
expect(screen.getByText('Financial Commission')).toBeInTheDocument();
expect(screen.getByText('License number')).toBeInTheDocument();
});

it('renders correct compare accounts descriptions for demo accounts', () => {
Expand All @@ -54,8 +43,6 @@ describe('CompareAccountsDescription', () => {
expect(screen.getByText('Up to 1:1000')).toBeInTheDocument();
expect(screen.getByText('Leverage description')).toBeInTheDocument();
expect(screen.getByText('0.6 pips')).toBeInTheDocument();
expect(screen.queryByText('Deriv (SVG) LLC')).not.toBeInTheDocument();
expect(screen.queryByText('St. Vincent & Grenadines')).not.toBeInTheDocument();
});

it('renders correct compare accounts descriptions for EU region accounts', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import { localize } from '@deriv-com/translations';
import { CFD_PLATFORMS, MARKET_TYPE } from '../../../constants';
import {
getAccountVerificationStatus,
getHighlightedIconLabel,
getJurisdictionDescription,
getPlatformType,
isCTraderAccountAdded,
isDxtradeAccountAdded,
isMt5AccountAdded,
shouldRestrictBviAccountCreation,
shouldRestrictVanuatuAccountCreation,
} from '../compareAccountsConfig';
import { JURISDICTION, MARKET_TYPE_SHORTCODE } from '../constants';
import { getHighlightedIconLabel, getPlatformType } from '../compareAccountsConfig';
import { JURISDICTION } from '../constants';

describe('compareAccountsConfig', () => {
describe('getHighlightedIconLabel', () => {
Expand Down Expand Up @@ -73,234 +63,4 @@ describe('compareAccountsConfig', () => {
expect(getPlatformType('unknown')).toBe('OtherCFDs');
});
});

describe('getJurisdictionDescription', () => {
it('returns correct description for synthetic BVI', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.SYNTHETIC_BVI);
expect(result.jurisdiction).toBe('British Virgin Islands');
});

it('returns correct description for financial BVI', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.FINANCIAL_BVI);
expect(result.jurisdiction).toBe('British Virgin Islands');
});

it('returns correct description for synthetic Vanuatu', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.SYNTHETIC_VANUATU);
expect(result.jurisdiction).toBe('Vanuatu');
});

it('returns correct description for financial Vanuatu', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.FINANCIAL_VANUATU);
expect(result.jurisdiction).toBe('Vanuatu');
});

it('returns correct description for financial Labuan', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.FINANCIAL_LABUAN);
expect(result.jurisdiction).toBe('Labuan');
});

it('returns correct description for financial Maltainvest', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.FINANCIAL_MALTAINVEST);
expect(result.jurisdiction).toBe('Malta');
});

it('returns default description for DerivX', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.ALL_DXTRADE);
expect(result).toEqual(
expect.objectContaining({
jurisdiction: 'St. Vincent & Grenadines',
})
);
});

it('returns default description for all SVG', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.ALL_SVG);
expect(result).toEqual(
expect.objectContaining({
jurisdiction: 'St. Vincent & Grenadines',
})
);
});

it('returns default description for synthetic SVG', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.SYNTHETIC_SVG);
expect(result).toEqual(
expect.objectContaining({
jurisdiction: 'St. Vincent & Grenadines',
})
);
});

it('returns default description for financial SVG', () => {
const result = getJurisdictionDescription(localize, MARKET_TYPE_SHORTCODE.FINANCIAL_SVG);
expect(result).toEqual(
expect.objectContaining({
jurisdiction: 'St. Vincent & Grenadines',
})
);
});

it('returns default description for unknown shortcode', () => {
const result = getJurisdictionDescription(localize, 'unknown');
expect(result).toEqual(
expect.objectContaining({
jurisdiction: 'St. Vincent & Grenadines',
})
);
});
});

describe('getAccountVerificationStatus', () => {
it('returns correct status for SVG jurisdiction', () => {
expect(getAccountVerificationStatus(JURISDICTION.SVG, false, false, true)).toBe(true);
});

it('returns correct status for BVI jurisdiction', () => {
const authInfo = {
has_poa_been_attempted: true,
has_poi_been_attempted: true,
identity: { services: { manual: { status: 'verified' } } },
poa_status: 'verified',
risk_classification: 'low',
};
// @ts-expect-error - since this is a mock, we only need partial properties of authInfo
expect(getAccountVerificationStatus(JURISDICTION.BVI, false, false, true, authInfo)).toBe(true);
});

it('returns correct status for high risk classification', () => {
const authInfo = {
has_poa_been_attempted: true,
has_poi_been_attempted: true,
identity: { services: { manual: { status: 'verified' } } },
poa_status: 'verified',
risk_classification: 'high',
};
// @ts-expect-error - since this is a mock, we only need partial properties of authInfo
expect(getAccountVerificationStatus(JURISDICTION.BVI, false, false, true, authInfo)).toBe(false);
});

it('returns correct status for Vanuatu jurisdiction', () => {
const authInfo = {
has_poa_been_attempted: true,
has_poi_been_attempted: true,
identity: { services: { manual: { status: 'verified' } } },
poa_status: 'verified',
risk_classification: 'low',
};
// @ts-expect-error - since this is a mock, we only need partial properties of authInfo
expect(getAccountVerificationStatus(JURISDICTION.VANUATU, false, false, true, authInfo)).toBe(true);
});

it('returns correct status for Labuan jurisdiction', () => {
const authInfo = {
has_poa_been_attempted: true,
has_poi_been_attempted: true,
identity: { services: { manual: { status: 'verified' } } },
poa_status: 'verified',
risk_classification: 'low',
};
// @ts-expect-error - since this is a mock, we only need partial properties of authInfo
expect(getAccountVerificationStatus(JURISDICTION.LABUAN, false, false, true, authInfo)).toBe(true);
});

it('returns correct status for Maltainvest jurisdiction', () => {
const authInfo = {
has_poa_been_attempted: true,
has_poi_been_attempted: true,
identity: { services: { manual: { status: 'verified' } } },
poa_status: 'verified',
};
// @ts-expect-error - since this is a mock, we only need partial properties of authInfo
expect(getAccountVerificationStatus(JURISDICTION.MALTAINVEST, false, false, true, authInfo)).toBe(true);
// @ts-expect-error - since this is a mock, we only need partial properties of authInfo
expect(getAccountVerificationStatus(JURISDICTION.MALTAINVEST, false, false, true, authInfo, true)).toBe(
true
);
});
});

describe('isMt5AccountAdded', () => {
it('returns true if account is added', () => {
const list = [
{
account_type: 'real',
landing_company_short: 'svg',
market_type: MARKET_TYPE.FINANCIAL,
platform: CFD_PLATFORMS.MT5,
},
];
// @ts-expect-error - since this is a mock, we only need partial properties of the list
expect(isMt5AccountAdded(list, MARKET_TYPE.FINANCIAL, 'svg')).toBe(true);
});

it('returns false if account is not added', () => {
const list = [
{
account_type: 'real',
landing_company_short: 'svg',
market_type: MARKET_TYPE.FINANCIAL,
platform: CFD_PLATFORMS.MT5,
},
];
// @ts-expect-error - since this is a mock, we only need partial properties of the list
expect(isMt5AccountAdded(list, MARKET_TYPE.FINANCIAL, 'svg', true)).toBe(false);
});
});

describe('isDxtradeAccountAdded', () => {
it('returns true if account is added', () => {
const list = [{ account_type: 'real', platform: CFD_PLATFORMS.DXTRADE }];
// @ts-expect-error - since this is a mock, we only need partial properties of the list
expect(isDxtradeAccountAdded(list)).toBe(true);
});

it('returns false if account is not added', () => {
const list = [{ account_type: 'real', platform: CFD_PLATFORMS.DXTRADE }];
// @ts-expect-error - since this is a mock, we only need partial properties of the list
expect(isDxtradeAccountAdded(list, true)).toBe(false);
});
});

describe('isCTraderAccountAdded', () => {
it('returns true if account is added', () => {
const list = [{ account_type: 'real', platform: CFD_PLATFORMS.CTRADER }];
// @ts-expect-error - since this is a mock, we only need partial properties of the list
expect(isCTraderAccountAdded(list)).toBe(true);
});

it('returns false if account is not added', () => {
const list = [{ account_type: 'real', platform: CFD_PLATFORMS.CTRADER }];
// @ts-expect-error - since this is a mock, we only need partial properties of the list
expect(isCTraderAccountAdded(list, true)).toBe(false);
});
});

describe('shouldRestrictBviAccountCreation', () => {
it('returns true if BVI account creation should be restricted', () => {
const accounts = [{ landing_company_short: 'bvi', status: 'poa_failed' }];
// @ts-expect-error - since this is a mock, we only need partial properties of the accounts
expect(shouldRestrictBviAccountCreation(accounts)).toBe(true);
});

it('returns false if BVI account creation should not be restricted', () => {
const accounts = [{ landing_company_short: 'bvi', status: 'active' }];
// @ts-expect-error - since this is a mock, we only need partial properties of the accounts
expect(shouldRestrictBviAccountCreation(accounts)).toBe(false);
});
});

describe('shouldRestrictVanuatuAccountCreation', () => {
it('returns true if Vanuatu account creation should be restricted', () => {
const accounts = [{ landing_company_short: 'vanuatu', status: 'poa_failed' }];
// @ts-expect-error - since this is a mock, we only need partial properties of the accounts
expect(shouldRestrictVanuatuAccountCreation(accounts)).toBe(true);
});

it('returns false if Vanuatu account creation should not be restricted', () => {
const accounts = [{ landing_company_short: 'vanuatu', status: 'active' }];
// @ts-expect-error - since this is a mock, we only need partial properties of the accounts
expect(shouldRestrictVanuatuAccountCreation(accounts)).toBe(false);
});
});
});
Loading
Loading