Skip to content

[HARD][FX] Route down-payment conversion through signed, exact-value quote snapshots #176

Description

@Obiajulu-gif

Summary

The down-payment route fetches a floating USD/NGN rate directly and converts JavaScript numbers inside the payment request, bypassing the repository-backed quote lifecycle and its expiry/audit policies.

Repository evidence

  • app/api/payments/down-payment/route.ts calls api.exchangerate-api.com directly and returns a number rate.
  • The repository already contains lib/fx/quote-service.ts for explicit quote snapshots and consumption.

Scope

  • Require a locked quote ID for cross-currency down payments.
  • Use exact minor-unit arithmetic and atomically consume the quote when initializing Paystack.
  • Record rate source, timestamp, spread, input/output amounts, and consumer.

Acceptance criteria

  • No live floating rate is fetched inside the payment mutation.
  • The amount sent to Paystack exactly matches the consumed quote snapshot.
  • Expired/reused/mismatched quotes fail without creating a payment.

Tests

  • Exact rounding tests for USD/NGN boundaries.
  • Integration tests for expiry, replay, concurrent consumption, and provider failure.

Non-goals

  • Changing the supported currency pair or FX provider roster.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions