Skip to content

Wallet sanity checks

Superseded — kept for history only

This checklist describes a partner wallet (/agent/wallet, /finance/wallet/topups) that does not exist in the application. No such routes are registered in src/App.tsx. Partner credit today is a credit limit checked in the database when a partner books — see PTR-030. A wallet is part of the partner-portal rebuild in Wave 3.

  • Apply migrations then log in as an agent; hit /agent/wallet and submit a top-up (UPI/bank/cash). It should land as PENDING and show in finance/wallet/topups.
  • As a finance/admin role open /finance/wallet/topups, approve the request, and confirm /agent/wallet balance increases by the approved amount.
  • Create a booking for an agent with a total that does not exceed the wallet balance; a BOOKING_DEBIT transaction should appear and balance drop. If balance is too low, booking creation should fail and not leave a stranded booking row.
  • Patch a booking to CANCELLED (or finance status to REJECTED) and confirm a REFUND credit is created and balance restored.
  • Verify RLS: an agent should only see their own wallet/transactions; a non-finance user should get a policy error if they call /finance/wallet/topups.
  • Optional: attempt multiple approvals on the same top-up; only PENDING rows should update and duplicate debits/refunds for a booking should be rejected.