Skip to content

fix: route fiat payment method through strategy selection to enable fiat strategy#8720

Merged
OGPoyraz merged 3 commits intomainfrom
ogp/fix-fiat-strategy
May 6, 2026
Merged

fix: route fiat payment method through strategy selection to enable fiat strategy#8720
OGPoyraz merged 3 commits intomainfrom
ogp/fix-fiat-strategy

Conversation

@OGPoyraz
Copy link
Copy Markdown
Member

@OGPoyraz OGPoyraz commented May 6, 2026

Explanation

The fiat strategy was never selected during quote retrieval because of two issues:

  1. getStrategyOrder never included Fiat — The default strategy order only contained Relay and Across. The fiat payment method ID was not passed into the strategy routing function, so TransactionPayStrategy.Fiat was never part of the strategy list.

  2. getQuotes bailed early on empty requests — When a fiat payment method is selected without a crypto payment token, buildQuoteRequests returns an empty array (no paymentToken). The guard if (!requests?.length) short-circuited before any strategy could run. The fiat strategy doesn't need these requests — it derives its own relay request from amountFiat internally.

Changes

  • getStrategyOrder — Added optional fiatPaymentMethodId parameter. When provided, early returns [TransactionPayStrategy.Fiat] so only the fiat strategy is used.
  • #getStrategiesWithFallback — Now passes transactionData.fiatPayment.selectedPaymentMethodId through to getStrategyOrder.
  • getQuotes — Changed the empty-requests guard from !requests?.length to !requests?.length && !fiatPaymentMethod so the strategy loop runs when a fiat payment method is active.

References

  • Related to CONF-1065

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes strategy routing and quote retrieval guard logic, which can affect which pay strategy executes and when quotes are fetched, but scope is limited to the transaction-pay controller and covered by new unit tests.

Overview
Fixes fiat pay quote retrieval by threading fiatPayment.selectedPaymentMethodId into strategy selection and ensuring it can drive the Fiat strategy.

getStrategyOrder now accepts an optional fiat payment method ID and short-circuits to Fiat-only strategy ordering when present, and TransactionPayController passes this value through during fallback strategy resolution. Quote retrieval no longer bails early on empty request sets when a fiat payment method is selected, allowing fiat quotes even without a crypto paymentToken.

Adds targeted test coverage for the new routing behavior and updates the package changelog under Fixed.

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

@OGPoyraz OGPoyraz requested review from a team as code owners May 6, 2026 10:03
@OGPoyraz OGPoyraz enabled auto-merge May 6, 2026 10:17
@OGPoyraz OGPoyraz added this pull request to the merge queue May 6, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 6, 2026
@OGPoyraz OGPoyraz enabled auto-merge May 6, 2026 13:01
@OGPoyraz OGPoyraz added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit 528babf May 6, 2026
366 checks passed
@OGPoyraz OGPoyraz deleted the ogp/fix-fiat-strategy branch May 6, 2026 13:06
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.

2 participants