Skip to content

Commit 3bb19b4

Browse files
Merge pull request #414 from ameerul-deriv/P2PS-4525-P2P-is-not-block-for-payment-agent
Ameerul / P2PS-4525 P2P is not block for Payment Agent
2 parents 4593ea8 + 056da52 commit 3bb19b4

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

src/components/BlockedScenarios/BlockedScenarios.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ const BlockedScenarios = ({ type }: { type: string }) => {
105105
</Text>
106106
),
107107
},
108+
p2pBlockedForPa: {
109+
description: (
110+
<Text align='center'>
111+
<Localize i18n_default_text='P2P transactions are locked. This feature is not available for payment agents.' />
112+
</Text>
113+
),
114+
icon: <DerivLightIcCashierBlockedIcon height={iconSize} width={iconSize} />,
115+
title: (
116+
<Text align='center' weight='bold'>
117+
<Localize i18n_default_text='Your Deriv P2P cashier is blocked' />
118+
</Text>
119+
),
120+
},
108121
RestrictedCountry: {
109122
actionButton: (
110123
<Button onClick={openDerivApp} size='lg' textSize={buttonTextSize}>

src/components/BlockedScenarios/__tests__/BlockedScenarios.spec.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,12 @@ describe('BlockedScenarios', () => {
6161
expect(screen.getByText('This service is currently not offered in your country.')).toBeInTheDocument();
6262
expect(screen.getByRole('button', { name: "Go to Trader's Hub" })).toBeInTheDocument();
6363
});
64+
65+
it('should show the correct message when user has p2p blocked for pa', () => {
66+
render(<BlockedScenarios type='p2pBlockedForPa' />);
67+
expect(screen.getByText('Your Deriv P2P cashier is blocked')).toBeInTheDocument();
68+
expect(
69+
screen.getByText('P2P transactions are locked. This feature is not available for payment agents.')
70+
).toBeInTheDocument();
71+
});
6472
});

src/hooks/custom-hooks/__tests__/useIsP2PBlocked.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,14 @@ describe('useIsP2PBlocked', () => {
7373
const { result } = renderHook(() => useIsP2PBlocked());
7474
expect(result.current).toStrictEqual({ isP2PBlocked: true, status: 'nonUSD' });
7575
});
76+
77+
it('should return isP2PBlocked as true and status as p2pBlockedForPa if status includes p2p_blocked_for_pa', () => {
78+
mockUseGetAccountStatus.mockImplementation(() => ({
79+
data: { p2p_status: 'none', status: ['p2p_blocked_for_pa'] },
80+
}));
81+
mockUseActiveAccount.mockImplementation(() => ({ data: { currency: 'USD', is_virtual: 0 } }));
82+
83+
const { result } = renderHook(() => useIsP2PBlocked());
84+
expect(result.current).toStrictEqual({ isP2PBlocked: true, status: 'p2pBlockedForPa' });
85+
});
7686
});

src/hooks/custom-hooks/useIsP2PBlocked.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const useIsP2PBlocked = () => {
1616
if (!accountStatus) return '';
1717

1818
if (accountStatus?.cashier_validation?.includes('system_maintenance')) return 'systemMaintenance';
19+
if (accountStatus.status.includes('p2p_blocked_for_pa')) return 'p2pBlockedForPa';
1920
if (accountStatus.p2p_status === 'perm_ban') return 'p2pBlocked';
2021

2122
return '';

0 commit comments

Comments
 (0)