Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • A Ahad Mobile
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • holatech
  • Ahad Mobile
  • Merge requests
  • !118

fix: clear card funding errors and toast feedback on transfer

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Khanh Pham requested to merge fix/card-funding-error into develop Oct 12, 2026
  • Overview 0
  • Commits 4
  • Pipelines 1
  • Changes 15

Why

On staging, a 2000 USD wallet → card top-up failed because reserve.CARD_USD held 913.81. The app showed a raw native Alert: "Insufficient balance on account ". Nothing was debited; the transaction rolled back.

Backend

Error message

  • postDoubleEntry now throws InsufficientAccountBalanceException, which still extends BadRequestException.
  • The client-facing message no longer contains the account id. The id is logged server side instead.

Card deposit and card withdraw

  • A CARD_USD system-account shortfall now returns 422 CARD_FUNDING_UNAVAILABLE.
  • That case also logs an ALERT: line with a hint that depends on the account type:
    • reserve.CARD_USD: top up the KeySecure reserve
    • normal.CARD_USD: mirror drift
  • A shortfall on the user's wallet or card stays INSUFFICIENT_BALANCE.
  • Withdraw: a user asking for more than their card balance gets INSUFFICIENT_BALANCE, with no false ALERT. This applies only to a real CARD_USD shortfall error; DB and lock errors are not remapped.

Frontend

  • A new funding-unavailable kind maps the new code, with separate top-up and withdraw copy.
  • transfer-form.tsx now shows every error as a toast through showErrorMessage instead of Alert.alert.
    • Raw backend text is never shown, except the wrong-passcode message.
    • The sheets are closed before the toast appears.

Verification

  • be: card-account and transactions jest pass (300 card-account tests); yarn build is clean.
  • fe: type-check is clean, lint has 0 errors, transfer and card-account tests pass.
  • The Opus review gate passed in round 2. The NIT fixes come after it.
  • Pre-existing and unrelated: admin-lending.risk.spec.ts fails at BASE with a DI error.

Follow-ups

  • Two concurrent withdraws can very rarely trigger a false ALERT, because the account snapshot is read before the transaction.
  • The wrong-passcode toast sits under the passcode sheet backdrop.

🤖 Generated with Claude Code

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/card-funding-error