Skip to content

feat: Add fiatPayment into transactionData#8093

Merged
OGPoyraz merged 6 commits intomainfrom
ogp/7070
Mar 6, 2026
Merged

feat: Add fiatPayment into transactionData#8093
OGPoyraz merged 6 commits intomainfrom
ogp/7070

Conversation

@OGPoyraz
Copy link
Member

@OGPoyraz OGPoyraz commented Mar 3, 2026

Explanation

Adds fiatPayment state to TransactionPayController and introduces an atomic updateFiatPayment API with incremental patch semantics.

TransactionData now includes fiatPayment (selectedPaymentMethodId, amount, quickBuyOrderId), the new TransactionPayController:updateFiatPayment action is registered and exported, and transaction initialization/reset paths now consistently default fiat fields to null (including reset on payment-token changes).

References

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
Introduces a new persisted-in-memory state field (transactionData.fiatPayment) and a new messenger action; downstream consumers relying on the previous TransactionData shape or payment-token update behavior may need adjustments.

Overview
Adds a new per-transaction fiatPayment state object to TransactionPayController (typed as TransactionFiatPayment) and exports/registers a new TransactionPayController:updateFiatPayment messenger action for callback-based, incremental updates.

Ensures fiatPayment is initialized for new transactions and is reset to {} when updatePaymentToken runs, with new unit tests covering the action behavior, messenger wiring, and the new default state shape; updates the package changelog accordingly.

Written by Cursor Bugbot for commit c5b5e4f. This will update automatically on new commits. Configure here.

@OGPoyraz OGPoyraz requested review from a team as code owners March 3, 2026 13:53
/** Selected fiat payment method ID. */
selectedPaymentMethodId: string | null;

/** Quick-buy order ID in normalized format (/providers/{provider}/orders/{id}). */
Copy link
Member

Choose a reason for hiding this comment

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

As we don't persist, should we instead store transactionId in the Ramps state?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree storing transactionId in Ramps state is better solution. We should raise this on upcoming meeting.

But not fully sure the concern of state persistence. If we are thinking of incomplete transactions, those will be cleanup on initialization we will never be able complete the transaction anyway.

Are you thinking of combining Ramp activity later in the "transaction activity"?

Copy link
Member

@matthewwalsh0 matthewwalsh0 Mar 5, 2026

Choose a reason for hiding this comment

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

True, but the hope is we can infer the original intent later by looking at the old failed transaction.

But that's a future concern, for now do we need quickBuyOrderId here?

We will have the quotes in state in whatever format the strategy wants, so could that include any IDs we need?

Copy link
Member Author

Choose a reason for hiding this comment

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

We will have the quotes in state in whatever format the strategy wants, so could that include any IDs we need?

OrderId only created when user completed the checkout flow, so it's not tied to quote.

But I get your point, it's not needed right now removed it. Hope Ramps can let us inject TransactionController id and we don't have to put this back.

/** Selected fiat payment method ID. */
selectedPaymentMethodId: string | null;

/** Quick-buy order ID in normalized format (/providers/{provider}/orders/{id}). */
Copy link
Member

@matthewwalsh0 matthewwalsh0 Mar 5, 2026

Choose a reason for hiding this comment

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

True, but the hope is we can infer the original intent later by looking at the old failed transaction.

But that's a future concern, for now do we need quickBuyOrderId here?

We will have the quotes in state in whatever format the strategy wants, so could that include any IDs we need?

updateTransactionData(transactionId, (data) => {
const currentFiatPayment = data.fiatPayment ?? {};

if (amountFiat !== undefined) {
Copy link
Member

@matthewwalsh0 matthewwalsh0 Mar 5, 2026

Choose a reason for hiding this comment

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

Apologies, I was meaning could the updateFiatPayment action itself, accept a callback so the clients can specify a callback to mutate specific values?

Like how updateTransactionConfig accepts a callback?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated this way.

@OGPoyraz OGPoyraz added this pull request to the merge queue Mar 6, 2026
Merged via the queue into main with commit d8efd0c Mar 6, 2026
322 checks passed
@OGPoyraz OGPoyraz deleted the ogp/7070 branch March 6, 2026 12:13
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