Skip to content

feat: call getPaymentOverrideData method to get payment override steps for transactions when paymentOverride is defined#8870

Open
jpuri wants to merge 36 commits into
mainfrom
build_additional_trxn_steps
Open

feat: call getPaymentOverrideData method to get payment override steps for transactions when paymentOverride is defined#8870
jpuri wants to merge 36 commits into
mainfrom
build_additional_trxn_steps

Conversation

@jpuri
Copy link
Copy Markdown
Contributor

@jpuri jpuri commented May 21, 2026

Explanation

If paymentOverride is defined call getPaymentOverrideData method to get payment override steps for transactions.

References

Related to https://consensyssoftware.atlassian.net/browse/CONF-1404

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 relay batch assembly and balance checks for payment-override flows; impact is limited to when paymentOverride is set and a client implements the callback, but mistakes could affect submitted transaction ordering or funding assumptions.

Overview
Adds an optional getPaymentOverrideData hook on TransactionPayController (exposed via messenger) so clients can supply extra TransactionParams when a pay transaction uses paymentOverride.

During Relay submit, if paymentOverride is set on the quote request, the controller calls that hook with the transaction id and human source amount, prepends the returned tx to the relay batch (when defined), skips live source-balance validation (same idea as post-quote), and offsets gas limits / transaction types so the prepended step is treated like other “prepended first tx” flows. If the callback is missing or returns undefined, behavior falls back to a normal single relay deposit.

paymentOverride is also threaded from transaction config into QuoteRequest building so quotes carry the flag through execution. Changelog and unit tests cover the controller delegate and relay batch edge cases.

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

Base automatically changed from money_account_support to main May 21, 2026 12:04
@jpuri jpuri changed the title feat: support for money account source for MM pay deposit transactions feat: if paymentOverride is defined call getPaymentOverrideData method to get payment override steps for transactions May 25, 2026
@jpuri jpuri marked this pull request as ready for review May 27, 2026 12:15
@jpuri jpuri requested review from a team as code owners May 27, 2026 12:16
@jpuri jpuri temporarily deployed to default-branch May 27, 2026 12:16 — with GitHub Actions Inactive
@jpuri jpuri changed the title feat: if paymentOverride is defined call getPaymentOverrideData method to get payment override steps for transactions feat: call getPaymentOverrideData method to get payment override steps for transactions when paymentOverride is defined May 27, 2026
@jpuri jpuri enabled auto-merge May 27, 2026 14:47
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 and found 1 potential issue.

Fix All in Cursor

❌ 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 8332556. Configure here.

): TransactionMeta['type'] {
// Post-quote index 0 is the original transaction
if (isPostQuote && index === 0) {
const hasPrependedTx = isPostQuote ?? hasPaymentOverride;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nullish coalescing misclassifies prepended transaction state

Medium Severity

const hasPrependedTx = isPostQuote ?? hasPaymentOverride uses nullish coalescing (??) instead of logical OR. When a quote has both isPostQuote: true and paymentOverride set (possible because paymentOverride is passed through to buildPostQuoteRequests), the paymentOverride branch in submitTransactions takes precedence. If the override callback returns undefined, no transaction is prepended, yet hasPrependedTx evaluates to true (because isPostQuote is truthy and ?? only falls through on null/undefined). This causes incorrect transaction type assignment and off-by-one relay index calculations. A more robust approach would derive hasPrependedTx from whether allParams actually grew (e.g., allParams.length > normalizedParams.length).

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8332556. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant