Skip to content
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
32 changes: 17 additions & 15 deletions src/components/features/requests/WithdrawalForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export const WithdrawalForm = ({ userEmail, currentBalance }) => {
if (apiResult.data) {
setModal({
type: 'success',
title: t('requests.registered.title'),
message: t('requests.registered.crypto'),
title: t('requests.registered.withdrawalTitle'),
message: t('requests.registered.withdrawal'),
});
setAmount('');
setType('partial');
Expand Down Expand Up @@ -177,19 +177,21 @@ export const WithdrawalForm = ({ userEmail, currentBalance }) => {
</div>
</div>

<Input
label={t('withdrawals.form.amount.label')}
type="number"
id="amount"
name="amount"
value={type === 'full' ? formatCurrency(currentBalance) : amount}
onChange={(e) => setAmount(e.target.value)}
disabled={type === 'full' || loading}
required={type === 'partial'}
min="0.01"
step="0.01"
placeholder={t('withdrawals.form.amount.placeholder')}
/>
{type === 'partial' && (
<Input
label={t('withdrawals.form.amount.label')}
type="number"
id="amount"
name="amount"
value={amount}
onChange={(e) => setAmount(e.target.value)}
disabled={loading}
required
min="0.01"
step="0.01"
placeholder={t('withdrawals.form.amount.placeholder')}
/>
)}

<div className="bg-accent/30 p-4 rounded-lg text-sm text-text-primary">
<p className="font-medium mb-1">{t('withdrawals.processingHoursTitle')}</p>
Expand Down
9 changes: 4 additions & 5 deletions src/components/features/requests/WithdrawalForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('WithdrawalForm', () => {
expect(screen.getByText('Withdrawal type')).toBeInTheDocument();

const amountInput = screen.getByLabelText(/Amount/);
expect(amountInput).toHaveAttribute('placeholder', 'Enter amount in USD');
expect(amountInput).toHaveAttribute('placeholder', '1,000.00');

expect(screen.getByRole('button', { name: 'Request withdrawal' })).toBeInTheDocument();

Expand Down Expand Up @@ -171,7 +171,7 @@ describe('WithdrawalForm', () => {
});
});

expect(await screen.findByText('Depósito informado')).toBeInTheDocument();
expect(await screen.findByText('Retiro solicitado')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Aceptar/i })).toBeInTheDocument();
});

Expand All @@ -184,8 +184,7 @@ describe('WithdrawalForm', () => {
);

fireEvent.click(screen.getByLabelText('Total'));
const amountInput = screen.getByLabelText(/Monto/);
expect(amountInput).toBeDisabled();
expect(screen.queryByLabelText(/Monto/)).not.toBeInTheDocument();

fireEvent.submit(container.querySelector('form'));

Expand All @@ -199,7 +198,7 @@ describe('WithdrawalForm', () => {
expect(createInvestorRequest).toHaveBeenCalled();
});

expect(await screen.findByText('Depósito informado')).toBeInTheDocument();
expect(await screen.findByText('Retiro solicitado')).toBeInTheDocument();
});

it('shows error when createInvestorRequest fails (after confirm)', async () => {
Expand Down
10 changes: 8 additions & 2 deletions src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const resources = {
},
amount: {
label: 'Monto',
placeholder: 'Ingresá el monto en USD',
placeholder: '1,000.00',
},
validation: {
invalidAmount: 'Ingresá un monto válido',
Expand Down Expand Up @@ -237,6 +237,9 @@ const resources = {
cash: 'Tu solicitud fue registrada correctamente. Las operaciones en efectivo se coordinan de forma personalizada. Un integrante de nuestro equipo se pondrá en contacto para coordinar el ingreso o retiro de los fondos.',
international:
'Tu solicitud fue registrada correctamente. Las operaciones mediante transferencia internacional se coordinan de forma personalizada. Nuestro equipo se pondrá en contacto por correo electrónico para continuar con el proceso.',
withdrawalTitle: 'Retiro solicitado',
withdrawal:
'La solicitud de retiro fue registrada correctamente.\n\nEl retiro será procesado en el próximo cierre operativo.\nUna vez completado, recibirás el comprobante correspondiente por correo electrónico.',
},
},
history: {
Expand Down Expand Up @@ -505,7 +508,7 @@ const resources = {
},
amount: {
label: 'Amount',
placeholder: 'Enter amount in USD',
placeholder: '1,000.00',
},
validation: {
invalidAmount: 'Enter a valid amount',
Expand Down Expand Up @@ -537,6 +540,9 @@ const resources = {
cash: 'Your request was registered successfully. Cash operations are coordinated personally. A member of our team will contact you to coordinate the deposit or withdrawal.',
international:
'Your request was registered successfully. International transfers are coordinated personally. Our team will contact you by email to continue the process.',
withdrawalTitle: 'Withdrawal requested',
withdrawal:
'The withdrawal request was registered successfully.\n\nThe withdrawal will be processed at the next operational close.\nOnce completed, you will receive the receipt by email.',
},
},
history: {
Expand Down
1 change: 0 additions & 1 deletion src/pages/WalletsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const WalletsPage = () => {
<div className="space-y-6">
<div>
<h1 className="text-3xl font-bold text-text-primary">{t('deposits.title')}</h1>
<p className="text-text-muted mt-1">{t('deposits.subtitle')}</p>
</div>

<div className="border-b border-border-dark">
Expand Down
Loading