-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[COJ][TRAH-3427]/Dhruv/amina mt5 defaulting jurisdiction (#16540
- Loading branch information
1 parent
614596d
commit 6fb892b
Showing
162 changed files
with
7,527 additions
and
2,835 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/account/src/Components/poa/status/needs-review/__tests__/needs-review-spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import { BrowserRouter } from 'react-router-dom'; | ||
import { Button } from '@deriv/components'; | ||
import { NeedsReview } from '../needs-review'; | ||
import React from 'react'; | ||
|
||
jest.mock('Components/poa/continue-trading-button/continue-trading-button', () => ({ | ||
ContinueTradingButton: jest.fn(() => <div>ContinueTradingButton</div>), | ||
})); | ||
|
||
const mock_redirection_btn = <Button>Redirection button</Button>; | ||
|
||
describe('<NeedsReview/>', () => { | ||
it('should render NeedsReview component if it does not need poi', () => { | ||
render( | ||
<BrowserRouter> | ||
<NeedsReview needs_poi={false} redirect_button={false} /> | ||
</BrowserRouter> | ||
); | ||
|
||
expect(screen.getByText('Your proof of address was submitted successfully')).toBeInTheDocument(); | ||
expect(screen.getByText('Your document is being reviewed, please check back in 1-3 days.')).toBeInTheDocument(); | ||
expect(screen.getByText('ContinueTradingButton')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render NeedsReview component if it does not need poi and is_description_enabled', () => { | ||
render( | ||
<BrowserRouter> | ||
<NeedsReview needs_poi={false} redirect_button={mock_redirection_btn} /> | ||
</BrowserRouter> | ||
); | ||
|
||
expect(screen.getByText('Your proof of address was submitted successfully')).toBeInTheDocument(); | ||
expect(screen.getByText('Your document is being reviewed, please check back in 1-3 days.')).toBeInTheDocument(); | ||
expect(screen.queryByText('ContinueTradingButton')).not.toBeInTheDocument(); | ||
expect(screen.getByRole('button')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render NeedsReview component if it needs poi', () => { | ||
render( | ||
<BrowserRouter> | ||
<NeedsReview needs_poi redirect_button={mock_redirection_btn} /> | ||
</BrowserRouter> | ||
); | ||
|
||
expect(screen.getByText('Your proof of address was submitted successfully')).toBeInTheDocument(); | ||
expect(screen.getByText('Your document is being reviewed, please check back in 1-3 days.')).toBeInTheDocument(); | ||
expect(screen.getByText('You must also submit a proof of identity.')).toBeInTheDocument(); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/account/src/Components/poa/status/needs-review/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { NeedsReview as PoaNeedsReview } from './needs-review'; | ||
|
||
export default PoaNeedsReview; |
37 changes: 37 additions & 0 deletions
37
packages/account/src/Components/poa/status/needs-review/needs-review.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import { Icon, Text } from '@deriv/components'; | ||
import { isNavigationFromP2P, isNavigationFromDerivGO } from '@deriv/shared'; | ||
import { localize } from '@deriv/translations'; | ||
import ContinueTradingButton from '../../continue-trading-button'; | ||
import IconMessageContent from '../../../icon-message-content'; | ||
import PoiButton from '../../../poi/poi-button'; | ||
import { TPoaStatusProps } from '../../../../Types'; | ||
|
||
export const NeedsReview = ({ needs_poi, redirect_button }: TPoaStatusProps) => { | ||
const message = localize('Your proof of address was submitted successfully'); | ||
const is_redirected_from_platform = isNavigationFromP2P() || isNavigationFromDerivGO(); | ||
if (!needs_poi) { | ||
return ( | ||
<IconMessageContent | ||
message={message} | ||
text={localize('Your document is being reviewed, please check back in 1-3 days.')} | ||
icon={<Icon icon='IcPoaVerified' size={128} />} | ||
> | ||
{redirect_button || (!is_redirected_from_platform && <ContinueTradingButton />)} | ||
</IconMessageContent> | ||
); | ||
} | ||
return ( | ||
<IconMessageContent message={message} icon={<Icon icon='IcPoaVerified' size={128} />}> | ||
<div className='account-management__text-container'> | ||
<Text align='center' size='xs' as='p'> | ||
{localize('Your document is being reviewed, please check back in 1-3 days.')} | ||
</Text> | ||
<Text align='center' size='xs' as='p'> | ||
{localize('You must also submit a proof of identity.')} | ||
</Text> | ||
</div> | ||
<PoiButton /> | ||
</IconMessageContent> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
packages/account/src/Components/poi-poa-docs-submitted/poi-poa-docs-submitted.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
import { Button, Icon, Loading } from '@deriv/components'; | ||
import { localize } from '@deriv/translations'; | ||
import { getAuthenticationStatusInfo, Jurisdiction } from '@deriv/shared'; | ||
import IconMessageContent from 'Components/icon-message-content'; | ||
import { GetAccountStatus } from '@deriv/api-types'; | ||
|
||
type TPoiPoaDocsSubmitted = { | ||
account_status: GetAccountStatus; | ||
onClickOK: () => void; | ||
jurisdiction_selected_shortcode: string; | ||
has_created_account_for_selected_jurisdiction: boolean; | ||
openPasswordModal: () => void; | ||
updateAccountStatus: () => Promise<void>; | ||
}; | ||
|
||
const PoiPoaDocsSubmitted = ({ | ||
account_status, | ||
jurisdiction_selected_shortcode, | ||
onClickOK, | ||
updateAccountStatus, | ||
has_created_account_for_selected_jurisdiction, | ||
openPasswordModal, | ||
}: TPoiPoaDocsSubmitted) => { | ||
const [is_loading, setIsLoading] = React.useState(false); | ||
|
||
React.useEffect(() => { | ||
const fetchAccountStatus = async () => { | ||
await updateAccountStatus(); | ||
setIsLoading(false); | ||
}; | ||
setIsLoading(true); | ||
fetchAccountStatus(); | ||
|
||
return () => setIsLoading(false); | ||
}, [updateAccountStatus]); | ||
|
||
const onSubmit = () => { | ||
onClickOK(); | ||
if (!has_created_account_for_selected_jurisdiction) { | ||
openPasswordModal(); | ||
} | ||
}; | ||
|
||
const getDescription = () => { | ||
const { manual_status, poi_verified_for_maltainvest, poi_verified_for_bvi_labuan_vanuatu, poa_pending } = | ||
getAuthenticationStatusInfo(account_status); | ||
const is_maltainvest_selected = jurisdiction_selected_shortcode === Jurisdiction.MALTA_INVEST; | ||
if ( | ||
(is_maltainvest_selected && poi_verified_for_maltainvest && poa_pending) || | ||
(!is_maltainvest_selected && poi_verified_for_bvi_labuan_vanuatu && poa_pending) || | ||
manual_status === 'pending' | ||
) { | ||
return localize('We’ll review your documents and notify you of its status within 1 - 3 working days.'); | ||
} | ||
return localize('We’ll review your documents and notify you of its status within 5 minutes.'); | ||
}; | ||
|
||
return is_loading ? ( | ||
<Loading is_fullscreen={false} /> | ||
) : ( | ||
<IconMessageContent | ||
message={localize('Your documents were submitted successfully')} | ||
text={getDescription()} | ||
icon={<Icon icon='IcDocsSubmit' size={128} />} | ||
className='poi-poa-submitted' | ||
> | ||
<Button has_effect text={localize('Ok')} onClick={onSubmit} primary /> | ||
</IconMessageContent> | ||
); | ||
}; | ||
|
||
export default PoiPoaDocsSubmitted; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.