Skip to content

feat(ramps): add custom action order handling for external checkout flows#27364

Merged
georgeweiler merged 38 commits into
mainfrom
codex/v2-custom-actions-codeonly
Mar 17, 2026
Merged

feat(ramps): add custom action order handling for external checkout flows#27364
georgeweiler merged 38 commits into
mainfrom
codex/v2-custom-actions-codeonly

Conversation

@georgeweiler

@georgeweiler georgeweiler commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Description

  1. Integrates new ramps-controller API for custom-action flows (e.g., PayPal) removes Redux-based custom ID tracking.

  2. Simplifies ramps-controller state hydration system into a single init call on app start up.

What changed:

  • BuildQuote — Uses getBuyWidgetData instead of getWidgetUrl. For isCustomAction quotes, calls addPrecreatedOrder before opening external browser (InAppBrowser or Linking.openURL) and passes orderId to Checkout for WebView flows.
  • Checkout — Uses addPrecreatedOrder instead of Redux addFiatCustomIdData. Supports both orderId and customOrderId for backwards compatibility.
  • HooksuseRampsOrders exposes addPrecreatedOrder and AddPrecreatedOrderParams; useRampsQuotes uses getBuyWidgetData returning Promise<BuyWidget | null>; useRampsController exposes both.
  • Provider/payment filteringPaymentSelectionModal and ProviderSelection filter out isCustomAction quotes where appropriate.

What stays untouched: Non-custom-action flows (standard WebView checkout) unchanged. Existing ramps navigation and token selection preserved.

Dependencies: Requires MetaMask/core#8100 for the new controller API.

Changelog

CHANGELOG entry: Adds support for ramps providers such as PayPal, Robinhood & Coinbase that use a different checkout browser

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes the BuildQuote continue flow to support external-browser widget checkouts with precreated order tracking and post-auth callback handling, which can affect buy navigation and order state. Mostly scoped to ramps UI/controller integration with expanded test coverage, but touches user-facing purchase flow and deep-link/callback paths.

Overview
Updates the ramps BuildQuote flow to use the new controller API getBuyWidgetData (replacing getWidgetUrl) and to support widget providers that require external checkout. When external browser checkout is used, it now pre-creates an order via addPrecreatedOrder, opens the widget via InAppBrowser.openAuth (or Linking.openURL fallback), parses the callback to fetch/add the resulting order, and resets navigation either back to BuildQuote or into RAMPS_ORDER_DETAILS.

Refactors amount entry handling into a shared updateAmount path and consolidates user-facing errors under rampsError using reportRampsError. Bootstrap is adjusted to run useRampsProviders on mount (replacing useHydrateRampsController), and tests are heavily rewritten/updated to cover the new routing, error, and callback/order-handling behavior.

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

@georgeweiler georgeweiler requested review from a team as code owners March 11, 2026 15:19
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@socket-security

socket-security Bot commented Mar 11, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​ramps-controller@​10.2.0 ⏵ 12.0.09610078 +198 +1100

View full report

@metamaskbot metamaskbot added the team-money-movement issues related to Money Movement features label Mar 11, 2026
Comment thread app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx
Comment thread app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx
Comment thread app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx
Comment thread app/components/UI/Ramp/utils/openExternalBrowserCheckout.ts Outdated
Comment thread app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx
Comment thread app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx Outdated
Comment thread app/components/UI/Ramp/Views/OrderDetails/OrderDetails.tsx Outdated
Comment thread app/components/UI/Ramp/RampsBootstrap.tsx
Comment thread app/components/UI/Ramp/RampsBootstrap.tsx
@@ -167,21 +167,35 @@ const Checkout = () => {
}, [uri, createEventBuilder, trackEvent, rampRoutingDecision]);

useEffect(() => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Image

errorCount: 0,
};
setCustomIdData(data);
dispatch(addFiatCustomIdData(data));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Image

@georgeweiler

Copy link
Copy Markdown
Contributor Author

@cursoragent please fix the ramp bootstrap test

…k/metamask-mobile into codex/v2-custom-actions-codeonly
@github-actions github-actions Bot added the risk-high Extensive testing required · High bug introduction risk label Mar 16, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 17, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

status: RampsOrderStatus | undefined,
): boolean {
return status != null && BAILED_ORDER_STATUSES.has(status);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exported isBailedOrderStatus only used internally in BuildQuote

Low Severity

isBailedOrderStatus and BAILED_ORDER_STATUSES are defined at module scope and exported, but grep shows they are only referenced within BuildQuote.tsx itself. The function and the Set constant are better placed in a utility file (e.g., alongside extractOrderCode or rampsNavigation) or kept unexported, since mixing domain utility logic with a React component's module top-level scope reduces cohesion and readability.

Additional Locations (1)
Fix in Cursor Fix in Web

@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 17, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 17, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 17, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeTrade, SmokeWalletPlatform, SmokeCard, SmokePerps, SmokeRamps, SmokeMultiChainAPI, SmokePredictions, FlaskBuildTests
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/ramps-controller. Running all tests.

Performance Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/ramps-controller. Running all tests.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@wachunei wachunei removed the request for review from a team March 17, 2026 17:21
@georgeweiler georgeweiler added this pull request to the merge queue Mar 17, 2026
Merged via the queue into main with commit fd6b85a Mar 17, 2026
109 of 110 checks passed
@georgeweiler georgeweiler deleted the codex/v2-custom-actions-codeonly branch March 17, 2026 17:52
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 17, 2026
@metamaskbot metamaskbot added the release-7.71.0 Issue or pull request that will be included in release 7.71.0 label Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.71.0 Issue or pull request that will be included in release 7.71.0 risk-high Extensive testing required · High bug introduction risk size-XL team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants