Wallet & Fintech

Deposit validation

Deposit field rejects negatives, more than 2 decimal places, and amounts above the per-tx cap.

User story

As an account holder, I want the deposit form to refuse invalid amounts before submission so I avoid card failures.

Acceptance criteria

  • Negative amounts are blocked
  • More than 2 decimal places are blocked
  • Amounts above $10,000 require approval
  • Valid amount shows the projected new balance

Manual test steps

  1. 1.Open /wallet
  2. 2.Enter -10
  3. 3.Enter 250.123
  4. 4.Enter 12000
  5. 5.Enter 250 and submit

Expected result

Successful 250 deposit increases the balance and posts a 'Deposit posted' toast.

Possible bug risks

  • Floating point: 0.1 + 0.2 ≠ 0.3 in totals
  • Negative sign hidden by CSS but accepted server-side
  • Approval threshold off by one, blocking valid 10,000 deposits

Reference Playwright spec

deposit-validation.spec.ts
ts
1
2
3
4
5
6
7
8
9
10
11
12
13
import { test, expect } from '@playwright/test';

test('deposit validation rejects bad amounts @regression', async ({ page }) => {
  await page.goto('https://lab.hakdogan.com/wallet');

  await page.getByLabel(/^deposit$/i).fill('-10');
  await page.getByRole('button', { name: /deposit funds/i }).click();
  await expect(page.getByRole('alert')).toContainText(/positive amount/i);

  await page.getByLabel(/^deposit$/i).fill('250');
  await page.getByRole('button', { name: /deposit funds/i }).click();
  await expect(page.getByText(/posted/i).first()).toBeVisible();
});