Skip to content

feat(quote): enforce expiry, bind quoteId to payload, display metadata - #287

Open
euniceamoni wants to merge 1 commit into
RemitFlow:mainfrom
euniceamoni:feat/quote-expiry-validation
Open

feat(quote): enforce expiry, bind quoteId to payload, display metadata#287
euniceamoni wants to merge 1 commit into
RemitFlow:mainfrom
euniceamoni:feat/quote-expiry-validation

Conversation

@euniceamoni

Copy link
Copy Markdown
  • buildQuote() now returns a full snapshot: quoteId, source, timestamp, expiresAt (30s TTL), fromMeta/toMeta (currency flags + names), and canonical sendAmount rounded to 2 dp.
  • Added isQuoteExpired() and isQuoteStale() helpers to detect when a quote must be refreshed before submission.
  • SendMoney: quote is cleared immediately on any field edit; a 1-second countdown tracks expiry; handleSubmit re-validates via isQuoteExpired / isQuoteStale and binds quoteId into the transfer payload.
  • QuoteCard: shows currency corridor with flags, source tag, obtained-at timestamp, and color-coded expiry badge (normal / warning / expired).
  • test/services/quote.test.js: 84 new tests covering quote structure, expiry boundaries (fake timers), staleness (amount/from/to/swap), all 42 supported corridors, 2dp precision, MIN_FEE, quoteId uniqueness and JSON serialization, and regression coverage for the original expired/stale quote failure mode.
  • All 222 tests pass (128 pre-existing + 84 new).

Description

Motivation

Changes Made

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Style/UI update (formatting, styling, no code change)
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • ✅ Test update (adding or updating tests)
  • 🔧 Chore (dependencies, config, tooling)

Testing

  • Tested locally in development mode
  • All existing tests pass (npm test)
  • Added new tests for the changes
  • Tested in production build (npm run build && npm run preview)
  • Lighthouse checks pass (if UI changes)

Test Evidence

Screenshots (if applicable)

Before

After

Accessibility

  • Semantic HTML elements used
  • ARIA labels added where needed
  • Keyboard navigation tested
  • Minimum 44×44px touch targets maintained
  • Color contrast meets WCAG AA standards
  • Screen reader tested (if applicable)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • I have updated the documentation accordingly
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally
  • Any dependent changes have been merged and published

Related Issues

Fixes #

Additional Notes

Breaking Changes


closes #279

- buildQuote() now returns a full snapshot: quoteId, source, timestamp,
  expiresAt (30s TTL), fromMeta/toMeta (currency flags + names), and
  canonical sendAmount rounded to 2 dp.
- Added isQuoteExpired() and isQuoteStale() helpers to detect when a
  quote must be refreshed before submission.
- SendMoney: quote is cleared immediately on any field edit; a 1-second
  countdown tracks expiry; handleSubmit re-validates via isQuoteExpired /
  isQuoteStale and binds quoteId into the transfer payload.
- QuoteCard: shows currency corridor with flags, source tag, obtained-at
  timestamp, and color-coded expiry badge (normal / warning / expired).
- test/services/quote.test.js: 84 new tests covering quote structure,
  expiry boundaries (fake timers), staleness (amount/from/to/swap),
  all 42 supported corridors, 2dp precision, MIN_FEE, quoteId uniqueness
  and JSON serialization, and regression coverage for the original
  expired/stale quote failure mode.
- All 222 tests pass (128 pre-existing + 84 new).
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.

feat(frontend): make quote freshness and currency validation explicit in send flow

1 participant