Skip to content

fix(ramps): Fix addPrecreatedOrder's provider id format for legacy prefixed provider ids#8289

Merged
imyugioh merged 2 commits intomainfrom
fix/ramps-3244-addPrecreatedOrder-id-format
Mar 26, 2026
Merged

fix(ramps): Fix addPrecreatedOrder's provider id format for legacy prefixed provider ids#8289
imyugioh merged 2 commits intomainfrom
fix/ramps-3244-addPrecreatedOrder-id-format

Conversation

@imyugioh
Copy link
Copy Markdown
Contributor

@imyugioh imyugioh commented Mar 24, 2026

Explanation

Fixes addPrecreatedOrder to always store provider.id in the canonical /providers/{code} format, matching the shape returned by API responses.

The previous commit (#8278) moved provider ID normalization into RampsService at URL construction time and stopped normalizing in addPrecreatedOrder. However, this caused the stub order's provider.id to be stored as whatever format the caller passed (e.g. "paypal" instead of "/providers/paypal"). This mismatch breaks downstream equality checks — getOrdersProviders, determinePreferredProvider, and useSortedQuotes all compare provider.id against API-sourced provider lists which use the /providers/ prefix.

Changes:

  1. RampsController.ts — Restore normalizeProviderCode() call in addPrecreatedOrder to strip any incoming prefix, then rebuild in canonical /providers/{normalizedCode} format. This ensures stub orders match the shape of API-fetched orders.

  2. RampsController.test.ts — Update addPrecreatedOrder test expectation back to /providers/paypal.

  3. CHANGELOG.md — Add Fixed entry for the id format correction.

Link to mobile PR

link to: MetaMask/metamask-mobile#27893

References

TRAM-3244
Follows: MetaMask/core#8278

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

Low Risk
Low risk: small, localized change to how addPrecreatedOrder formats provider.id, plus corresponding test and changelog updates.

Overview
Ensures RampsController.addPrecreatedOrder always stores stub orders with a canonical provider.id of /providers/{code} by normalizing any incoming providerCode (with or without the /providers/ prefix).

Updates the related unit test expectation and adds a changelog Fixed entry documenting the provider id normalization for precreated order stubs.

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

@imyugioh imyugioh self-assigned this Mar 24, 2026
@imyugioh imyugioh marked this pull request as ready for review March 24, 2026 21:02
@imyugioh imyugioh requested review from a team as code owners March 24, 2026 21:02
@imyugioh
Copy link
Copy Markdown
Contributor Author

imyugioh commented Mar 24, 2026

@metamaskbot publish-previews

1 similar comment
@imyugioh
Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-previews

@github-actions
Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@5.0.1-preview-2d89a26
@metamask-previews/accounts-controller@37.0.0-preview-2d89a26
@metamask-previews/address-book-controller@7.1.0-preview-2d89a26
@metamask-previews/ai-controllers@0.5.0-preview-2d89a26
@metamask-previews/analytics-controller@1.0.0-preview-2d89a26
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-2d89a26
@metamask-previews/announcement-controller@8.0.0-preview-2d89a26
@metamask-previews/app-metadata-controller@2.0.0-preview-2d89a26
@metamask-previews/approval-controller@9.0.0-preview-2d89a26
@metamask-previews/assets-controller@3.1.0-preview-2d89a26
@metamask-previews/assets-controllers@101.0.1-preview-2d89a26
@metamask-previews/base-controller@9.0.0-preview-2d89a26
@metamask-previews/base-data-service@0.0.0-preview-2d89a26
@metamask-previews/bridge-controller@69.2.1-preview-2d89a26
@metamask-previews/bridge-status-controller@70.0.1-preview-2d89a26
@metamask-previews/build-utils@3.0.4-preview-2d89a26
@metamask-previews/chain-agnostic-permission@1.4.0-preview-2d89a26
@metamask-previews/claims-controller@0.4.3-preview-2d89a26
@metamask-previews/client-controller@1.0.0-preview-2d89a26
@metamask-previews/compliance-controller@1.0.1-preview-2d89a26
@metamask-previews/composable-controller@12.0.0-preview-2d89a26
@metamask-previews/config-registry-controller@0.1.1-preview-2d89a26
@metamask-previews/connectivity-controller@0.1.0-preview-2d89a26
@metamask-previews/controller-utils@11.19.0-preview-2d89a26
@metamask-previews/core-backend@6.2.0-preview-2d89a26
@metamask-previews/delegation-controller@2.0.2-preview-2d89a26
@metamask-previews/earn-controller@11.1.2-preview-2d89a26
@metamask-previews/eip-5792-middleware@3.0.1-preview-2d89a26
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.0-preview-2d89a26
@metamask-previews/eip1193-permission-middleware@1.0.3-preview-2d89a26
@metamask-previews/ens-controller@19.1.0-preview-2d89a26
@metamask-previews/error-reporting-service@3.0.1-preview-2d89a26
@metamask-previews/eth-block-tracker@15.0.1-preview-2d89a26
@metamask-previews/eth-json-rpc-middleware@23.1.0-preview-2d89a26
@metamask-previews/eth-json-rpc-provider@6.0.0-preview-2d89a26
@metamask-previews/foundryup@1.0.1-preview-2d89a26
@metamask-previews/gas-fee-controller@26.1.0-preview-2d89a26
@metamask-previews/gator-permissions-controller@2.1.1-preview-2d89a26
@metamask-previews/geolocation-controller@0.1.1-preview-2d89a26
@metamask-previews/json-rpc-engine@10.2.3-preview-2d89a26
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-2d89a26
@metamask-previews/keyring-controller@25.1.0-preview-2d89a26
@metamask-previews/logging-controller@8.0.0-preview-2d89a26
@metamask-previews/message-manager@14.1.0-preview-2d89a26
@metamask-previews/messenger@0.3.0-preview-2d89a26
@metamask-previews/multichain-account-service@7.1.0-preview-2d89a26
@metamask-previews/multichain-api-middleware@1.2.7-preview-2d89a26
@metamask-previews/multichain-network-controller@3.0.5-preview-2d89a26
@metamask-previews/multichain-transactions-controller@7.0.2-preview-2d89a26
@metamask-previews/name-controller@9.1.0-preview-2d89a26
@metamask-previews/network-controller@30.0.0-preview-2d89a26
@metamask-previews/network-enablement-controller@5.0.0-preview-2d89a26
@metamask-previews/notification-services-controller@23.0.0-preview-2d89a26
@metamask-previews/permission-controller@12.2.1-preview-2d89a26
@metamask-previews/permission-log-controller@5.0.0-preview-2d89a26
@metamask-previews/perps-controller@1.3.0-preview-2d89a26
@metamask-previews/phishing-controller@17.0.0-preview-2d89a26
@metamask-previews/polling-controller@16.0.3-preview-2d89a26
@metamask-previews/preferences-controller@23.0.0-preview-2d89a26
@metamask-previews/profile-metrics-controller@3.1.1-preview-2d89a26
@metamask-previews/profile-sync-controller@28.0.0-preview-2d89a26
@metamask-previews/ramps-controller@12.0.1-preview-2d89a26
@metamask-previews/rate-limit-controller@7.0.0-preview-2d89a26
@metamask-previews/react-data-query@0.0.0-preview-2d89a26
@metamask-previews/remote-feature-flag-controller@4.1.0-preview-2d89a26
@metamask-previews/sample-controllers@4.0.3-preview-2d89a26
@metamask-previews/seedless-onboarding-controller@9.0.0-preview-2d89a26
@metamask-previews/selected-network-controller@26.0.3-preview-2d89a26
@metamask-previews/shield-controller@5.0.2-preview-2d89a26
@metamask-previews/signature-controller@39.1.0-preview-2d89a26
@metamask-previews/storage-service@1.0.0-preview-2d89a26
@metamask-previews/subscription-controller@6.0.2-preview-2d89a26
@metamask-previews/transaction-controller@63.1.0-preview-2d89a26
@metamask-previews/transaction-pay-controller@18.1.0-preview-2d89a26
@metamask-previews/user-operation-controller@41.1.0-preview-2d89a26

@imyugioh imyugioh force-pushed the fix/ramps-3244-addPrecreatedOrder-id-format branch from 2d89a26 to 934834c Compare March 26, 2026 05:05
@imyugioh imyugioh added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 889b955 Mar 26, 2026
326 checks passed
@imyugioh imyugioh deleted the fix/ramps-3244-addPrecreatedOrder-id-format branch March 26, 2026 13:14
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.

2 participants