Skip to content

feat: React Native mobile app, compliance reporting, real-time FX WebSocket (#942 #943 #944)#993

Merged
Haroldwonder merged 1 commit into
Haroldwonder:mainfrom
ink-mami:feature/issues-942-943-944-mobile-compliance-websocket
Jun 29, 2026
Merged

feat: React Native mobile app, compliance reporting, real-time FX WebSocket (#942 #943 #944)#993
Haroldwonder merged 1 commit into
Haroldwonder:mainfrom
ink-mami:feature/issues-942-943-944-mobile-compliance-websocket

Conversation

@ink-mami

@ink-mami ink-mami commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary


closes #942 — React Native mobile app for senders (mobile/)

Why: Migrant workers predominantly use mobile devices; SwiftRemit had no mobile surface.

What was built:

  • Expo-based React Native project (mobile/) targeting iOS and Android
  • Send Money wizard (3 steps): recipient details → amount + live FX preview → biometric-confirmed review
  • Transaction History screen with pull-to-refresh and status badges
  • Transaction Detail screen with a visual step-progress indicator
  • KYC Status screen showing verification state, required fields, and rejection reasons
  • Biometric confirmation (expo-local-authentication) — Face ID / fingerprint required before every transfer; gracefully falls through on devices without hardware biometrics
  • Push notifications (expo-notifications) — registers for FCM (Android) and APNs (iOS) on first launch; notification tap deep-links to the relevant transaction
  • Secure JWT storage via expo-secure-store; typed service layer for all backend API calls
  • Bottom-tab + stack navigation via @react-navigation

Key files:

File Purpose
mobile/App.tsx Entry point; push token registration, notification response listener
mobile/src/screens/SendMoneyScreen.tsx 3-step send wizard with live FX quote + biometric confirm
mobile/src/screens/TransactionHistoryScreen.tsx Paginated, pull-to-refresh transaction list
mobile/src/screens/KycStatusScreen.tsx KYC state display with actionable CTA
mobile/src/services/api.ts Typed axios client (auth, remittance, KYC, FX)
mobile/src/services/biometrics.ts Biometric gate with graceful hardware fallback
mobile/src/services/notifications.ts Push token registration + listener helpers

closes #943 — Compliance reporting dashboard for regulators (backend/)

Why: Regulators require real-time / periodic reporting of cross-border transfers above a threshold.

What was built:

  • DB migration (add_compliance_reporting.sql) — three new tables:
    • compliance_thresholds — configurable per-corridor thresholds (e.g. USD/PHP above $3 000)
    • compliance_flagged_remittances — auto-flagged transfers with status lifecycle (pending → reported → cleared)
    • compliance_report_audit — immutable log of every report access (actor, IP, filters, row count)
  • Auto-flaggingautoFlagIfAboveThreshold() called on every new remittance creation; no manual intervention needed
  • REST endpoints under /api/compliance:
    Method Path Description
    GET /report Filtered report (date range, status, currency, corridor); JSON or CSV export
    GET /thresholds List all thresholds
    POST /thresholds Create / update a threshold
    POST /flag Manually flag a remittance
    PATCH /flag/:id Update flag status (reported / cleared)
  • CSV export uses csv-stringify — FINCEN/FATF-compatible column headers
  • All report accesses write an audit row atomically

closes #944 — Real-time FX rate WebSocket feed (backend/)

Why: Clients had to poll REST to get FX updates; adds latency and unnecessary load.

What was built:

  • socket.io dependency added to backend
  • FxRateWebSocketServer (backend/src/fx-rate-websocket.ts) — Socket.io namespace /fx-rates mounted at path /ws on the existing http.Server
  • Subscription filtering — clients emit subscribe/unsubscribe with a pairs array (e.g. ["USD/PHP", "USD/MXN"]); internally rooms are keyed by pair so only relevant subscribers receive each update
  • Rate-replay on connect/subscribe — last known rate fetched from cache and emitted immediately so reconnecting clients never display stale data
  • Push on cache refreshFxRateCache now emits rate_updated via an injected EventEmitter; background refreshes and new fetches both trigger the event, so connected clients receive updates within 1 s of any cache write
  • Graceful shutdown — fxRateWss.close() called before PostgreSQL pool drain
  • Full protocol documented in API.md (connection URL, events, reconnect behaviour, JS example)

Test plan

  • cd mobile && npx expo start — app boots on iOS / Android simulator; all 3 tabs reachable
  • Send money wizard: enter recipient → set amount → biometric prompt fires → transfer created and navigates to detail screen
  • On a physical device: push notification arrives within 10 s of a backend status-change event
  • POST /api/compliance/thresholds with { "corridor": "USD/PHP", "currency": "USD", "threshold": 100 } → create a remittance > 100 → GET /api/compliance/report returns the flagged record in < 5 s
  • GET /api/compliance/report?format=csv returns a downloadable CSV
  • Socket.io client connects → emits subscribe { pairs: ["USD/PHP"] } → receives fx_rate immediately (rate-replay) and again within 1 s of next cache refresh

…ime FX WebSocket (Haroldwonder#942 Haroldwonder#943 Haroldwonder#944)

### Haroldwonder#942 — React Native mobile app for senders
- Initialise Expo-based React Native project under `mobile/`
- Screens: Home, Send Money (3-step wizard), Transaction History, Transaction Detail, KYC Status
- Biometric confirmation (Face ID / fingerprint) via `expo-local-authentication` before every transfer
- Push notification registration (FCM + APNs) via `expo-notifications` with deep-link tap handling
- Service layer (`services/api.ts`) for remittance, KYC, and FX calls against the backend REST API
- Secure token storage via `expo-secure-store`
- Bottom-tab + stack navigation with `@react-navigation`

### Haroldwonder#943 — Compliance reporting dashboard for regulators
- DB migration adding `compliance_thresholds`, `compliance_flagged_remittances`, and `compliance_report_audit` tables
- `GET /api/compliance/report` — filtered by date range, status, currency, corridor; returns JSON or CSV (`csv-stringify`)
- `GET/POST /api/compliance/thresholds` — configurable per-corridor reporting thresholds
- `POST /api/compliance/flag` and `PATCH /api/compliance/flag/:id` — manual flag management
- `autoFlagIfAboveThreshold()` called on every new remittance to auto-flag above-threshold transfers
- Full audit trail written to `compliance_report_audit` on every report access (actor, IP, filters, row count)

### Haroldwonder#944 — Real-time FX rate WebSocket feed
- `socket.io` namespace `/fx-rates` mounted at path `/ws` on the existing HTTP server
- `FxRateWebSocketServer` pushes updates to subscribed rooms within 1 s of cache refresh
- `subscribe` / `unsubscribe` messages support per-pair filtering (`USD/PHP`, `USD/MXN`, ...)
- Rate-replay on subscribe: last known rate sent immediately to reconnecting clients
- `FxRateCache` emits `rate_updated` events (via injected `EventEmitter`) on every background refresh and new fetch
- Graceful shutdown: WebSocket server closed before PostgreSQL pool drain
- WebSocket protocol documented in `API.md`
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

@ink-mami is attempting to deploy a commit to the Harold's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@ink-mami Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Haroldwonder Haroldwonder merged commit 3a1ac6c into Haroldwonder:main Jun 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement real-time FX rate WebSocket feed Add compliance reporting dashboard for regulators Build React Native mobile app for senders

2 participants