Skip to content

Commit

Permalink
Feat new flow mf account (#34)
Browse files Browse the repository at this point in the history
* fix: resolved issues with index

* ref: refactored trade assessment code

* fix: added unique key

* fix: refactored response pick

* feat: added check to disable financial and trade assessment for not risk clients

* feat: made changes to dialog

* fix: modified text content

* fix: risk status flag

* fix: css issues

* fix: added missing store state

* fix: modified conditions

* fix: added new flag to check

* resolved conflict in ui-store

* fix bug (deriv-com#6154)

* yauheni/ 70488/ edit note in self-exclusion message box (deriv-com#6044)

* text|edit_note_self_exclusion_message_box

* test fix

* regexp in tests fix

* accident text deleted

* popup message text fix

* text fixes

* test text query fix

Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”>

* Akmal / Ignore IDV verification if client is high risk && withdrawals are locked (deriv-com#4644)

* Ignore IDV verification if client is high risk

* Fix formatting

* Fix cfd-poi issue due to client store unavailability

* Fix formatting

* Merge with master

* Fix formatting

* Merge with master

* Revert "Merge with master"

This reverts commit 4bead99.

* Fix merge issues

* Chain extra condition to cover wrong status returned from BE

* Fix: wrong component shown when manual upload is triggered

* fix:tax_number_validation (deriv-com#6259)

* george / rm65047 / convert routes, cashier, error-component components to TS (deriv-com#6361)

* perf(cashier routes): convert csahier routes to TS

* perf(cashier routes): convert error-component to TS

* refactor(error-dialog, types): refactor error-dialog types, move error type to shared types

* perf(cashier): convert cashier to TS

* perf(types): refactor types

* refactor(routes with sub routes): refactor default subroute

* refactor(types): add/refactor server error type

* test: refactor pathname

* refactor(route types): refactor route types

* fix: fix ts error in React.Suspense

* george / rm65033 / ts migration of withdraw UI components (deriv-com#6343)

* perf(cashier withdraw): convert withdrawal-verification-email to TS

* perf: add data-testid for checklist action

* perf(cashier withdraw): convert withdrawal-locked to TS

* perf(types): add types for TClinetStore

* perf(cashier withdraw): convert withdraw to TS

* perf(cashier withdraw): convert crypto-withdraw-receipt to TS

* perf(cashier withdraw): convert crypto-withdraw-form to TS

* perf(cashier withdraw): convert withdrawal to TS

* refactor(cashier withdraw): refactor array syntax (ts)

* test(cashier withdraw): remove eslint disables for tests

* update deriv go redirection link (deriv-com#6386)

* Farzin/68320/Update cashier withdrawal locked status if PA already withdraw all his allowable withdrawal amount (deriv-com#6032)

* fix(cashier): ✨ handle `PACommisionWithdrawalLimit` state in `CashierLocked`

* test(cashier): ✅ add test case to `CashierLocked` for `PACommisionWithdrawalLimit`

* Trigger Build

* Jim/73479/appstore-workspace-ts-fix (deriv-com#6208)

* chore: update appstore tsconfig

* chore: update appstore tsconfig

* chore: add react and types/react packages to appstore

* refactor: remove unnecessary includes

* refactor: change from reexports to import -> export

* Niloofar Sadeghi / Trader Typescript configuration issue (deriv-com#6275)

* fix: trader typscript configuration issue

* fix: tsc errors on trader

* Niloofar Sadeghi / Add typescript configuration on reports (deriv-com#6276)

* chores: add typescript configuration on reports

* fix: remove extra paths

* fix: revert removing packages

* george / rm65041 / migrate p2p-cashier component to TS (deriv-com#6177)

* refactor(p2p-cashier): migrate p2p-cashier component to TS

* commit

* perf(types): add types for notification store

* perf(types): add types for ui store

* perf(types): convert p2p-cashier to TS

* refactor(types): change RootStore type to TRootStore

* test(p2p-cashier): test fix (change wrapper order fro p2p-cashier component)

* refactor(types): refactor current_focus type

* test(p2p-cashier): remove eslint disables

* Vinu/Ts onramp cashier (deriv-com#5727)

* refactor: converted on-ramp module into typescript

* refactor: included type related to store in on-ramp

* ts fix in on-ramp-provider-card.spec.tsx

* added path in tsconfig

* added path in tsconfig

* added type for react-router-dom

* added ts related change required for migrating all components (deriv-com#5760)

* changed the name of data-testid in on-ramp component

* ts-migration-crypto-fiat-converter (deriv-com#5796)

* Trigger build

* Update package-lock

* ts-migration-cashier-notifications (deriv-com#5765)

* implemented review comments and updated branch as per latest upstream branch

* bahar/funds_protection_component-ts-migration (deriv-com#5756)

* funds_protection_component-ts-migration

* remove_extra_type_file

* fix_merge_issue

* hamid/migrate-transfer-confirm-to-ts (deriv-com#5815)

* Migrate TransferConfirm to TS

* Rename component in test file

* Replace Confirm with TransferConfirm in PAs

* Enhance Tests

* ts-migration-page-404 (deriv-com#5766)

* corrected imports in on-ramp pages

* coreected setSideNotes type in on-ramp file

* arranged the order of imports in on-ramp

* refactor: add menu-option type to types folder in cashier

* replaced type for FormEvent in on-ramp from Types

* added types from TRootstore

* added types of TClientStore, TUiStore and TCommonStore in on-ramp

Co-authored-by: Nijil Nirmal <nijil@deriv.com>
Co-authored-by: Bahar <bahar@firstsource.tech>
Co-authored-by: Hamid <hamid@re-work.dev>

* hamid/65036/migrate-account-transfer-to-ts (deriv-com#6305)

* Migrate Account Transfer to TS

* Enhance type names

* Remove eslint ignore line

* Remove generic type from useState

* trigger tests

* Fix test errors

* Change data-testid name

* Niloofar Sadeghi / Account typscript configuration issue (deriv-com#6273)

* fix: account typscript configuration issue

* text: remove include comment on account tsconfig

* fix: added missing store

* Niloofar Sadeghi / Circleci issue (deriv-com#6402)

* fix: circle ci issue

* fix: circle ci issue

* Niloofar Sadeghi / Add typescript to each workspace dependency (deriv-com#6306)

* build: add typescript to all packages

* build: move typescript to devdependency

* add some TS configs to eslint file

* fix: conflicts

* Shayan/74388/fix ts config on cfd (deriv-com#6351)

* checking circle/ci test

* removed test changes

* fix: updated tsconfig and fixed some errors

* fix: updated tsconfig and added globals.d.ts

* chore: removed experimentalsDecorators from local config

* translations: 📚 sync translations with crowdin (deriv-com#6405)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* fix: status

Co-authored-by: Eduard Hrachou <107860964+eduard-deriv@users.noreply.github.com>
Co-authored-by: yauheni-kryzhyk-deriv <103182683+yauheni-kryzhyk-deriv@users.noreply.github.com>
Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”>
Co-authored-by: Akmal Djumakhodjaev <akmal@binary.com>
Co-authored-by: amina-deriv <84661147+amina-deriv@users.noreply.github.com>
Co-authored-by: George Usynin <103181646+george-usynin-binary@users.noreply.github.com>
Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>
Co-authored-by: Farzin Mirzaie <72082844+farzin-fs@users.noreply.github.com>
Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Co-authored-by: Niloofar Sadeghi <93518187+niloo-fs@users.noreply.github.com>
Co-authored-by: vinu-deriv <100689171+vinu-deriv@users.noreply.github.com>
Co-authored-by: Nijil Nirmal <nijil@deriv.com>
Co-authored-by: Bahar <bahar@firstsource.tech>
Co-authored-by: Hamid <hamid@re-work.dev>
Co-authored-by: Shayan Khaleghparast <100833613+iman-fs@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>
  • Loading branch information
18 people authored Sep 7, 2022
1 parent 0ac8089 commit fb34bd6
Show file tree
Hide file tree
Showing 159 changed files with 4,843 additions and 4,546 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ module.exports = {
'**/*.test.js*',
'**/*.spec.js',
'**/*.spec.jsx',
'**/*.spec.ts',
'**/*.test.ts',
'**/*.spec.tsx',
'**/*.test.tsx',
],
},
],
Expand Down
5,307 changes: 2,531 additions & 2,776 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions packages/account/globals.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"@babel/preset-react": "^7.16.7",
"@jest/globals": "^26.5.3",
"@testing-library/react": "^12.0.0",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.0.1",
Expand All @@ -75,6 +77,7 @@
"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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ describe('<SelfExclusionArticle />', () => {
let mock_self_exclusion_context = {};

const eu_item =
/These trading limits and self-exclusion help you control the amount of money and time you spend on Deriv.com and exercise/i;
/these trading limits and self-exclusion help you control the amount of money and time you spend on deriv.com and exercise/i;
const non_eu_item =
/These self-exclusion limits help you control the amount of money and time you spend trading on DTrader, DBot, and SmartTrader. The limits you set here will help you exercise/i;
/these self-exclusion limits help you control the amount of money and time you spend trading on dtrader, dbot, smarttrader and binary bot on deriv. the limits you set here will help you exercise/i;

beforeEach(() => {
mock_platform_context = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SelfExclusionContext from './self-exclusion-context';
export const selfExclusionArticleItems = ({ is_eu, is_uk, is_deriv_crypto, is_app_settings }) => {
const platform_name_trader = getPlatformSettings('trader').name;
const platform_name_dbot = getPlatformSettings('dbot').name;
const platform_name_bbot = getPlatformSettings('bbot').name;
const platform_name_smarttrader = getPlatformSettings('smarttrader').name;

const getEuItems = () => {
Expand Down Expand Up @@ -87,7 +88,7 @@ export const selfExclusionArticleItems = ({ is_eu, is_uk, is_deriv_crypto, is_ap
{
component: (
<Localize
i18n_default_text='These self-exclusion limits help you control the amount of money and time you spend trading on {{platform_name_trader}}, {{platform_name_dbot}}, and {{platform_name_smarttrader}}. The limits you set here will help you exercise <0>responsible trading</0>.'
i18n_default_text='These self-exclusion limits help you control the amount of money and time you spend trading on {{platform_name_trader}}, {{platform_name_dbot}}, {{platform_name_smarttrader}} and {{platform_name_bbot}} on Deriv. The limits you set here will help you exercise <0>responsible trading</0>.'
components={[
<a
key={0}
Expand All @@ -97,7 +98,7 @@ export const selfExclusionArticleItems = ({ is_eu, is_uk, is_deriv_crypto, is_ap
href={getStaticUrl('/responsible', { is_deriv_crypto })}
/>,
]}
values={{ platform_name_trader, platform_name_dbot, platform_name_smarttrader }}
values={{ platform_name_trader, platform_name_dbot, platform_name_smarttrader, platform_name_bbot }}
/>
),
},
Expand All @@ -109,8 +110,8 @@ export const selfExclusionArticleItems = ({ is_eu, is_uk, is_deriv_crypto, is_ap
{
component: (
<Localize
i18n_default_text='When you set your limits, they will be aggregated across all your account types in {{platform_name_trader}}, {{platform_name_dbot}}, and {{platform_name_smarttrader}}. For example, the losses made on all three platforms will add up and be counted towards the loss limit you set.'
values={{ platform_name_trader, platform_name_dbot, platform_name_smarttrader }}
i18n_default_text='When you set your limits, they will be aggregated across all your account types in {{platform_name_trader}}, {{platform_name_dbot}}, {{platform_name_smarttrader}} and {{platform_name_bbot}} on Deriv. For example, the losses made on all four platforms will add up and be counted towards the loss limit you set.'
values={{ platform_name_trader, platform_name_dbot, platform_name_smarttrader, platform_name_bbot }}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ const SelfExclusionArticle = () => {
/>
) : (
<Localize
i18n_default_text='These self-exclusion limits help you control the amount of money and time you spend trading on {{platform_name_trader}}, {{platform_name_dbot}}, and {{platform_name_smarttrader}}. The limits you set here will help you exercise <0>responsible trading</0>.'
i18n_default_text='These self-exclusion limits help you control the amount of money and time you spend trading on {{platform_name_trader}}, {{platform_name_dbot}}, {{platform_name_smarttrader}} and {{platform_name_bbot}} on Deriv. The limits you set here will help you exercise <0>responsible trading</0>.'
components={[<StaticUrl key={0} className='link' href='/responsible' />]}
values={{
platform_name_trader: getPlatformSettings('trader').name,
platform_name_dbot: getPlatformSettings('dbot').name,
platform_name_smarttrader: getPlatformSettings('smarttrader').name,
platform_name_bbot: getPlatformSettings('bbot').name,
}}
/>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const FinancialAssessment = ({
is_financial_account,
is_mf,
is_trading_experience_incomplete,
is_financial_information_not_complete,
is_financial_information_incomplete,
is_virtual,
platform,
removeNotificationByKey,
Expand Down Expand Up @@ -364,7 +364,7 @@ const FinancialAssessment = ({
<LeaveConfirm onDirty={isMobile() ? showForm : null} />
{is_form_visible && (
<form className='account-form account-form__financial-assessment' onSubmit={handleSubmit}>
{is_mf && is_financial_information_not_complete && !is_submit_success && (
{is_mf && is_financial_information_incomplete && !is_submit_success && (
<div className='financial-banner'>
<Icon icon='IcAlertWarning' />
{isMobile() ? (
Expand Down Expand Up @@ -991,7 +991,7 @@ FinancialAssessment.propTypes = {
is_financial_account: PropTypes.bool,
is_mf: PropTypes.bool,
is_trading_experience_incomplete: PropTypes.bool,
is_financial_information_not_complete: PropTypes.bool,
is_financial_information_incomplete: PropTypes.bool,
is_virtual: PropTypes.bool,
platform: PropTypes.string,
removeNotificationByKey: PropTypes.func,
Expand All @@ -1003,7 +1003,7 @@ export default connect(({ client, common, notifications }) => ({
is_authentication_needed: client.is_authentication_needed,
is_financial_account: client.is_financial_account,
is_mf: client.landing_company_shortcode === 'maltainvest',
is_financial_information_not_complete: client.is_financial_information_not_complete,
is_financial_information_incomplete: client.is_financial_information_incomplete,
is_trading_experience_incomplete: client.is_trading_experience_incomplete,
is_virtual: client.is_virtual,
platform: common.platform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const ProofOfIdentityContainer = ({
is_from_external,
is_switching,
is_virtual,
is_high_risk,
is_withdrawal_lock,
onStateChange,
refreshNotifications,
routeBackInApp,
Expand Down Expand Up @@ -85,6 +87,10 @@ const ProofOfIdentityContainer = ({
needs_poa,
onfido,
} = verification_status;
const last_attempt_status = identity_last_attempt?.status;
const is_last_attempt_idv = identity_last_attempt?.service === 'idv';
const is_last_attempt_onfido = identity_last_attempt?.service === 'onfido';
const should_ignore_idv = is_high_risk && is_withdrawal_lock;

if (!should_allow_authentication && !is_age_verified) {
return <NotRequired />;
Expand All @@ -96,7 +102,13 @@ const ProofOfIdentityContainer = ({
</Button>
);

if (identity_status === identity_status_codes.none || has_require_submission || allow_poi_resubmission) {
if (
identity_status === identity_status_codes.none ||
has_require_submission ||
allow_poi_resubmission ||
(should_ignore_idv && is_last_attempt_idv && manual?.status !== 'verified' && manual?.status !== 'pending') ||
(should_ignore_idv && is_last_attempt_onfido && last_attempt_status === 'rejected')
) {
return (
<POISubmission
allow_poi_resubmission={allow_poi_resubmission}
Expand All @@ -105,7 +117,7 @@ const ProofOfIdentityContainer = ({
identity_last_attempt={identity_last_attempt}
idv={idv}
is_from_external={!!is_from_external}
is_idv_disallowed={is_idv_disallowed}
is_idv_disallowed={is_idv_disallowed || should_ignore_idv}
manual={manual}
needs_poa={needs_poa}
onfido={onfido}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const ProofOfIdentity = ({
is_from_external,
is_switching,
is_virtual,
is_high_risk,
is_withdrawal_lock,
onStateChange,
refreshNotifications,
routeBackInApp,
Expand All @@ -29,6 +31,8 @@ const ProofOfIdentity = ({
is_from_external={is_from_external}
is_switching={is_switching}
is_virtual={is_virtual}
is_high_risk={is_high_risk}
is_withdrawal_lock={is_withdrawal_lock}
onStateChange={onStateChange}
refreshNotifications={refreshNotifications}
routeBackInApp={routeBackInApp}
Expand All @@ -48,6 +52,8 @@ export default connect(({ client, common, notifications }) => ({
fetchResidenceList: client.fetchResidenceList,
is_switching: client.is_switching,
is_virtual: client.is_virtual,
is_high_risk: client.is_high_risk,
is_withdrawal_lock: client.is_withdrawal_lock,
refreshNotifications: notifications.refreshNotifications,
routeBackInApp: common.routeBackInApp,
should_allow_authentication: client.should_allow_authentication,
Expand Down
6 changes: 3 additions & 3 deletions packages/account/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": "./",
"paths": {
"Components/*": ["src/Components/*"],
Expand All @@ -15,8 +14,9 @@
"Modules/*": ["src/Modules/*"],
"Sections/*": ["src/Sections/*"],
"Stores/*": ["src/Stores/*"],
"Styles/*": ["src/Styles/*"]
"Styles/*": ["src/Styles/*"],
"@deriv/*": ["../*/src"]
}
},
"include": ["./src/**/*.ts", "./src/**/*.tsx", "globals.d.ts"] // *** The files TypeScript should type check ***
"include": ["src"]
}
4 changes: 4 additions & 0 deletions packages/appstore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"mobx-react-lite": "^2.2.2",
"object.fromentries": "^2.0.0",
"prop-types": "^15.7.2",
"react": "^16.14.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0"
},
Expand All @@ -50,6 +51,8 @@
"@types/classnames": "^2.2.11",
"@types/object.fromentries": "^2.0.0",
"@types/react-router-dom": "^5.1.6",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
Expand All @@ -70,6 +73,7 @@
"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-bundle-analyzer": "^4.3.0",
"webpack-cli": "^4.7.2"
Expand Down
6 changes: 3 additions & 3 deletions packages/appstore/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": "./",
"paths": {
"Components/*": ["src/components/*"],
Expand All @@ -11,8 +10,9 @@
"Stores/*": ["src/stores/*"],
"Stores": ["src/stores/index"],
"Types": ["src/types"],
"Utils": ["src/utils"]
"Utils": ["src/utils"],
"@deriv/*": ["../*/src"]
}
},
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
"include": ["src"]
}
3 changes: 3 additions & 0 deletions packages/bot-skeleton/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@babel/preset-react": "^7.16.7",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
"chai": "^4.2.0",
"deep-diff": "^1.0.2",
"typescript": "^4.6.3",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-binary": "^1.0.2",
"eslint-config-prettier": "^7.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/bot-web-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@babel/preset-react": "^7.16.7",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"clean-webpack-plugin": "^3.0.0",
Expand All @@ -60,6 +62,7 @@
"sass-resources-loader": "^2.1.1",
"stylelint-webpack-plugin": "^2.1.1",
"svg-sprite-loader": "^5.2.1",
"typescript": "^4.6.3",
"webpack": "^5.46.0",
"webpack-cli": "^4.7.2"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/cashier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.16.7",
"@testing-library/react": "^12.0.0",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^9.0.1",
Expand All @@ -86,6 +88,7 @@
"resolve-url-loader": "^3.1.2",
"sass-loader": "^12.6.0",
"sass-resources-loader": "^2.1.1",
"typescript": "^4.6.3",
"webpack": "^5.46.0",
"webpack-cli": "^4.7.2",
"webpack-manifest-plugin": "^4.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Text } from '@deriv/components';
import { isMobile } from '@deriv/shared';
import { Localize } from '@deriv/translations';
import { connect } from 'Stores/connect';
import { RootStore } from 'Types';
import { TRootStore } from 'Types';
import './virtual.scss';

type TVirtualProps = RouteComponentProps & {
Expand Down Expand Up @@ -51,7 +51,7 @@ const Virtual = ({ is_dark_mode_on, toggleAccountsDialog }: TVirtualProps) => {
);
};

export default connect(({ ui }: RootStore) => ({
export default connect(({ ui }: TRootStore) => ({
is_dark_mode_on: ui.is_dark_mode_on,
toggleAccountsDialog: ui.toggleAccountsDialog,
}))(withRouter(Virtual));
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,21 @@ describe('<CashierLocked />', () => {
)
).toBeInTheDocument();
});

it('should show the proper message if the client has PACommisionWithdrawalLimit', () => {
render(
<CashierLocked
account_status={{
cashier_validation: ['PACommisionWithdrawalLimit'],
}}
is_withdrawal_locked
/>
);

expect(
screen.getByText(
"It seems that you've no commissions to withdraw at the moment. You can make withdrawals once you receive your commissions."
)
).toBeInTheDocument();
});
});
12 changes: 10 additions & 2 deletions packages/cashier/src/components/cashier-locked/cashier-locked.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Icon, Text } from '@deriv/components';
import { localize, Localize } from '@deriv/translations';
import { formatDate } from '@deriv/shared';
import { connect } from 'Stores/connect';
import { RootStore } from 'Types';
import { TRootStore } from 'Types';

type TAccount = NonNullable<Authorize['account_list']>[0];

Expand Down Expand Up @@ -50,6 +50,8 @@ const CashierLocked = ({
const ask_self_exclusion_max_turnover_set = cashier_validation?.includes('ASK_SELF_EXCLUSION_MAX_TURNOVER_SET');
const ask_fix_details = cashier_validation?.includes('ASK_FIX_DETAILS');
const ask_uk_funds_protection = cashier_validation?.includes('ASK_UK_FUNDS_PROTECTION');
const pa_commision_withdrawal_limit = cashier_validation?.includes('PACommisionWithdrawalLimit');

let icon = 'IcCashierLocked';
let title = localize('Cashier is locked');
let message = localize(
Expand Down Expand Up @@ -269,6 +271,12 @@ const CashierLocked = ({
icon = 'IcCashierWithdrawalLock';
title = localize('Withdrawals are locked');
message = localize('You can only make deposits. Please contact us via live chat for more information.');
} else if (is_withdrawal_locked && pa_commision_withdrawal_limit) {
icon = 'IcCashierWithdrawalLock';
title = localize('Cashier is locked for withdrawals');
message = localize(
"It seems that you've no commissions to withdraw at the moment. You can make withdrawals once you receive your commissions."
);
}

return (
Expand All @@ -284,7 +292,7 @@ const CashierLocked = ({
);
};

export default connect(({ client, modules }: RootStore) => ({
export default connect(({ client, modules }: TRootStore) => ({
account_status: client.account_status,
accounts: client.accounts,
current_currency_type: client.current_currency_type,
Expand Down
Loading

0 comments on commit fb34bd6

Please sign in to comment.