Skip to content

Commit 6fb892b

Browse files
Revert "[COJ][TRAH-3427]/Dhruv/amina mt5 defaulting jurisdiction (#16540)" (#17325)
This reverts commit b723364.
1 parent 614596d commit 6fb892b

File tree

162 files changed

+7527
-2835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+7527
-2835
lines changed

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/account/build/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = function (env) {
1616
'financial-details-config': 'Configs/financial-details-config',
1717
'get-status-badge-config': 'Configs/get-status-badge-config',
1818
'personal-details-config': 'Configs/personal-details-config',
19+
'poi-poa-docs-submitted': 'Components/poi-poa-docs-submitted/poi-poa-docs-submitted',
1920
'risk-tolerance-warning-modal': 'Components/trading-assessment/risk-tolerance-warning-modal',
2021
'sent-email-modal': 'Components/sent-email-modal',
2122
'terms-of-use-config': 'Configs/terms-of-use-config',

packages/account/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@deriv-com/quill-ui": "1.18.0",
3939
"@deriv/components": "^1.0.0",
4040
"@deriv/hooks": "^1.0.0",
41-
"@deriv/quill-icons": "1.23.14",
41+
"@deriv/quill-icons": "1.23.3",
4242
"@deriv/shared": "^1.0.0",
4343
"@deriv/stores": "^1.0.0",
4444
"@deriv/translations": "^1.0.0",
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { render, screen } from '@testing-library/react';
2+
3+
import { BrowserRouter } from 'react-router-dom';
4+
import { Button } from '@deriv/components';
5+
import { NeedsReview } from '../needs-review';
6+
import React from 'react';
7+
8+
jest.mock('Components/poa/continue-trading-button/continue-trading-button', () => ({
9+
ContinueTradingButton: jest.fn(() => <div>ContinueTradingButton</div>),
10+
}));
11+
12+
const mock_redirection_btn = <Button>Redirection button</Button>;
13+
14+
describe('<NeedsReview/>', () => {
15+
it('should render NeedsReview component if it does not need poi', () => {
16+
render(
17+
<BrowserRouter>
18+
<NeedsReview needs_poi={false} redirect_button={false} />
19+
</BrowserRouter>
20+
);
21+
22+
expect(screen.getByText('Your proof of address was submitted successfully')).toBeInTheDocument();
23+
expect(screen.getByText('Your document is being reviewed, please check back in 1-3 days.')).toBeInTheDocument();
24+
expect(screen.getByText('ContinueTradingButton')).toBeInTheDocument();
25+
});
26+
27+
it('should render NeedsReview component if it does not need poi and is_description_enabled', () => {
28+
render(
29+
<BrowserRouter>
30+
<NeedsReview needs_poi={false} redirect_button={mock_redirection_btn} />
31+
</BrowserRouter>
32+
);
33+
34+
expect(screen.getByText('Your proof of address was submitted successfully')).toBeInTheDocument();
35+
expect(screen.getByText('Your document is being reviewed, please check back in 1-3 days.')).toBeInTheDocument();
36+
expect(screen.queryByText('ContinueTradingButton')).not.toBeInTheDocument();
37+
expect(screen.getByRole('button')).toBeInTheDocument();
38+
});
39+
40+
it('should render NeedsReview component if it needs poi', () => {
41+
render(
42+
<BrowserRouter>
43+
<NeedsReview needs_poi redirect_button={mock_redirection_btn} />
44+
</BrowserRouter>
45+
);
46+
47+
expect(screen.getByText('Your proof of address was submitted successfully')).toBeInTheDocument();
48+
expect(screen.getByText('Your document is being reviewed, please check back in 1-3 days.')).toBeInTheDocument();
49+
expect(screen.getByText('You must also submit a proof of identity.')).toBeInTheDocument();
50+
});
51+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { NeedsReview as PoaNeedsReview } from './needs-review';
2+
3+
export default PoaNeedsReview;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
import { Icon, Text } from '@deriv/components';
3+
import { isNavigationFromP2P, isNavigationFromDerivGO } from '@deriv/shared';
4+
import { localize } from '@deriv/translations';
5+
import ContinueTradingButton from '../../continue-trading-button';
6+
import IconMessageContent from '../../../icon-message-content';
7+
import PoiButton from '../../../poi/poi-button';
8+
import { TPoaStatusProps } from '../../../../Types';
9+
10+
export const NeedsReview = ({ needs_poi, redirect_button }: TPoaStatusProps) => {
11+
const message = localize('Your proof of address was submitted successfully');
12+
const is_redirected_from_platform = isNavigationFromP2P() || isNavigationFromDerivGO();
13+
if (!needs_poi) {
14+
return (
15+
<IconMessageContent
16+
message={message}
17+
text={localize('Your document is being reviewed, please check back in 1-3 days.')}
18+
icon={<Icon icon='IcPoaVerified' size={128} />}
19+
>
20+
{redirect_button || (!is_redirected_from_platform && <ContinueTradingButton />)}
21+
</IconMessageContent>
22+
);
23+
}
24+
return (
25+
<IconMessageContent message={message} icon={<Icon icon='IcPoaVerified' size={128} />}>
26+
<div className='account-management__text-container'>
27+
<Text align='center' size='xs' as='p'>
28+
{localize('Your document is being reviewed, please check back in 1-3 days.')}
29+
</Text>
30+
<Text align='center' size='xs' as='p'>
31+
{localize('You must also submit a proof of identity.')}
32+
</Text>
33+
</div>
34+
<PoiButton />
35+
</IconMessageContent>
36+
);
37+
};

packages/account/src/Components/poa/status/submitted/__tests__/submitted.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ describe('<Submitted />', () => {
1414

1515
it('should render the Submitted component', () => {
1616
renderWithRouter(<Submitted needs_poi />);
17-
expect(screen.getByText('Review in progress')).toBeInTheDocument();
17+
expect(screen.getByText('Your documents were submitted successfully')).toBeInTheDocument();
1818
});
1919

2020
it('should show submit_poi message if needs_poi is true', () => {
2121
renderWithRouter(<Submitted needs_poi />);
22-
expect(screen.getByText('To start trading, you also need to verify your identity.')).toBeInTheDocument();
22+
expect(screen.getByText('You must also submit a proof of identity.')).toBeInTheDocument();
2323
});
2424

2525
it('should show review message if needs_poi is true', () => {
2626
renderWithRouter(<Submitted needs_poi />);
2727
expect(
28-
screen.getByText('Your proof of address is under review. We’ll get back to you in 1–3 working days.')
28+
screen.getByText('We’ll review your documents and notify you of its status within 1 to 3 days.')
2929
).toBeInTheDocument();
3030
});
3131

3232
it('should show ContinueTradingButton if no props are passed', () => {
3333
renderWithRouter(<Submitted />);
34-
expect(screen.getByText("Return to Trader's Hub")).toBeInTheDocument();
34+
expect(screen.getByTestId('continue-trading-button')).toBeInTheDocument();
3535
});
3636
});

packages/account/src/Components/poa/status/submitted/submitted.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
import React from 'react';
22
import { Icon, Text } from '@deriv/components';
33
import { localize } from '@deriv/translations';
4-
import { isNavigationFromP2P, isNavigationFromDerivGO, routes } from '@deriv/shared';
4+
import { isNavigationFromP2P, isNavigationFromDerivGO } from '@deriv/shared';
5+
import ContinueTradingButton from '../../continue-trading-button';
56
import IconMessageContent from '../../../icon-message-content';
6-
import RouteButton from '../../../route-button';
7+
import PoiButton from '../../../poi/poi-button';
78
import { TPoaStatusProps } from '../../../../Types';
89

910
export const Submitted = ({ needs_poi, redirect_button }: TPoaStatusProps) => {
10-
const message = localize('Review in progress');
11+
const message = localize('Your documents were submitted successfully');
1112
const is_redirected_from_platform = isNavigationFromP2P() || isNavigationFromDerivGO();
1213
if (needs_poi) {
1314
return (
1415
<div className='account-management__container'>
1516
<IconMessageContent message={message} icon={<Icon icon='IcPoaVerified' size={128} />}>
1617
<div className='account-management__text-container'>
1718
<Text align='center' size='xs' as='p'>
18-
{localize(
19-
'Your proof of address is under review. We’ll get back to you in 1–3 working days.'
20-
)}
19+
{localize('We’ll review your documents and notify you of its status within 1 to 3 days.')}
2120
</Text>
2221
<Text align='center' size='xs' as='p'>
23-
{localize('To start trading, you also need to verify your identity.')}
22+
{localize('You must also submit a proof of identity.')}
2423
</Text>
2524
</div>
26-
<RouteButton button_label={localize('Next')} route={routes.proof_of_identity} />
25+
<PoiButton />
2726
</IconMessageContent>
2827
</div>
2928
);
@@ -32,13 +31,10 @@ export const Submitted = ({ needs_poi, redirect_button }: TPoaStatusProps) => {
3231
<div className='account-management__container'>
3332
<IconMessageContent
3433
message={message}
35-
text={localize('Your proof of address is under review. We’ll get back to you in 1–3 working days.')}
34+
text={localize('We’ll review your documents and notify you of its status within 1 to 3 days.')}
3635
icon={<Icon icon='IcPoaVerified' size={128} />}
3736
>
38-
{redirect_button ||
39-
(!is_redirected_from_platform && (
40-
<RouteButton button_label={localize("Return to Trader's Hub")} route={routes.traders_hub} />
41-
))}
37+
{redirect_button || (!is_redirected_from_platform && <ContinueTradingButton />)}
4238
</IconMessageContent>
4339
</div>
4440
);
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React from 'react';
2+
import { Button, Icon, Loading } from '@deriv/components';
3+
import { localize } from '@deriv/translations';
4+
import { getAuthenticationStatusInfo, Jurisdiction } from '@deriv/shared';
5+
import IconMessageContent from 'Components/icon-message-content';
6+
import { GetAccountStatus } from '@deriv/api-types';
7+
8+
type TPoiPoaDocsSubmitted = {
9+
account_status: GetAccountStatus;
10+
onClickOK: () => void;
11+
jurisdiction_selected_shortcode: string;
12+
has_created_account_for_selected_jurisdiction: boolean;
13+
openPasswordModal: () => void;
14+
updateAccountStatus: () => Promise<void>;
15+
};
16+
17+
const PoiPoaDocsSubmitted = ({
18+
account_status,
19+
jurisdiction_selected_shortcode,
20+
onClickOK,
21+
updateAccountStatus,
22+
has_created_account_for_selected_jurisdiction,
23+
openPasswordModal,
24+
}: TPoiPoaDocsSubmitted) => {
25+
const [is_loading, setIsLoading] = React.useState(false);
26+
27+
React.useEffect(() => {
28+
const fetchAccountStatus = async () => {
29+
await updateAccountStatus();
30+
setIsLoading(false);
31+
};
32+
setIsLoading(true);
33+
fetchAccountStatus();
34+
35+
return () => setIsLoading(false);
36+
}, [updateAccountStatus]);
37+
38+
const onSubmit = () => {
39+
onClickOK();
40+
if (!has_created_account_for_selected_jurisdiction) {
41+
openPasswordModal();
42+
}
43+
};
44+
45+
const getDescription = () => {
46+
const { manual_status, poi_verified_for_maltainvest, poi_verified_for_bvi_labuan_vanuatu, poa_pending } =
47+
getAuthenticationStatusInfo(account_status);
48+
const is_maltainvest_selected = jurisdiction_selected_shortcode === Jurisdiction.MALTA_INVEST;
49+
if (
50+
(is_maltainvest_selected && poi_verified_for_maltainvest && poa_pending) ||
51+
(!is_maltainvest_selected && poi_verified_for_bvi_labuan_vanuatu && poa_pending) ||
52+
manual_status === 'pending'
53+
) {
54+
return localize('We’ll review your documents and notify you of its status within 1 - 3 working days.');
55+
}
56+
return localize('We’ll review your documents and notify you of its status within 5 minutes.');
57+
};
58+
59+
return is_loading ? (
60+
<Loading is_fullscreen={false} />
61+
) : (
62+
<IconMessageContent
63+
message={localize('Your documents were submitted successfully')}
64+
text={getDescription()}
65+
icon={<Icon icon='IcDocsSubmit' size={128} />}
66+
className='poi-poa-submitted'
67+
>
68+
<Button has_effect text={localize('Ok')} onClick={onSubmit} primary />
69+
</IconMessageContent>
70+
);
71+
};
72+
73+
export default PoiPoaDocsSubmitted;

packages/account/src/Components/poi/idv-status/idv-submit-complete/__tests__/idv-submit-complete.spec.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,18 @@ describe('<IdvSubmitComplete/>', () => {
5151

5252
expect(screen.getByText('DerivLightWaitingPoiIcon')).toBeInTheDocument();
5353
expect(screen.getByText('Mock Redirect Button')).toBeInTheDocument();
54-
expect(screen.queryByText('Your profile is updated')).not.toBeInTheDocument();
55-
expect(screen.queryByText('Review in progress')).toBeInTheDocument();
54+
expect(screen.getByText('Your documents were submitted successfully')).toBeInTheDocument();
5655
expect(
57-
screen.queryByText('Your proof of identity is under review. We’ll get back to you within 5 minutes.')
56+
screen.getByText('We’ll review your documents and notify you of its status within 5 minutes.')
5857
).toBeInTheDocument();
59-
expect(screen.queryByText('To start trading, you also need to verify your address.')).not.toBeInTheDocument();
58+
expect(screen.queryByText('Your profile is updated')).not.toBeInTheDocument();
59+
expect(screen.queryByText('Your document has been submitted')).not.toBeInTheDocument();
60+
expect(
61+
screen.queryByText(
62+
"We'll review your proof of identity again and will give you an update as soon as possible."
63+
)
64+
).not.toBeInTheDocument();
65+
expect(screen.queryByText("Next, we'll need your proof of address.")).not.toBeInTheDocument();
6066
});
6167

6268
it('should render IdvSubmitComplete component needs_poa not external, without mismatch_status and redirect_button', () => {
@@ -68,12 +74,16 @@ describe('<IdvSubmitComplete/>', () => {
6874
renderComponent({ props: new_props });
6975

7076
expect(screen.getByText('DerivLightWaitingPoiIcon')).toBeInTheDocument();
71-
expect(screen.queryByText('Review in progress')).toBeInTheDocument();
77+
expect(screen.getByText('Your documents were submitted successfully')).toBeInTheDocument();
78+
expect(screen.getByText('Submit proof of address')).toBeInTheDocument();
79+
expect(screen.getByText("Next, we'll need your proof of address.")).toBeInTheDocument();
80+
expect(screen.queryByText('Your profile is updated')).not.toBeInTheDocument();
81+
expect(screen.queryByText('Your document has been submitted')).not.toBeInTheDocument();
7282
expect(
73-
screen.queryByText('Your proof of identity is under review. We’ll get back to you within 5 minutes.')
74-
).toBeInTheDocument();
75-
expect(screen.queryByText('To start trading, you also need to verify your address.')).toBeInTheDocument();
76-
expect(screen.queryByText('Next')).toBeInTheDocument();
83+
screen.queryByText(
84+
"We'll review your proof of identity again and will give you an update as soon as possible."
85+
)
86+
).not.toBeInTheDocument();
7787
});
7888

7989
it('should render IdvSubmitComplete component with mismatch_status ', () => {

packages/account/src/Components/poi/idv-status/idv-submit-complete/idv-submit-complete.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const IdvSubmitComplete = observer(
3333
if (is_expired_or_failed_error)
3434
return <Localize i18n_default_text='Your document has been submitted' />;
3535
}
36-
return <Localize i18n_default_text='Review in progress' />;
36+
return <Localize i18n_default_text='Your documents were submitted successfully' />;
3737
};
3838

3939
const getDescriptionText = () => {
@@ -42,11 +42,13 @@ const IdvSubmitComplete = observer(
4242
<Localize i18n_default_text="We'll review your proof of identity again and will give you an update as soon as possible." />
4343
);
4444
return (
45-
<Localize i18n_default_text='Your proof of identity is under review. We’ll get back to you within 5 minutes.' />
45+
<Localize i18n_default_text='We’ll review your documents and notify you of its status within 5 minutes.' />
4646
);
4747
};
4848

49-
const poa_button = !is_from_external && <PoaButton custom_text={<Localize i18n_default_text='Next' />} />;
49+
const poa_button = !is_from_external && (
50+
<PoaButton custom_text={<Localize i18n_default_text='Submit proof of address' />} />
51+
);
5052

5153
return (
5254
<div className={clsx('proof-of-identity__container', 'proof-of-identity__container--status')}>
@@ -60,7 +62,7 @@ const IdvSubmitComplete = observer(
6062
{needs_poa ? (
6163
<React.Fragment>
6264
<Text className='text' size='xs' align='center'>
63-
<Localize i18n_default_text='To start trading, you also need to verify your address.' />
65+
<Localize i18n_default_text="Next, we'll need your proof of address." />
6466
</Text>
6567
{poa_button}
6668
</React.Fragment>

packages/account/src/Components/poi/status/unsupported/detail-component.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ type TDetailComponent = {
3131
is_from_external?: boolean;
3232
is_for_mt5?: boolean;
3333
handlePOIforMT5Complete?: () => void;
34-
needs_poa?: boolean;
3534
};
3635

3736
const DetailComponent = ({
@@ -45,7 +44,6 @@ const DetailComponent = ({
4544
is_from_external,
4645
is_for_mt5,
4746
handlePOIforMT5Complete,
48-
needs_poa,
4947
...props
5048
}: TDetailComponent) => {
5149
const [status, setStatus] = React.useState('');
@@ -123,7 +121,7 @@ const DetailComponent = ({
123121
case STATUS.IS_UPLOADING:
124122
return <Loading is_fullscreen={false} is_slow_loading status={[localize('Uploading documents')]} />;
125123
case STATUS.IS_COMPLETED:
126-
return <UploadComplete is_from_external needs_poa={needs_poa} is_manual_upload />;
124+
return <UploadComplete is_from_external={true} needs_poa={false} is_manual_upload />;
127125
case STATUS.IS_FAILED:
128126
return <POIManualUploadFailed error={response_error} />;
129127
case STATUS.IS_DUPLICATE_UPLOAD:

0 commit comments

Comments
 (0)