diff --git a/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx b/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx index a58ec58368c8..93ed7f283097 100644 --- a/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx +++ b/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx @@ -22,7 +22,6 @@ jest.mock('../account-transfer-form', () => jest.fn(() => 'mockedAccountTransfer jest.mock('Components/crypto-transactions-history', () => jest.fn(() => 'mockedCryptoTransactionsHistory')); jest.mock('Components/cashier-locked', () => jest.fn(() => 'mockedCashierLocked')); jest.mock('../account-transfer-no-account', () => jest.fn(() => 'mockedAccountTransferNoAccount')); -jest.mock('../account-transfer-receipt', () => jest.fn(() => 'mockedAccountTransferReceipt')); jest.mock('Components/error', () => jest.fn(() => 'mockedError')); jest.mock('@deriv/hooks'); @@ -271,30 +270,4 @@ describe('', () => { expect(await screen.findByText(/You have no funds/i)).toBeInTheDocument(); }); - - it('should show the receipt if transfer is successful', async () => { - const mock_root_store = mockStore({ - client: { - mt5_login_list: [ - { - account_type: 'demo', - sub_account_type: 'financial_stp', - }, - ], - }, - modules: { - cashier: { - ...cashier_mock, - account_transfer: { - ...cashier_mock.account_transfer, - is_transfer_confirm: true, - }, - }, - }, - }); - - renderAccountTransfer(mock_root_store); - - expect(await screen.findByText('mockedAccountTransferReceipt')).toBeInTheDocument(); - }); }); diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx index 1d2d68759b90..15f9fcb3fab1 100644 --- a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx +++ b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx @@ -22,12 +22,13 @@ import SideNote from '../../../components/side-note'; import AccountPlatformIcon from '../../../components/account-platform-icon'; import { useCashierStore } from '../../../stores/useCashierStores'; import './account-transfer-form.scss'; +import AccountTransferReceipt from '../account-transfer-receipt/account-transfer-receipt'; type TAccountTransferFormProps = { error?: TError; onClickDeposit?: () => void; onClickNotes?: () => void; - onClose?: () => void; + onClose: () => void; setSideNotes?: (notes: React.ReactNode[]) => void; }; @@ -76,7 +77,7 @@ let mt_accounts_to: TAccount[] = []; let remaining_transfers: number | undefined; const AccountTransferForm = observer( - ({ error, onClickDeposit, onClickNotes, setSideNotes }: TAccountTransferFormProps) => { + ({ error, onClickDeposit, onClickNotes, setSideNotes, onClose }: TAccountTransferFormProps) => { const { client, common: { is_from_derivgo }, @@ -101,6 +102,7 @@ const AccountTransferForm = observer( transfer_limit, validateTransferFromAmount, validateTransferToAmount, + is_transfer_confirm, } = account_transfer; const { is_crypto, percentage, should_percentage_reset } = general_store; const { @@ -361,6 +363,10 @@ const AccountTransferForm = observer( ); }; + if (is_transfer_confirm) { + return ; + } + return (
; } - if (is_transfer_confirm) { - return ; - } return ( { const { is_withdraw_confirmed } = withdraw; const currency_config = useCurrentCurrencyConfig(); - if (!currency_config.is_crypto && (verification_code || iframe_url)) return ; + if (!currency_config.is_crypto && (verification_code || iframe_url)) + return ( + + + + ); - if (verification_code && currency_config.is_crypto && !is_withdraw_confirmed) return ; + if (verification_code && currency_config.is_crypto && !is_withdraw_confirmed) + return ( + }> + + + ); - if (is_withdraw_confirmed) return ; + if (is_withdraw_confirmed) + return ( + }> + + + ); - return ; + return ( + : undefined}> + + + ); }); const Withdrawal = observer(() => { @@ -123,11 +142,7 @@ const Withdrawal = observer(() => { if (is_crypto_transactions_visible) return ; - return ( - }> - - - ); + return ; }); export default Withdrawal;