Skip to content

Commit

Permalink
Merge pull request #24 from amina-deriv/amina/feature/90115/update_ju…
Browse files Browse the repository at this point in the history
…risdiction

Amina/feature/90115/update jurisdiction
  • Loading branch information
shaheer-deriv committed May 10, 2023
2 parents afce6ed + 47ba18c commit 6f42712
Show file tree
Hide file tree
Showing 74 changed files with 3,697 additions and 23,275 deletions.
33 changes: 3 additions & 30 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
## Changes:

Please include a summary of the change and which issue is fixed below:
- ...
Please provide a summary of the change.

## When you need to add unit test
### Screenshots:

- [ ] If this change disrupt current flow
- [ ] If this change is adding new flow

## When you need to add integration test

- [ ] If components from external libraries are being used to define the flow, e.g. @deriv/components
- [ ] If it relies on a very specific set of props with no default behavior for the current component.

## Test coverage checklist (for reviewer)

- [ ] Ensure utility / function has a test case
- [ ] Ensure all the tests are passing

## Type of change

- [ ] Bug fix
- [ ] New feature
- [ ] Update feature
- [ ] Refactor code
- [ ] Translation to code
- [ ] Translation to crowdin
- [ ] Script configuration
- [ ] Improve performance
- [ ] Style only
- [ ] Dependency update
- [ ] Documentation update
- [ ] Release
Please provide some screenshots of the change.
18 changes: 18 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
permissions:
issues: write
pull-requests: write

name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
days-before-stale: 60
days-before-close: 5
2,389 changes: 1,760 additions & 629 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"lerna": "^5.5.1",
"lint-staged": "^10.4.0",
"nx": "^14.5.10",
"postcss": "^8.3.6",
"postcss": "^8.4.23",
"prettier": "^2.1.2",
"stylelint": "^13.13.1",
"stylelint-config-prettier": "^8.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@
"node-sass": "^7.0.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.3",
"postcss-scss": "^4.0.6",
"resolve-url-loader": "^3.1.2",
"rimraf": "^3.0.2",
"sass-loader": "^12.6.0",
"sass-resources-loader": "^2.1.1",
"terser-webpack-plugin": "^5.1.1",
"typescript": "^4.6.3",
"webpack": "^5.46.0"
"webpack": "^5.81.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const populateVerificationStatus = account_status => {
const allow_poa_resubmission = account_status.status.some(status => status === 'allow_poa_resubmission');
const is_age_verified = account_status.status.some(status => status === 'age_verification');
const is_idv_disallowed = account_status.status.some(status => status === 'idv_disallowed');
const poa_address_mismatch = account_status.status.some(status => status === 'poa_address_mismatch');

const identity_status = identity.status;
const document_status = document.status;
Expand All @@ -36,5 +37,6 @@ export const populateVerificationStatus = account_status => {
needs_poi,
needs_verification,
onfido,
poa_address_mismatch,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const ProofOfAddressContainer = ({
has_submitted_poa: false,
document_status: null,
is_age_verified: false,
poa_address_mismatch: false,
});

React.useEffect(() => {
Expand All @@ -45,6 +46,7 @@ const ProofOfAddressContainer = ({
needs_poa,
document_status,
is_age_verified,
poa_address_mismatch,
} = populateVerificationStatus(get_account_status);
const has_submitted_poa = document_status === PoaStatusCodes.pending && !allow_poa_resubmission;

Expand All @@ -59,6 +61,7 @@ const ProofOfAddressContainer = ({
document_status,
has_submitted_poa,
is_age_verified,
poa_address_mismatch,
},
},
() => {
Expand Down Expand Up @@ -87,6 +90,7 @@ const ProofOfAddressContainer = ({
resubmit_poa,
has_submitted_poa,
is_age_verified,
poa_address_mismatch,
} = authentication_status;

const from_platform = getPlatformRedirect(app_routing_history);
Expand All @@ -112,11 +116,13 @@ const ProofOfAddressContainer = ({
(!is_age_verified && !allow_poa_resubmission && document_status === 'none' && is_mx_mlt)
)
return <NotRequired />;
if (has_submitted_poa) return <Submitted needs_poi={needs_poi} redirect_button={redirect_button} />;
if (has_submitted_poa && !poa_address_mismatch)
return <Submitted needs_poi={needs_poi} redirect_button={redirect_button} />;
if (
resubmit_poa ||
allow_poa_resubmission ||
(has_restricted_mt5_account && ['expired', 'rejected', 'suspected'].includes(document_status))
(has_restricted_mt5_account && ['expired', 'rejected', 'suspected'].includes(document_status)) ||
poa_address_mismatch
) {
return <ProofOfAddressForm is_resubmit onSubmit={() => onSubmit({ needs_poi })} />;
}
Expand Down
5 changes: 2 additions & 3 deletions packages/appstore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"@storybook/manager-webpack5": "^6.5.10",
"@storybook/react": "^6.5.10",
"@testing-library/react": "^12.0.0",
"@types/classnames": "^2.2.11",
"@types/object.fromentries": "^2.0.0",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
Expand All @@ -75,15 +74,15 @@
"node-sass": "^7.0.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.3",
"postcss-scss": "^4.0.6",
"resolve-url-loader": "^3.1.2",
"sass-loader": "^12.6.0",
"sass-resources-loader": "^2.1.1",
"source-map-loader": "^1.1.2",
"style-loader": "^1.2.1",
"terser-webpack-plugin": "^5.1.1",
"typescript": "^4.6.3",
"webpack": "^5.46.0",
"webpack": "^5.81.0",
"webpack-bundle-analyzer": "^4.3.0",
"webpack-cli": "^4.7.2"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import React from 'react';
import CurrentSwitcherContainer from '../currency-switcher-container';
import { render, screen } from '@testing-library/react';
import { StoreProvider, mockStore } from '@deriv/stores';

describe('CurrentSwitcherContainer', () => {
it('should render the modal', async () => {
const mock = mockStore({
modules: {
cfd: {
current_list: {
CR123123: {
landing_company_short: 'maltainvest',
},
},
},
},
});

const wrapper = ({ children }: { children: JSX.Element }) => (
<StoreProvider store={mock}>{children}</StoreProvider>
);

const { container } = render(
<CurrentSwitcherContainer actions={null} has_interaction={false} icon='USD' title='USD' />,
{
wrapper,
}
);
expect(container).toBeInTheDocument();
});

it('should not have the dropdown if is demo is true', () => {
const mock = mockStore({
modules: {
cfd: {
current_list: {
CR123123: {
landing_company_short: 'maltainvest',
},
},
},
},
traders_hub: {
is_demo: true,
},
});
const wrapper = ({ children }: { children: JSX.Element }) => (
<StoreProvider store={mock}>{children}</StoreProvider>
);

render(<CurrentSwitcherContainer actions={null} has_interaction={false} icon='USD' title='USD' />, {
wrapper,
});

expect(screen.queryByTestId('currency-switcher-container__arrow')).not.toBeInTheDocument();
});

it('should not have the dropdown if is_eu_user is true', () => {
const mock = mockStore({
modules: {
cfd: {
current_list: {
CR123123: {
landing_company_short: 'maltainvest',
},
},
},
},
traders_hub: {
is_eu_user: true,
},
});
const wrapper = ({ children }: { children: JSX.Element }) => (
<StoreProvider store={mock}>{children}</StoreProvider>
);

render(<CurrentSwitcherContainer actions={null} has_interaction={false} icon='USD' title='USD' />, {
wrapper,
});

expect(screen.queryByTestId('currency-switcher-container__arrow')).not.toBeInTheDocument();
});

it('should have pending in the classname if the document status is pending', () => {
const mock = mockStore({
modules: {
cfd: {
current_list: {
CR123123: {
landing_company_short: 'maltainvest',
},
},
},
},
client: {
authentication_status: {
document_status: 'pending',
},
},
});
const wrapper = ({ children }: { children: JSX.Element }) => (
<StoreProvider store={mock}>{children}</StoreProvider>
);

render(<CurrentSwitcherContainer actions={null} has_interaction={false} icon='USD' title='USD' />, {
wrapper,
});

expect(screen.getByText('USD')).toHaveClass('currency-switcher-container__content--text--pending');
});

it('should have default in the classname if the document status is default', () => {
const mock = mockStore({
modules: {
cfd: {
current_list: {
CR123123: {
landing_company_short: 'maltainvest',
},
},
},
},
client: {
authentication_status: {
document_status: 'default',
},
},
});
const wrapper = ({ children }: { children: JSX.Element }) => (
<StoreProvider store={mock}>{children}</StoreProvider>
);

render(<CurrentSwitcherContainer actions={null} has_interaction={false} icon='USD' title='USD' />, {
wrapper,
});

expect(screen.getByText('USD')).toHaveClass('currency-switcher-container__content--text--default');
});
});
Loading

0 comments on commit 6f42712

Please sign in to comment.