feat(ramps): Remove redundant normalizeProviderCode from mobile call#27893
feat(ramps): Remove redundant normalizeProviderCode from mobile call#27893
Conversation
1108dc2 to
35da184
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.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|




Explanation
Removes redundant
normalizeProviderCode()calls from mobile ramp call sites. Provider ID normalization (stripping the/providers/prefix) now happens insideRampsServiceat URL construction time, so callers can passprovider.idas-is without pre-processing.This is the mobile counterpart to the core change. The service's
#toProviderSegment()helper accepts both/providers/transakandtransak, so this removal is backward-compatible — the double-strip that existed before was harmless, and now we just strip once at the boundary.Changes:
BuildQuote.tsx— PassselectedQuote.providerdirectly toaddPrecreatedOrderand checkout navigation instead of wrapping innormalizeProviderCode().Checkout.tsx— PassproviderCodeas-is toaddPrecreatedOrderandgetOrderFromCallback.OrderDetails.tsx— Passorder.provider?.iddirectly torefreshOrder.BankDetails.tsx— Passorder.provider?.iddirectly torefreshOrder.useTransakRouting.ts— RemovenormalizeProviderCodeimport and usage at two call sites (redirect handling and external browser callback).unifiedOrderProcessor.ts— Passdata.provider?.iddirectly togetOrderinstead of normalizing first.useTransakRouting.test.ts— Remove thenormalizeProviderCodemock (no longer imported by the hook).unifiedOrderProcessor.test.ts— Update mock provider IDs to use/providers/prefixed format to match real API responses.buildQuoteWithRedirectUrl.ts— FixgetProviderDeeplinkRedirectUrlto strip/providers/prefix before building the deeplink URL. Without this, passing a rawprovider.idlike/providers/moonpaywould produce a doubled path:metamask://on-ramp/providers//providers/moonpay, breaking external browser redirect flows (PayPal, InAppBrowser callbacks).Link to core PR
Depends on: MetaMask/core#8289 (
fix/ramps-3244-addPrecreatedOrder-id-format)References
TRAM-3244
Checklist
Manual testing steps
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes how
providerCodeis passed through quote/checkout/order refresh and polling paths, which can break order creation/lookup if any downstream expects the stripped format. Also switches@metamask/ramps-controllerto a preview build, increasing integration risk.Overview
Removes
normalizeProviderCode()usage across unified ramps flows so mobile now passes provider IDs (often/providers/...) throughBuildQuote,Checkout, nativeBankDetails,OrderDetails,useTransakRouting, andunifiedOrderProcessorwithout pre-processing.Fixes external-browser deeplink redirects by stripping the
/providers/prefix insidegetProviderDeeplinkRedirectUrl, and updates tests to expect prefixed provider IDs. Updates the@metamask/ramps-controllerdependency to a preview version to pick up the corresponding core-side normalization behavior.Written by Cursor Bugbot for commit 7f80d81. This will update automatically on new commits. Configure here.