Skip to content

Add Revolut fiat payment provider#227

Open
j0ntz wants to merge 1 commit into
masterfrom
jon/add-revolut-plugin
Open

Add Revolut fiat payment provider#227
j0ntz wants to merge 1 commit into
masterfrom
jon/add-revolut-plugin

Conversation

@j0ntz

@j0ntz j0ntz commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

- added: Add Revolut fiat payment provider

Dependencies

none

Description

Adds a Revolut fiat payment provider to the reports server, following the moonpay.ts partner pattern. This recreates the change from #211 under a fresh PR.

Changes:

  • src/partners/revolut.ts (new): queries the Revolut partner transactions API (GET /partner/v1/transactions, Authorization: Bearer <apiKey>), pages via next_cursor, cleans every response with cleaners, keeps only completed transactions, and maps each buy/sell to StandardTx. Returns an empty result (no fetch) when apiKey is null, so a missing key skips Revolut silently.
  • src/queryEngine.ts: register the revolut plugin (import + plugins array).
  • src/demo/partners.ts: add the revolut demo entry (type: fiat, color #191C33).

Mapping notes:

  • buy: deposit = fiat, payout = crypto; payout txid/address from the tx. sell: inverted; deposit txid from the tx.
  • payment_method maps to FiatPaymentType (card->credit, bank_transfer->banktransfer, apple_pay->applepay, google_pay->googlepay, revolut->revolut, unset->null); an unknown method throws.
  • usdValue is left at -1 for the rates engine to fill, consistent with other fiat partners.

The production API key is set out-of-band in CouchDB partnerIds.revolut.apiKeys.apiKey (a human/ops deploy step, not part of this change).

Testing:

  • npm run build.types (tsc) clean; eslint clean on the changed files.
  • Local smoke exercised processRevolutTx for buy and sell inputs (validating each result through the asStandardTx cleaner), the null-apiKey guard (0 transactions, latestIsoDate echoed), and the unknown-payment-method throw.
  • No live Revolut data is available yet (the partner API key is a separate human/ops step), so the live query path was not exercised end to end.

Asana: https://app.asana.com/0/1215088146871429/1216801668822236


Note

Medium Risk
New external API ingestion path writes transaction documents to CouchDB; query failures or unknown payment methods can abort a sync for that partner run, but behavior matches other fiat plugins.

Overview
Adds Revolut as a fiat partner so the reports server can ingest buy/sell transactions from Revolut’s partner API and store them as StandardTx records.

The new queryRevolut plugin calls GET /partner/v1/transactions with bearer auth, walks time windows with a 7-day lookback, pages with next_cursor, and only keeps completed orders. Progress is advanced per window with buffered results so retries do not duplicate orderIds on bulk insert. If apiKey is missing, the plugin returns no transactions without calling the API.

Buy/sell rows map fiat vs crypto to deposit/payout fields (including tx_hash and wallet_address on the crypto side), set exchangeType: 'fiat', and map payment_method to FiatPaymentType (including revolut); unknown methods throw. revolut is registered in the query engine plugin list and added to demo partner metadata; the unreleased changelog is updated.

Reviewed by Cursor Bugbot for commit 755f8e1. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/partners/revolut.ts Outdated
Comment thread src/partners/revolut.ts Outdated
Comment thread src/partners/revolut.ts Outdated
@j0ntz
j0ntz force-pushed the jon/add-revolut-plugin branch from 0086464 to 28a7f85 Compare July 23, 2026 01:29
Comment thread src/partners/revolut.ts
@j0ntz
j0ntz force-pushed the jon/add-revolut-plugin branch from 28a7f85 to cab2ad9 Compare July 23, 2026 01:33
Comment thread src/partners/revolut.ts
Recreate the Revolut partner plugin following the moonpay pattern:
- src/partners/revolut.ts queries the Revolut partner transactions API,
  cleans results, and maps completed buy/sell txs to StandardTx.
- Register the plugin in queryEngine.ts.
- Add the revolut demo entry (fiat, #191C33).
@j0ntz
j0ntz force-pushed the jon/add-revolut-plugin branch from cab2ad9 to 755f8e1 Compare July 23, 2026 01:38

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 755f8e1. Configure here.

Comment thread src/partners/revolut.ts
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.

1 participant