Conversation
| /** Selected fiat payment method ID. */ | ||
| selectedPaymentMethodId: string | null; | ||
|
|
||
| /** Quick-buy order ID in normalized format (/providers/{provider}/orders/{id}). */ |
There was a problem hiding this comment.
As we don't persist, should we instead store transactionId in the Ramps state?
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
packages/transaction-pay-controller/src/actions/update-fiat-payment.ts
Outdated
Show resolved
Hide resolved
| /** Selected fiat payment method ID. */ | ||
| selectedPaymentMethodId: string | null; | ||
|
|
||
| /** Quick-buy order ID in normalized format (/providers/{provider}/orders/{id}). */ |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
Explanation
Adds
fiatPaymentstate toTransactionPayControllerand introduces an atomicupdateFiatPaymentAPI with incremental patch semantics.TransactionDatanow includesfiatPayment(selectedPaymentMethodId,amount,quickBuyOrderId), the newTransactionPayController:updateFiatPaymentaction is registered and exported, and transaction initialization/reset paths now consistently default fiat fields to null (including reset on payment-token changes).References
Checklist
Note
Medium Risk
Introduces a new persisted-in-memory state field (
transactionData.fiatPayment) and a new messenger action; downstream consumers relying on the previousTransactionDatashape or payment-token update behavior may need adjustments.Overview
Adds a new per-transaction
fiatPaymentstate object toTransactionPayController(typed asTransactionFiatPayment) and exports/registers a newTransactionPayController:updateFiatPaymentmessenger action for callback-based, incremental updates.Ensures
fiatPaymentis initialized for new transactions and is reset to{}whenupdatePaymentTokenruns, 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.