feat: remove provider ID normalization and update related functionality#9448
Merged
Conversation
…ion and removal of normalizeProviderCode export
The messenger-action-types:check CI step failed because RampsController-method-action-types.ts embeds the getBuyWidgetData method JSDoc, which changed when the providerCode param doc was updated to describe canonical (non-prefixed) provider codes. Regenerated via messenger-action-types --generate.
1bf463e to
d67a44d
Compare
wenfix
previously approved these changes
Jul 10, 2026
wenfix
previously approved these changes
Jul 10, 2026
…efix-providers # Conflicts: # packages/ramps-controller/CHANGELOG.md
wenfix
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
@metamask/ramps-controllernormalized provider IDs by stripping a/providers/prefix through anormalizeProviderCodehelper. This normalization was applied in two places: across thegetQuotesscope-aware selection logic (matching the providers list, each quote'sprovider, custom-action provider IDs, and the sort-order IDs) and when building a precreated stub order, where the provider code was re-wrapped as/providers/<code>. The Ramps backend now returns canonical, non-prefixed provider IDs, so this normalization is unnecessary and inconsistent with the new contract.This PR removes provider-ID normalization entirely so IDs are compared and stored as-is (canonical). Concretely: the
normalizeProviderCodefunction and its public export are removed; the sixnormalizeProviderCode(...)call sites in thegetQuotesselection logic are dropped so the map keys and lookups use the raw provider IDs; and a precreated stub order'sprovider.idis now the canonical provider code passed to the create-order call rather than a/providers/-prefixed value. The dedicatednormalizeProviderCodeunit test is removed and the stub-order test now expects the canonicalpaypalID.One detail worth calling out for reviewers: the six removed call sites were added recently in #9353 (scope-aware in-app provider widening). Because normalization is removed uniformly from both sides of every map key and lookup, matching behavior is preserved for consistently-formatted IDs, and the existing
getQuotestests continue to pass unchanged (308 tests green).This is a breaking change:
normalizeProviderCodeis no longer exported, and the precreated stub order'sprovider.idchanges shape from/providers/<code>to<code>. Consumers must supply non-prefixed (canonical) provider IDs. The mobile consumer PR removes allnormalizeProviderCodeusages and the app-side normalization to adopt this.References
getQuotesnormalization removed here)Checklist
Note
Medium Risk
Breaking API and state shape changes for buy/quote flows; wrong IDs from consumers that still pass
/providers/-prefixed values could break quote selection or order polling until clients migrate.Overview
Breaking change:
@metamask/ramps-controllerdrops/providers/prefix normalization so provider IDs are compared and stored as canonical codes (e.g.paypal,transak).The
normalizeProviderCodehelper and its public export are removed. IngetQuotesscope-aware selection, maps and lookups now use rawprovider.id, quoteprovider, custom-actionproviderId, and sort-order IDs with no stripping.addPrecreatedOrdersets stubprovider.idto the passedproviderCodeinstead of/providers/<code>.JSDoc and the changelog document the contract. Tests drop the normalizer suite, expect canonical
paypalon stubs, and add coverage for plain-ID matching in scoped quote selection.Reviewed by Cursor Bugbot for commit e352e4f. Bugbot is set up for automated code reviews on this repo. Configure here.