From ce5d4b1f23f7ea20537976564d2cdc0fa547c64a Mon Sep 17 00:00:00 2001
From: lubega-deriv <142860499+lubega-deriv@users.noreply.github.com>
Date: Mon, 25 Mar 2024 16:15:32 +0800
Subject: [PATCH] [WALL] Lubega / WALL-3539 / Withdrawal locked part 2 (#14321)
* fix: withdrawal locked part 2
* fix: updated unit test
---
.../WithdrawalLockedContent.tsx | 32 ++++-----------
.../WithdrawalLockedContent.spec.tsx | 39 ++++++++++++++-----
2 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/packages/wallets/src/features/cashier/modules/WithdrawalLocked/WithdrawalLockedContent.tsx b/packages/wallets/src/features/cashier/modules/WithdrawalLocked/WithdrawalLockedContent.tsx
index 696115ee284a..9a2c9e5d97af 100644
--- a/packages/wallets/src/features/cashier/modules/WithdrawalLocked/WithdrawalLockedContent.tsx
+++ b/packages/wallets/src/features/cashier/modules/WithdrawalLocked/WithdrawalLockedContent.tsx
@@ -33,30 +33,14 @@ export const getWithdrawalLimitReachedDesc = ({
}: TWithdrawalLimitReachedDescProps) => {
let description = null;
- if (poiNeedsVerification) {
- if (poiStatus === 'none') {
- description = generateDescription(
- 'Please upload your <0>proof of identity0> to lift the limit to continue your withdrawal.',
- []
- );
- } else if (poiStatus !== 'verified' && poiStatus !== 'none') {
- description = generateDescription(
- 'Please check your <0>proof of identity0> document verification status to lift the limit to continue your withdrawal.',
- []
- );
- }
- } else if (poaNeedsVerification) {
- if (poaStatus === 'none') {
- description = generateDescription(
- 'Please upload your <0>proof of address0> to lift the limit to continue your withdrawal.',
- []
- );
- } else if (poaStatus !== 'verified' && poaStatus !== 'none') {
- description = generateDescription(
- 'Please check your <0>proof of address0> document verification status to lift the limit to continue your withdrawal.',
- []
- );
- }
+ if (poiNeedsVerification || poaNeedsVerification || poaStatus !== 'verified' || poiStatus !== 'verified') {
+ description = generateDescription(
+ 'Please check your <0>proof of identity0> and <1>address1> document verification status to lift the limit to continue your withdrawal.',
+ [
+ ,
+ ,
+ ]
+ );
} else if (askFinancialRiskApproval) {
description = generateDescription(
'Please complete the <0>financial assessment form0> to lift the limit to continue your withdrawal.',
diff --git a/packages/wallets/src/features/cashier/modules/WithdrawalLocked/__tests__/WithdrawalLockedContent.spec.tsx b/packages/wallets/src/features/cashier/modules/WithdrawalLocked/__tests__/WithdrawalLockedContent.spec.tsx
index e6a02250003a..ddd36d3f3f2a 100644
--- a/packages/wallets/src/features/cashier/modules/WithdrawalLocked/__tests__/WithdrawalLockedContent.spec.tsx
+++ b/packages/wallets/src/features/cashier/modules/WithdrawalLocked/__tests__/WithdrawalLockedContent.spec.tsx
@@ -11,9 +11,9 @@ describe('WithdrawalLockedContent', () => {
const result = getWithdrawalLimitReachedDesc({
askFinancialRiskApproval: false,
poaNeedsVerification: false,
- poaStatus: 'none',
+ poaStatus: 'verified',
poiNeedsVerification: false,
- poiStatus: 'none',
+ poiStatus: 'verified',
});
expect(result).toBeFalsy();
@@ -31,6 +31,21 @@ describe('WithdrawalLockedContent', () => {
expect(result).toBeFalsy();
});
+ it('should render correct message when withdrawal limit is reached and both POI/POA has not been uploaded', () => {
+ const result = getWithdrawalLimitReachedDesc({
+ askFinancialRiskApproval: false,
+ poaNeedsVerification: true,
+ poaStatus: 'none',
+ poiNeedsVerification: true,
+ poiStatus: 'none',
+ });
+
+ if (result) render(result);
+ expect(screen.getByText(/You have reached the withdrawal limit. Please check your/)).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'proof of identity' })).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'address' })).toBeInTheDocument();
+ });
+
it('should render correct message when withdrawal limit is reached and POI has not been uploaded', () => {
const result = getWithdrawalLimitReachedDesc({
askFinancialRiskApproval: false,
@@ -41,8 +56,9 @@ describe('WithdrawalLockedContent', () => {
});
if (result) render(result);
- expect(screen.getByText(/You have reached the withdrawal limit. Please upload/)).toBeInTheDocument();
+ expect(screen.getByText(/You have reached the withdrawal limit. Please check your/)).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'proof of identity' })).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'address' })).toBeInTheDocument();
});
it('should render correct message when withdrawal limit is reached and POI has been uploaded but not yet verified', () => {
@@ -55,8 +71,9 @@ describe('WithdrawalLockedContent', () => {
});
if (result) render(result);
- expect(screen.getByText(/You have reached the withdrawal limit. Please check/)).toBeInTheDocument();
+ expect(screen.getByText(/You have reached the withdrawal limit. Please check your/)).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'proof of identity' })).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'address' })).toBeInTheDocument();
});
it('should render correct message when withdrawal limit is reached and POA has not been uploaded', () => {
@@ -69,8 +86,9 @@ describe('WithdrawalLockedContent', () => {
});
if (result) render(result);
- expect(screen.getByText(/You have reached the withdrawal limit. Please upload/)).toBeInTheDocument();
- expect(screen.getByRole('link', { name: 'proof of address' })).toBeInTheDocument();
+ expect(screen.getByText(/You have reached the withdrawal limit. Please check your/)).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'proof of identity' })).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'address' })).toBeInTheDocument();
});
it('should render correct message when withdrawal limit is reached and POA has been uploaded but not yet verified', () => {
@@ -83,17 +101,18 @@ describe('WithdrawalLockedContent', () => {
});
if (result) render(result);
- expect(screen.getByText(/You have reached the withdrawal limit. Please check/)).toBeInTheDocument();
- expect(screen.getByRole('link', { name: 'proof of address' })).toBeInTheDocument();
+ expect(screen.getByText(/You have reached the withdrawal limit. Please check your/)).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'proof of identity' })).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'address' })).toBeInTheDocument();
});
it('should render correct message when withdrawal limit is reached and askFinancialRiskApproval status received', () => {
const result = getWithdrawalLimitReachedDesc({
askFinancialRiskApproval: true,
poaNeedsVerification: false,
- poaStatus: 'none',
+ poaStatus: 'verified',
poiNeedsVerification: false,
- poiStatus: 'none',
+ poiStatus: 'verified',
});
if (result) render(result);