fix: fiat strategy submit flow and totals calculation#8726
Merged
Conversation
OGPoyraz
commented
May 6, 2026
Comment on lines
+290
to
+292
| if (data.fiatPayment) { | ||
| data.fiatPayment.caipAssetId = fiatAsset.caipAssetId; | ||
| } |
Member
Author
There was a problem hiding this comment.
We need caipAssetId in UI to trigger headless flow, it appears RampsController:setSelectedToken is not enough anymore.
OGPoyraz
commented
May 6, 2026
Member
Author
There was a problem hiding this comment.
Changes here were needed because headless ramps now returns raw orderId
ba1242b to
1ae09f9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5b43908. Configure here.
vinistevam
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
The fiat strategy had three issues that prevented correct end-to-end behavior:
Provider code extraction: The submit flow was parsing the provider code from the order ID string (
/providers/{provider}/orders/{orderCode}), but the order ID format no longer contains the provider prefix. Now extracts the provider code directly from the storedrampsQuote.providerfield and passes the raw order ID asorderCode.Fiat asset tracking: Instead of calling
RampsController:setSelectedToken(which could silently fail if tokens weren't loaded), the fiat asset'scaipAssetIdis now stored directly on thefiatPaymentstate when the payment method changes.Totals calculation: When a fiat strategy quote is present, the totals pipeline should use
targetAmount(the actual bridged output) rather thanamountFiat/amountUsdfrom token metadata — same behavior already applied forisMaxAmounttransactions.References
FiatStrategysubmit flow with order polling and relay execution #8347Checklist
Note
Medium Risk
Changes modify the fiat strategy execution path and totals computation, which can affect order polling, relay submission, and user-visible pricing. Risk is mitigated by updated unit tests but touches core payment flow state and calculations.
Overview
Fixes the fiat strategy end-to-end flow by deriving the on-ramp provider code from the stored
rampsQuote.provider(instead of parsing theorderId) and passing the raworderIdthrough as theorderCodewhen pollingRampsController:getOrder.When the fiat payment method changes, the controller now persists the derived fiat on-ramp asset as
fiatPayment.caipAssetId(new field) rather than callingRampsController:setSelectedToken.Updates totals so that when any quote uses
TransactionPayStrategy.Fiat, totals usequote.targetAmount(matching max-amount behavior) instead of summing token fiat/USD amounts.Reviewed by Cursor Bugbot for commit 8971e1a. Bugbot is set up for automated code reviews on this repo. Configure here.