Skip to content

Commit

Permalink
chore: update all files change string to use same Jurisdiction in con…
Browse files Browse the repository at this point in the history
…stant file
  • Loading branch information
suisin-deriv committed Mar 22, 2023
1 parent 651a1df commit 92c2f78
Show file tree
Hide file tree
Showing 68 changed files with 368 additions and 269 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { fireEvent, screen, render, waitFor } from '@testing-library/react';
import { isDesktop, isMobile, PlatformContext } from '@deriv/shared';
import { isDesktop, isMobile, PlatformContext, Jurisdiction } from '@deriv/shared';
import CurrencySelector, { TCurrencySelector } from '../currency-selector';

jest.mock('@deriv/shared', () => ({
Expand Down Expand Up @@ -269,20 +269,20 @@ describe('<CurrencySelector/>', () => {
currency: 'USD',
is_disabled: 0,
is_virtual: 1,
landing_company_shortcode: 'svg',
landing_company_shortcode: Jurisdiction.SVG,
trading: {},
token: 'a1-sLGGrhfYPkeEprxEop2T591cLKbuN',
email: 'test+qw@deriv.com',
session_start: 1651059038,
excluded_until: '',
landing_company_name: 'svg',
landing_company_name: Jurisdiction.SVG,
residence: 'es',
balance: 10000,
accepted_bch: 0,
},
},
has_real_account: true,
real_account_signup_target: 'svg',
real_account_signup_target: Jurisdiction.SVG,
};

render(<CurrencySelector {...new_props} />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ import {
} from '@deriv/components';
import { Link } from 'react-router-dom';
import { localize, Localize } from '@deriv/translations';
import { getLegalEntityName, isDesktop, isMobile, routes, toMoment, PlatformContext, validPhone } from '@deriv/shared';
import {
getLegalEntityName,
isDesktop,
isMobile,
routes,
toMoment,
PlatformContext,
validPhone,
Jurisdiction,
} from '@deriv/shared';
import { getEmploymentStatusList } from 'Sections/Assessment/FinancialAssessment/financial-information-list';
import { splitValidationResultTypes } from '../real-account-signup/helpers/utils';
import FormSubHeader from '../form-sub-header';
Expand Down Expand Up @@ -671,7 +680,9 @@ const PersonalDetails = ({
label={localize(
'I hereby confirm that the tax information I provided is true and complete. I will also inform {{legal_entity_name}} about any changes to this information.',
{
legal_entity_name: getLegalEntityName('maltainvest'),
legal_entity_name: getLegalEntityName(
Jurisdiction.MALTA_INVEST
),
}
)}
renderlabel={title => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { isDesktop, isMobile, PlatformContext } from '@deriv/shared';
import { isDesktop, isMobile, PlatformContext, Jurisdiction } from '@deriv/shared';
import TermsOfUse from '../terms-of-use';

jest.mock('@deriv/shared', () => ({
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('<TermsOfUse/>', () => {
};

it('should render TermsOfUse component for svg accounts', () => {
mock_props.real_account_signup_target = 'svg';
mock_props.real_account_signup_target = Jurisdiction.SVG;

render(<TermsOfUse {...mock_props} />);

Expand Down Expand Up @@ -99,7 +99,7 @@ describe('<TermsOfUse/>', () => {
});

it('should render TermsOfUse component for maltainvest accounts and show "Add account" button', () => {
mock_props.real_account_signup_target = 'maltainvest';
mock_props.real_account_signup_target = Jurisdiction.MALTA_INVEST;

render(<TermsOfUse {...mock_props} />);

Expand All @@ -122,7 +122,7 @@ describe('<TermsOfUse/>', () => {
isMobile.mockReturnValue(true);
isDesktop.mockReturnValue(false);

mock_props.real_account_signup_target = 'maltainvest';
mock_props.real_account_signup_target = Jurisdiction.MALTA_INVEST;

render(<TermsOfUse {...mock_props} />);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import { Localize } from '@deriv/translations';
import { getLegalEntityName } from '@deriv/shared';
import { getLegalEntityName, Jurisdiction } from '@deriv/shared';
import { Text } from '@deriv/components';

export const Hr = () => <div className='terms-of-use__hr' />;

export const BrokerSpecificMessage = ({ target }) => (
<React.Fragment>
{target === 'svg' && <SVGDescription />}
{target === Jurisdiction.SVG && <SVGDescription />}
{target === 'iom' && <IOMDescription />}
{target === 'malta' && <MaltaDescription />}
{target === 'maltainvest' && <MaltaInvestDescription />}
{target === Jurisdiction.MALTA_INVEST && <MaltaInvestDescription />}
{target === 'samoa' && <SamoaDescription />}
</React.Fragment>
);
Expand All @@ -26,7 +26,7 @@ export const SVGDescription = () => (
'Your account will be opened with {{legal_entity_name}}, and will be subject to the laws of Saint Vincent and the Grenadines.'
}
values={{
legal_entity_name: getLegalEntityName('svg'),
legal_entity_name: getLegalEntityName(Jurisdiction.SVG),
}}
/>
</p>
Expand Down Expand Up @@ -91,7 +91,7 @@ export const MaltaInvestDescription = () => (
'Your account will be opened with {{legal_entity_name}}, regulated by the Malta Financial Services Authority (MFSA), and will be subject to the laws of Malta.'
}
values={{
legal_entity_name: getLegalEntityName('maltainvest'),
legal_entity_name: getLegalEntityName(Jurisdiction.MALTA_INVEST),
}}
/>
</p>
Expand Down
4 changes: 2 additions & 2 deletions packages/account/src/Configs/accept-risk-config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getDefaultFields } from '@deriv/shared';
import { getDefaultFields, Jurisdiction } from '@deriv/shared';

const accept_risk_config = {
accept_risk: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: 1,
},
};
Expand Down
26 changes: 16 additions & 10 deletions packages/account/src/Configs/address-details-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { localize } from '@deriv/translations';
import { generateValidationFunction, getDefaultFields, getErrorMessages, regex_checks } from '@deriv/shared';
import {
generateValidationFunction,
getDefaultFields,
getErrorMessages,
regex_checks,
Jurisdiction,
} from '@deriv/shared';

const address_details_config = ({ account_settings, is_svg }) => {
const is_gb = account_settings.country_code === 'gb';
Expand All @@ -9,7 +15,7 @@ const address_details_config = ({ account_settings, is_svg }) => {

const base_case = {
address_line_1: {
supported_in: ['svg', 'iom', 'malta', 'maltainvest'],
supported_in: [Jurisdiction.SVG, 'iom', 'malta', Jurisdiction.MALTA_INVEST],
default_value: account_settings.address_line_1 ?? '',
rules: [
['req', localize('First line of address is required')],
Expand All @@ -25,7 +31,7 @@ const address_details_config = ({ account_settings, is_svg }) => {
].filter(x => (is_svg ? x.indexOf('po_box') !== 0 : x)),
},
address_line_2: {
supported_in: ['svg', 'iom', 'malta', 'maltainvest'],
supported_in: [Jurisdiction.SVG, 'iom', 'malta', Jurisdiction.MALTA_INVEST],
default_value: account_settings.address_line_2 ?? '',
rules: [
['length', localize('Only {{max}} characters, please.', { max: 70 }), { max: 70 }],
Expand All @@ -40,7 +46,7 @@ const address_details_config = ({ account_settings, is_svg }) => {
].filter(x => (is_svg ? x.indexOf('po_box') !== 0 : x)),
},
address_city: {
supported_in: ['svg', 'iom', 'malta', 'maltainvest'],
supported_in: [Jurisdiction.SVG, 'iom', 'malta', Jurisdiction.MALTA_INVEST],
default_value: account_settings.address_city ?? '',
rules: [
['req', localize('City is required')],
Expand All @@ -55,7 +61,7 @@ const address_details_config = ({ account_settings, is_svg }) => {
],
},
address_state: {
supported_in: ['svg', 'iom', 'malta', 'maltainvest'],
supported_in: [Jurisdiction.SVG, 'iom', 'malta', Jurisdiction.MALTA_INVEST],
default_value: account_settings.address_state ?? '',
rules: [
['req', localize('State is required')],
Expand All @@ -69,7 +75,7 @@ const address_details_config = ({ account_settings, is_svg }) => {
],
},
address_postcode: {
supported_in: ['svg', 'iom', 'malta', 'maltainvest'],
supported_in: [Jurisdiction.SVG, 'iom', 'malta', Jurisdiction.MALTA_INVEST],
default_value: account_settings.address_postcode ?? '',
rules: [
[
Expand All @@ -96,7 +102,7 @@ const address_details_config = ({ account_settings, is_svg }) => {
const gb_case = {
...base_case,
address_postcode: {
supported_in: ['svg', 'iom', 'malta', 'maltainvest'],
supported_in: [Jurisdiction.SVG, 'iom', 'malta', Jurisdiction.MALTA_INVEST],
default_value: account_settings.address_postcode ?? '',
rules: [
[
Expand Down Expand Up @@ -135,9 +141,9 @@ const addressDetailsConfig = (
AddressDetails,
is_appstore = false
) => {
const is_svg = upgrade_info?.can_upgrade_to === 'svg';
const is_svg = upgrade_info?.can_upgrade_to === Jurisdiction.SVG;
const config = address_details_config({ account_settings, is_svg });
const is_mf = real_account_signup_target === 'maltainvest';
const is_mf = real_account_signup_target === Jurisdiction.MALTA_INVEST;

return {
header: {
Expand Down Expand Up @@ -180,7 +186,7 @@ const transformForResidence = (rules, residence) => {

const transformConfig = (config, { real_account_signup_target }) => {
// Remove required rule for svg clients
if (!real_account_signup_target || real_account_signup_target === 'svg') {
if (!real_account_signup_target || real_account_signup_target === Jurisdiction.SVG) {
config.address_state.rules.shift();
}

Expand Down
3 changes: 2 additions & 1 deletion packages/account/src/Configs/currency-selector-schema.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { localize } from '@deriv/translations';
import { Jurisdiction } from '@deriv/shared';

export default {
currency: {
supported_in: ['maltainvest', 'malta', 'svg', 'iom'],
supported_in: [Jurisdiction.MALTA_INVEST, 'malta', Jurisdiction.SVG, 'iom'],
default_value: '',
rules: [['req', localize('Select an item')]],
},
Expand Down
36 changes: 18 additions & 18 deletions packages/account/src/Configs/financial-details-config.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
import { localize } from '@deriv/translations';
import { generateValidationFunction, getDefaultFields } from '@deriv/shared';
import { generateValidationFunction, getDefaultFields, Jurisdiction } from '@deriv/shared';

const financial_details_config = ({ financial_assessment }) => {
return {
account_turnover: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.account_turnover ?? '',
rules: [['req', localize('Please select an option')]],
},
binary_options_trading_experience: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.binary_options_trading_experience ?? '',
rules: [['req', localize('Please select an option')]],
},
binary_options_trading_frequency: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.binary_options_trading_frequency ?? '',
rules: [['req', localize('Please select an option')]],
},
cfd_trading_experience: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.cfd_trading_experience ?? '',
rules: [['req', localize('Please select an option')]],
},
cfd_trading_frequency: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.cfd_trading_frequency ?? '',
rules: [['req', localize('Please select an option')]],
},
education_level: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.education_level ?? '',
rules: [['req', localize('Please select an option')]],
},
forex_trading_experience: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.forex_trading_experience ?? '',
rules: [['req', localize('Please select an option')]],
},
forex_trading_frequency: {
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
default_value: financial_assessment?.forex_trading_frequency ?? '',
rules: [['req', localize('Please select an option')]],
},
employment_industry: {
default_value: financial_assessment?.employment_industry ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
employment_status: {
default_value: financial_assessment?.employment_status ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
estimated_worth: {
default_value: financial_assessment?.estimated_worth ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
income_source: {
default_value: financial_assessment?.income_source ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
net_income: {
default_value: financial_assessment?.net_income ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
occupation: {
default_value: financial_assessment?.occupation ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
other_instruments_trading_experience: {
default_value: financial_assessment?.other_instruments_trading_experience ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
other_instruments_trading_frequency: {
default_value: financial_assessment?.other_instruments_trading_frequency ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
source_of_wealth: {
default_value: financial_assessment?.source_of_wealth ?? '',
supported_in: ['maltainvest'],
supported_in: [Jurisdiction.MALTA_INVEST],
rules: [['req', localize('Please select an option')]],
},
};
Expand Down
Loading

0 comments on commit 92c2f78

Please sign in to comment.