Skip to content

feat: Add routes-b API endpoints for bank accounts, profile, and exchange rate#372

Open
HuiNeng6 wants to merge 1 commit intodavedumto:mainfrom
HuiNeng6:feat/routes-b-bank-accounts-and-profile
Open

feat: Add routes-b API endpoints for bank accounts, profile, and exchange rate#372
HuiNeng6 wants to merge 1 commit intodavedumto:mainfrom
HuiNeng6:feat/routes-b-bank-accounts-and-profile

Conversation

@HuiNeng6
Copy link
Copy Markdown

Summary

This PR implements all routes-b API endpoints for the Stellar Wave bounty.

Endpoints Added

Bank Accounts

  • GET /api/routes-b/bank-accounts - List user's bank accounts
  • POST /api/routes-b/bank-accounts - Add new bank account
    • Validates bankName (non-empty, max 100 chars)
    • Validates bankCode (3-10 digits)
    • Validates accountNumber (exactly 10 digits - Nigerian NUBAN)
    • First account auto-set as default
  • DELETE /api/routes-b/bank-accounts/[id] - Remove bank account
    • Promotes next oldest account to default if needed

Profile

  • GET /api/routes-b/profile - Get current user profile
    • Returns wallet address and bank account count
    • Does NOT return privyId
  • PATCH /api/routes-b/profile - Update display name

Exchange Rate

  • GET /api/routes-b/exchange-rate - Get USDC to NGN rate
    • Uses open.er-api.com
    • No auth required (public data)

Acceptance Criteria Met

✅ All routes return correct status codes
✅ Proper authentication validation
✅ Input validation and error handling
✅ Auto-default logic for first bank account
✅ Default account promotion on deletion
✅ Response formats match specifications

Related Issues

Fixes: #362
Fixes: #363
Fixes: #364
Fixes: #365
Fixes: #366
Fixes: #367

…ange rate

- GET /api/routes-b/bank-accounts - list user's bank accounts
- POST /api/routes-b/bank-accounts - add new bank account with validation
- DELETE /api/routes-b/bank-accounts/[id] - remove bank account with default promotion
- GET /api/routes-b/profile - get current user profile
- PATCH /api/routes-b/profile - update display name
- GET /api/routes-b/exchange-rate - get USDC to NGN exchange rate

All routes follow the specified acceptance criteria:
- Proper authentication validation
- Input validation and error handling
- Auto-default logic for first bank account
- Default account promotion on deletion

Fixes: davedumto#362, davedumto#363, davedumto#364, davedumto#365, davedumto#366, davedumto#367
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@HuiNeng6 is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment