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

Ameerul / P2PS-4487 P2P is blocked for Wallet User #409

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 0 additions & 19 deletions src/components/BlockedScenarios/BlockedScenarios.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Chat from '@/utils/chat';
import {
DerivLightIcCashierBlockedIcon,
DerivLightIcCashierLockedIcon,
DerivLightIcCashierUnderMaintenanceIcon,
DerivLightWalletCurrencyUnavailableIcon as P2pUnavailable,
} from '@deriv/quill-icons';
Expand Down Expand Up @@ -34,24 +33,6 @@ const BlockedScenarios = ({ type }: { type: string }) => {
};

const blockedScenarios: TBlockedScenariosObject = {
cashierLocked: {
actionButton: (
<Button onClick={openLiveChat} size='lg' textSize={buttonTextSize}>
<Localize i18n_default_text='Live chat' />
</Button>
),
description: (
<Text align='center'>
<Localize i18n_default_text='Your cashier is currently locked. Please contact us via live chat to find out why.' />
</Text>
),
icon: <DerivLightIcCashierLockedIcon height={iconSize} width={iconSize} />,
title: (
<Text align='center' weight='bold'>
<Localize i18n_default_text='Cashier is locked' />
</Text>
),
},
crypto: {
actionButton: (
<Button onClick={openDerivApp} size='lg' textSize={buttonTextSize}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ describe('BlockedScenarios', () => {
expect(screen.getByRole('button', { name: 'Live chat' })).toBeInTheDocument();
});

it('should show the correct message for cashier locked account', () => {
render(<BlockedScenarios type='cashierLocked' />);
expect(screen.getByText('Cashier is locked')).toBeInTheDocument();
expect(
screen.getByText('Your cashier is currently locked. Please contact us via live chat to find out why.')
).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Live chat' })).toBeInTheDocument();
});

it('should show the correct message when cashier is under maintenance', () => {
render(<BlockedScenarios type='systemMaintenance' />);
expect(screen.getByText('Cashier is currently down for maintenance')).toBeInTheDocument();
Expand Down
10 changes: 0 additions & 10 deletions src/hooks/custom-hooks/__tests__/useIsP2PBlocked.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ describe('useIsP2PBlocked', () => {
expect(result.current).toStrictEqual({ isP2PBlocked: true, status: 'p2pBlocked' });
});

it('should return isP2PBlocked as true and status as cashierLocked if status has cashier_locked', () => {
mockUseGetAccountStatus.mockImplementation(() => ({
data: { p2p_status: 'none', status: ['cashier_locked'] },
}));
mockUseActiveAccount.mockImplementation(() => ({ data: { currency: 'USD', is_virtual: 0 } }));

const { result } = renderHook(() => useIsP2PBlocked());
expect(result.current).toStrictEqual({ isP2PBlocked: true, status: 'cashierLocked' });
});

it('should return isP2PBlocked as true and status as systemMaintenance if cashier_validation has system_maintenance', () => {
mockUseGetAccountStatus.mockImplementation(() => ({
data: { cashier_validation: ['system_maintenance'], p2p_status: 'none', status: [] },
Expand Down
1 change: 0 additions & 1 deletion src/hooks/custom-hooks/useIsP2PBlocked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const useIsP2PBlocked = () => {
if (!accountStatus) return '';

if (accountStatus?.cashier_validation?.includes('system_maintenance')) return 'systemMaintenance';
if (accountStatus.status.includes('cashier_locked')) return 'cashierLocked';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how will this affect the existing clients?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we remove cashier locked, we still fall back to the main blocked page because if the advertiser has cashier_locked status applied in BO, once they return to p2p, p2p_advertiser_info returns PermissionDenied error code, and we show the blocked screen

if (accountStatus.p2p_status === 'perm_ban') return 'p2pBlocked';

return '';
Expand Down
Loading