feat(ramps): open order details immediately after UB2 webview callbacks#29623
feat(ramps): open order details immediately after UB2 webview callbacks#29623amitabh94 wants to merge 13 commits into
Conversation
|
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. |
- 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>
0124e2a to
adb6c97
Compare
…k tests Co-authored-by: Cursor <cursoragent@cursor.com>
Bugbot flagged that wrapping non-Error rejections via `new Error(String(fetchError))` makes `normalizedError.message` truthy for almost any value (e.g., "undefined", "[object Object]", "null"), so the localized fallback was nearly unreachable and users could see those raw strings as the error. Mirror the `handleOnRefresh` guard (`fetchError instanceof Error && fetchError.message`) for the user-facing message while keeping the normalized Error for `Logger.error`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-webview-callback Conflicts resolved in: - app/components/UI/Ramp/Views/Checkout/Checkout.tsx - app/components/UI/Ramp/Views/Checkout/Checkout.test.tsx - app/components/UI/Ramp/hooks/useTransakRouting.ts Reconciled with main's headless buy session changes: when a live headless session is present, Checkout/useTransakRouting still fetch the order in the hook, fire `onOrderCreated`, close the session, and pop out of the ramp stack (skipping `RAMPS_ORDER_DETAILS`). For the regular non-headless path, this branch's behavior wins — leave the WebView immediately and let `OrderDetails` resolve the order from callback params. When a session id is present but the registry has no live session, fall through to the non-headless path rather than the previous toast + reset to keep one post-checkout UI shape.
CI's `format:check` flagged a few long lines added during the merge with main's headless flow. Prettier's --write reflowed the `RAMPS_TRANSACTION_CONFIRMED` event payload and the failure log message. No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e-order-details Conflicts resolved in: - app/components/UI/Ramp/Views/Checkout/Checkout.tsx - app/components/UI/Ramp/Views/Checkout/Checkout.test.tsx - app/components/UI/Ramp/hooks/useTransakRouting.ts - app/components/UI/Ramp/hooks/useTransakRouting.test.ts Reconciled with main's Phase 7 (`feat(ramp): surface headless buy errors as data`): - `Checkout.tsx`: imports `failSession` and adds `failHeadlessCheckout` to forward callback exceptions and WebView HTTP errors to the headless consumer's `onError` callback instead of showing the in-app `ErrorView`. This branch's non-headless path (navigate immediately to `OrderDetails` with callback params) is preserved; the headless branch still fetches the order and fires `onOrderCreated` before pop. - `useTransakRouting.ts`: imports `failSession`, calls it in the headless catch path of `handleNavigationStateChange`, and reintroduces `navigateToOrderProcessingCallback` so the manual bank transfer approval flow can hand a successful headless order to `onOrderCreated` without showing the toast or routing to bank-details. `LimitExceededError` now carries `headlessBuyErrorCode: 'LIMIT_EXCEEDED'` and `details` so the Host can surface limit failures as data; the approved-flow catch rethrows it unchanged. - Tests cover: callback failure → `failSession` (no ErrorView), WebView HTTP error → `failSession`, `LimitExceededError` preservation, manual bank transfer headless success path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-webview-callback Resolve Checkout.tsx: keep headless callback fetch + pop; non-headless resets to Order Details with callback params and closeSourceRef for funnel analytics. Co-authored-by: Cursor <cursoragent@cursor.com>
- Non-headless callback: expect checkout_closed callback_success (order fetch moved to OrderDetails). - Headless: assert callback_error when getOrderFromCallback returns null. Co-authored-by: Cursor <cursoragent@cursor.com>
…ate-order-details-after-webview-callback
…-webview-callback
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c3b4b09. Configure here.
Align non-headless Transak redirect with Checkout: optional cryptocurrency from selected token for OrderDetails toast fallback. Include selectedToken in handleNavigationStateChange deps. Extend tests (symbol mock + headless registry-miss path). Co-authored-by: Cursor <cursoragent@cursor.com>
…-webview-callback
|
@copilot resolve conflicts |
…-webview-callback Co-authored-by: amitabh94 <12572750+amitabh94@users.noreply.github.com>
Head branch was pushed to by a user without write access
Conflicts resolved in commit 517c9b1. The only conflict was in |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes affect the critical checkout completion → order details navigation flow in the ramp stack. The Performance Test Selection: |
|




Description
This PR improves the unified buy (UB2) checkout flow when purchasing via Transak in the WebView: after a successful checkout, the app navigates immediately to Ramps Order Details using callback URL parameters instead of leaving the user on a generic or stale screen.
Order Details now resolves the order from those callback params, surfaces the outcome with a toast, and records metrics so we can observe completion and errors in production.
Motivation: Users should land on a clear, order-specific screen right after Transak completes, with consistent feedback and observability aligned with other ramps flows.
Changelog
CHANGELOG entry: After completing a Transak purchase in unified buy, the app now opens Ramps Order Details with the order resolved from the callback, a confirmation toast, and updated metrics.
Related issues
Fixes: TRAM-3540
Manual testing steps
Screenshots/Recordings
Before
Simulator.Screen.Recording.-.Dev1.-.2026-05-01.at.15.24.41.mov
After
Simulator.Screen.Recording.-.Dev1.-.2026-05-01.at.15.14.26.mov
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Changes the post-checkout callback handling and navigation flow for unified buy (including headless sessions), which could impact order resolution and user routing if callback params are missing or malformed.
Overview
After a successful unified-buy WebView callback,
Checkoutno longer fetches/creates the order itself; it immediatelynavigation.resets toRAMPS_ORDER_DETAILSwithcallbackUrl+providerCode+walletAddress(and optionalcryptocurrency) so the user lands on an order-specific screen right away.OrderDetailsnow resolves the order from these callback params, bails back to Build Quote when the callback cannot be resolved or returns a bailed status, emits status-change metrics viahandleOrderStatusChangedForMetrics, and shows theshowV2OrderToastconfirmation. The Transak WebView routing hook is updated to follow the same “navigate first, resolve in OrderDetails” pattern for non-headless flows, while headless flows continue to fetch+close session+pop without showing toasts.Tests are updated/added to reflect the new responsibility split (navigation params, toast/metrics in
OrderDetails, and more robust error normalization/handling).Reviewed by Cursor Bugbot for commit 517c9b1. Bugbot is set up for automated code reviews on this repo. Configure here.