Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Farzin/70772/Refactor cashier locked component #5929

Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
0fe46fd
added ts related change required for migrating all components (#5760)
vinu-deriv Jun 20, 2022
2f45f64
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jun 23, 2022
650d7b7
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jun 24, 2022
a72a977
ts-migration-crypto-fiat-converter (#5796)
Jun 27, 2022
d577cfb
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jun 27, 2022
55ba749
Trigger build
nijil-deriv Jun 27, 2022
39220f0
Update package-lock
nijil-deriv Jun 27, 2022
f160248
ts-migration-cashier-notifications (#5765)
Jun 27, 2022
0d1e4ed
bahar/funds_protection_component-ts-migration (#5756)
Jun 28, 2022
0205692
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jun 28, 2022
ef3e40d
hamid/migrate-transfer-confirm-to-ts (#5815)
Jun 28, 2022
93f0020
ts-migration-page-404 (#5766)
Jun 28, 2022
e524697
Vinu/converted percentage-selector component into typescript (#5785)
vinu-deriv Jul 1, 2022
dad6473
Vinu/migrated recent-transaction component to typescript (#5791)
vinu-deriv Jul 1, 2022
06f4e7e
ts-migration-verification-email (#5769)
Jul 1, 2022
6ead1f1
bahar/Ts migration no balance (#5774)
Jul 1, 2022
fe9cf3a
Vinu/migrating cashier-container into ts (#5780)
vinu-deriv Jul 1, 2022
6a9c57d
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 5, 2022
8603197
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 6, 2022
9efa0a0
refactor(cashier): :recycle: extract empty state component into a reu…
Jul 8, 2022
10ed561
refactor(cashier): :sparkles: extract all cashier empty states into s…
Jul 8, 2022
6038ba4
refactor(cashier): :fire: clean up cashier locked component using emp…
Jul 8, 2022
55edbc1
fix(cashier): :pencil2: fix wrong message in `EmptyStateDepositLocked…
Jul 8, 2022
7e575f2
Vinu/Ts cashier error dialog (#5820)
vinu-deriv Jul 12, 2022
f14c01f
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 12, 2022
a3dcb6b
Vinu/migration of crypto-transaction-history component into typescrip…
vinu-deriv Jul 13, 2022
9246ed2
Migrate CashierLocked to TS (#5959)
Jul 13, 2022
e7454d0
Fix security hotspot reported by sonarcloud
nijil-deriv Jul 13, 2022
c158b63
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 13, 2022
4cc5c64
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 15, 2022
09d83ae
fix(cashier): :memo: resolve PR comments
Jul 16, 2022
875f202
fix(cashier): :memo: resolve PR comments
Jul 17, 2022
72f013f
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Jul 17, 2022
5a3d74c
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 18, 2022
b6be94a
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 20, 2022
899022e
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Jul 21, 2022
36d6e75
fix(cashier): :memo: resolve PR comments
Jul 21, 2022
561bd96
fix(cashier): :memo: resolve PR comments
Jul 21, 2022
d76d65d
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 21, 2022
d8fe37b
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Jul 21, 2022
982a8b5
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 26, 2022
7e1ac90
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Jul 27, 2022
b236437
refactor(cashier): :recycle: refactor the initial solution with the s…
Jul 28, 2022
f3bbb26
fix(cashier): :white_check_mark: fix the failing test
Jul 28, 2022
eeb499b
fix(cashier): :memo: resolve PR comments
Jul 28, 2022
f5863c0
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Jul 29, 2022
b3b40f8
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Jul 31, 2022
477bd39
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Aug 2, 2022
12144b4
fix(cashier): :memo: resolve PR comments
Aug 3, 2022
a67320b
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Aug 3, 2022
9df9f5a
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Aug 5, 2022
23bda32
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Aug 5, 2022
ab82fdf
Merge remote-tracking branch 'origin/master' into ts-cashier
nijil-deriv Aug 9, 2022
5b477d8
Merge branch 'ts-cashier' of https://github.com/binary-com/deriv-app …
Aug 10, 2022
d04d2f3
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 15, 2022
ac454f5
chore(cashier): :twisted_rightwards_arrows: resolve merge conflic
Aug 15, 2022
f39714c
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 17, 2022
1c2f247
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 18, 2022
9f84041
fix(cashier): :lipstick: fix inconsistenc padding in cashier tabs whe…
Aug 18, 2022
6637eb3
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 18, 2022
0a67c0d
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 21, 2022
3193e67
fix(cashier): :memo: resolve PR comments
Aug 21, 2022
299bf8f
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 23, 2022
3c08748
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 25, 2022
7949ad5
feat(cashier): :sparkles: handle `PACommisionWithdrawalLimit` state i…
Aug 25, 2022
0afd142
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 29, 2022
f8d99f1
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 29, 2022
11b944e
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 29, 2022
5376663
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Aug 30, 2022
90e731a
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 6, 2022
0b95efe
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 6, 2022
32a08cc
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 8, 2022
9774099
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 11, 2022
7a1ac24
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 14, 2022
584537e
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 14, 2022
fc827f3
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 15, 2022
70c2cf1
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 15, 2022
3dd1ea5
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 16, 2022
ac51b24
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 18, 2022
c9f3de7
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 20, 2022
c1561d3
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 21, 2022
0a56678
Merge remote-tracking branch 'upstream/ts-cashier' into farzin/refact…
Sep 23, 2022
d5c41e0
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 23, 2022
7bdaac1
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 26, 2022
450c4cc
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 27, 2022
4c0b163
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 28, 2022
a8e69b6
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 28, 2022
e39d119
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 29, 2022
5572dbd
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Sep 30, 2022
08efa38
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Oct 3, 2022
30260b8
Merge branch 'master' into farzin/refactor_cashier_lockd_component
Oct 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,366 @@
import React from 'react';
import { Localize, localize } from '@deriv/translations';
import { formatDate } from '@deriv/shared';
import { TEmptyStateProps } from 'Components/empty-state/empty-state';

type TProps = {
cashier_validation: string[] | undefined;
is_crypto: boolean;
is_system_maintenance: boolean;
is_cashier_locked: boolean;
is_deposit_locked: boolean;
is_withdrawal_locked: boolean;
is_identity_verification_needed: boolean;
excluded_until: number | undefined;
};

const getMessage = ({
cashier_validation,
is_crypto,
is_system_maintenance,
is_cashier_locked,
is_deposit_locked,
is_withdrawal_locked,
is_identity_verification_needed,
excluded_until,
}: TProps): TEmptyStateProps => {
const no_residence = cashier_validation?.includes('no_residence');
const unwelcome_status = cashier_validation?.includes('unwelcome_status');
const self_exclusion = cashier_validation?.includes('SelfExclusion');
const no_withdrawal_or_trading_status = cashier_validation?.includes('no_withdrawal_or_trading_status');
const only_pa_withdrawals_allowed_status = cashier_validation?.includes('only_pa_withdrawals_allowed_status');
const withdraw_service_unavailable_for_pa = cashier_validation?.includes('WithdrawServiceUnavailableForPA');
const withdrawal_locked_status = cashier_validation?.includes('withdrawal_locked_status');
const documents_expired = cashier_validation?.includes('documents_expired');
const cashier_locked_status = cashier_validation?.includes('cashier_locked_status');
const disabled_status = cashier_validation?.includes('disabled_status');
const financial_assessment_required = cashier_validation?.includes('FinancialAssessmentRequired');
const ask_currency = cashier_validation?.includes('ASK_CURRENCY');
const ask_authenticate = cashier_validation?.includes('ASK_AUTHENTICATE');
const ask_financial_risk_approval = cashier_validation?.includes('ASK_FINANCIAL_RISK_APPROVAL');
const ask_tin_information = cashier_validation?.includes('ASK_TIN_INFORMATION');
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');

if (is_system_maintenance) {
if (is_crypto && is_withdrawal_locked)
return {
icon: 'IcCashierLocked',
title: localize('Withdrawals are locked'),
description: localize(
'Withdrawals are temporarily unavailable due to system maintenance. You can make your withdrawals when the maintenance is complete.'
),
};
if (is_crypto && is_deposit_locked)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'Deposits are temporarily unavailable due to system maintenance. You can make your deposits when the maintenance is complete.'
),
};
if (is_crypto)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'Our cryptocurrency cashier is temporarily down due to system maintenance. You can access the Cashier in a few minutes when the maintenance is complete.'
),
};
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'Our cashier is temporarily down due to system maintenance. You can access the Cashier in a few minutes when the maintenance is complete.'
),
};
}

if (is_cashier_locked) {
if (no_residence)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'You’ve not set your country of residence. To access Cashier, please update your country of residence in the Personal details section in your account settings.'
),
};
if (documents_expired)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'The identification documents you submitted have expired. Please submit valid identity documents to unlock Cashier. '
),
};
if (cashier_locked_status)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'Your cashier is currently locked. Please contact us via live chat to find out how to unlock it.'
),
};
if (disabled_status)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'Your account is temporarily disabled. Please contact us via live chat to enable deposits and withdrawals again.'
),
};
if (ask_currency)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize('Please set your account currency to enable deposits and withdrawals.'),
};
if (ask_authenticate && is_identity_verification_needed)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='Please submit your <0>proof of identity</0> to authenticate your account and access your Cashier.'
components={[<a key={0} className='link' href={'/account/proof-of-identity'} />]}
/>
),
};
if (ask_authenticate)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='Your account has not been authenticated. Please submit your <0>proof of identity</0> and <1>proof of address</1> to authenticate your account and access your cashier.'
components={[
<a
key={0}
className='link'
rel='noopener noreferrer'
href={'/account/proof-of-identity'}
/>,
<a key={1} className='link' rel='noopener noreferrer' href={'/account/proof-of-address'} />,
]}
/>
),
};
if (ask_financial_risk_approval)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='Please complete the <0>Appropriateness Test</0> to access your cashier.'
components={[
<a
key={0}
className='link'
rel='noopener noreferrer'
href={'/account/financial-assessment'}
data-testid='dt_financial_assessment_link'
/>,
]}
/>
),
};
if (financial_assessment_required)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='Your cashier is locked. Please complete the <0>financial assessment</0> to unlock it.'
components={[
<a
key={0}
className='link'
rel='noopener noreferrer'
href={'/account/financial-assessment'}
data-testid='dt_financial_assessment_link'
/>,
]}
/>
),
};
if (ask_tin_information)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='You have not provided your tax identification number. This information is necessary for legal and regulatory requirements. Please go to <0>Personal details</0> in your account settings, and fill in your latest tax identification number.'
components={[
<a key={0} className='link' rel='noopener noreferrer' href={'/account/personal-details'} />,
]}
/>
),
};
if (ask_uk_funds_protection)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='Your cashier is locked. See <0>how we protect your funds</0> before you proceed.'
components={[
<a key={0} className='link' rel='noopener noreferrer' href={'/cashier/deposit'} />,
]}
/>
),
};
if (ask_self_exclusion_max_turnover_set)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='Your access to Cashier has been temporarily disabled as you have not set your 30-day turnover limit. Please go to <0>Self-exclusion</0> and set your 30-day turnover limit.'
components={[
<a key={0} className='link' rel='noopener noreferrer' href={'/account/self-exclusion'} />,
]}
/>
),
};
if (ask_fix_details)
return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: (
<Localize
i18n_default_text='Your <0>personal details</0> are incomplete. Please go to your account settings and complete your personal details to enable deposits and withdrawals.'
components={[
<a key={0} className='link' rel='noopener noreferrer' href={'/account/personal-details'} />,
]}
/>
),
};
}

if (is_deposit_locked) {
if (ask_fix_details)
return {
icon: 'IcCashierDepositLock',
title: localize('Deposits are locked'),
description: (
<Localize
i18n_default_text='Your <0>personal details</0> are incomplete. Please go to your account settings and complete your personal details to enable deposits.'
components={[
<a key={0} className='link' rel='noopener noreferrer' href={'/account/personal-details'} />,
]}
/>
),
};
if (self_exclusion)
return {
icon: 'IcCashierDepositLock',
title: localize('Deposits are locked'),
description: localize(
'You have chosen to exclude yourself from trading on our website until {{exclude_until}}. If you are unable to place a trade or deposit after your self-exclusion period, please contact us via live chat.',
{
exclude_until: formatDate(excluded_until, 'DD MMM, YYYY'),
}
),
};
if (unwelcome_status)
return {
icon: 'IcCashierDepositLock',
title: localize('Deposits are locked'),
description: localize('Please contact us via live chat.'),
};
}

if (is_withdrawal_locked) {
if (financial_assessment_required)
return {
icon: 'IcCashierWithdrawalLock',
title: localize('Withdrawals are locked'),
description: (
<Localize
i18n_default_text='You can only make deposits. Please complete the <0>financial assessment</0> to unlock withdrawals.'
components={[
<a
key={0}
className='link'
href={'/account/financial-assessment'}
data-testid='dt_financial_assessment_link'
/>,
]}
/>
),
};
if (ask_authenticate)
return {
icon: 'IcCashierWithdrawalLock',
title: localize('Withdrawals are locked'),
description: (
<Localize
i18n_default_text='Your account has not been authenticated. Please submit your <0>proof of identity</0> and <1>proof of address</1> to authenticate your account and request for withdrawals.'
components={[
<a
key={0}
className='link'
rel='noopener noreferrer'
href={'/account/proof-of-identity'}
/>,
<a key={1} className='link' rel='noopener noreferrer' href={'/account/proof-of-address'} />,
]}
/>
),
};
if (ask_fix_details)
return {
icon: 'IcCashierWithdrawalLock',
title: localize('Withdrawals are locked'),
description: (
<Localize
i18n_default_text='Your <0>personal details</0> are incomplete. Please go to your account settings and complete your personal details to enable withdrawals.'
components={[
<a key={0} className='link' rel='noopener noreferrer' href={'/account/personal-details'} />,
]}
/>
),
};
if (withdraw_service_unavailable_for_pa)
return {
icon: 'IcCashierWithdrawalLock',
title: localize('Withdrawals are locked'),
description: localize('This feature is not available for payment agents.'),
};
if (no_withdrawal_or_trading_status)
return {
icon: 'IcCashierWithdrawalLock',
title: localize('Withdrawals are locked'),
description: localize(
'Unfortunately, you can only make deposits. Please contact us via live chat to enable withdrawals.'
),
};
if (withdrawal_locked_status)
return {
icon: 'IcCashierWithdrawalLock',
title: localize('Withdrawals are locked'),
description: localize(
'Unfortunately, you can only make deposits. Please contact us via live chat to enable withdrawals.'
),
};
if (only_pa_withdrawals_allowed_status)
return {
icon: 'IcCashierWithdrawalLock',
title: localize('Withdrawals are locked'),
description: localize(
'You can only make deposits. Please contact us via live chat for more information.'
),
};
}

return {
icon: 'IcCashierLocked',
title: localize('Cashier is locked'),
description: localize(
'Your cashier is currently locked. Please contact us via live chat to find out how to unlock it.'
),
};
};

export default getMessage;
Loading