Skip to content

fix(ramps): UB2 orderType analytics, callback purchase metrics, always-on UB2#29628

Closed
amitabh94 wants to merge 3 commits intomainfrom
fix/tram-3534-ub2-ramps-analytics
Closed

fix(ramps): UB2 orderType analytics, callback purchase metrics, always-on UB2#29628
amitabh94 wants to merge 3 commits intomainfrom
fix/tram-3534-ub2-ramps-analytics

Conversation

@amitabh94
Copy link
Copy Markdown
Contributor

Summary

  • TRAM-3534: Fix UB2 buy completions firing off-ramp purchase MetaMetrics events when orderType from the V2 API/controller stub is not exactly BUY (e.g. lowercase buy). Normalizes order type for FiatOrder mapping and uses consistent buy/sell detection in controller + getRampsV2AnalyticsPayload.
  • Aggregator types: OFFRAMP_PURCHASE_FAILED payload type corrected to OffRampPurchaseFailed.
  • Callback → order details: After WebView callback, OrderDetails calls existing handleOrderStatusChangedForMetrics when the merged order status changes (reuses ONRAMP_PURCHASE_COMPLETED / failed / cancelled analytics instead of bespoke checkout events).
  • UB2 always on: Removes unified buy v1/v2 feature-flag selectors and related gating across UI, deeplinks, tests, and fixtures (per ongoing UB2 rollout).

Jira

https://consensyssoftware.atlassian.net/browse/TRAM-3534

Testing

Focused Jest (examples run locally):

yarn jest app/util/ramps/normalizeRampsOrderTypeForFiatOrder.test.ts \
  app/core/Engine/controllers/ramps-controller/event-handlers/analytics.test.ts \
  app/components/UI/Ramp/utils/getRampsV2AnalyticsPayload.test.ts \
  app/components/UI/Ramp/orderProcessor/unifiedOrderProcessor.test.ts \
  app/components/UI/Ramp/Views/OrderDetails/OrderDetails.test.tsx

Risk

Analytics and navigation/FF surface area is large; reviewers should confirm UB2 “always on” matches product intent for this branch.

amitabh94 and others added 3 commits April 29, 2026 16:10
Install preview build via npm alias so imports stay @metamask/ramps-controller.

Related: MetaMask/core#8574 (dev ramps API).
Made-with: Cursor
- Views/Checkout: reset to RampsOrderDetails with callbackUrl + provider
  params instead of awaiting getOrderFromCallback in the WebView sheet.
- useTransakRouting: same pattern for Transak payment webview redirects
  (delegate fetch to OrderDetails).
- OrderDetails: show V2 order toast after callback fetch; optional
  cryptocurrency route param for toast fallback; status metrics on
  callback resolution.
- rampsNavigation: document optional cryptocurrency on order details params.

Tests: Checkout, OrderDetails, useTransakRouting.
Co-authored-by: Cursor <cursoragent@cursor.com>
…s-on UB2

- TRAM-3534: normalize V2 orderType (buy/BUY) for on-ramp vs off-ramp events
- Reuse handleOrderStatusChangedForMetrics after WebView callback addOrder
- OFFRAMP_PURCHASE_FAILED typed as OffRampPurchaseFailed in Aggregator analytics
- Remove unified buy v1/v2 feature-flag selectors and gate UB2 in UI/tests

Refs: https://consensyssoftware.atlassian.net/browse/TRAM-3534
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

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.

@metamaskbotv2 metamaskbotv2 Bot added the team-money-movement issues related to Money Movement features label May 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • 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

sonarqubecloud Bot commented May 1, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
58.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@amitabh94
Copy link
Copy Markdown
Contributor Author

Closing: superseded by analytics-only draft #29629 (this PR mixed unrelated UB2 / flag / navigation changes).

@amitabh94 amitabh94 closed this May 1, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-XL team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant