Commit 27d3f35
committed
chore(runway): cherry-pick fix(ramps): improve external-browser callback redirection cp-7.71.0 (#27804)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
Fixes the external-browser return flow for unified ramps by moving
callback resolution out of Build Quote and into Order Details.
The bug was that external-browser returns were resolved too early in
BuildQuote. If callback parsing or order lookup failed there, users
could get bounced around or end up on a broken Order Details screen.
This change fixes that by moving callback resolution into Order Details
itself. BuildQuote now only hands off the callback context, and Order
Details fetches the real order itself. That makes the flow more
reliable: bailed callbacks return to Build Quote, and real fetch
failures show a retryable error instead of a broken redirect.
**What changed**
- **Build Quote -> Order Details callback handoff**
After a successful external-browser return, Build Quote now navigates to
Order Details with the full `callbackUrl`, `providerCode`, and
`walletAddress` instead of trying to resolve the order immediately.
- **Order Details callback bootstrap**
Order Details now supports loading from callback params, fetching the
real order on first render, and updating route params once the order has
been resolved.
- **Bailed / invalid callback handling**
If the callback resolves to a bailed order state or no usable order, the
user is sent back to Build Quote instead of landing on a blank or broken
Order Details screen.
- **Retryable callback error state**
If fetching the order from the callback URL fails, Order Details now
shows a retryable error screen rather than silently resetting away. This
makes transient backend/network failures recoverable.
- **Navigation tests updated**
Tests were updated to reflect the callback-based route shape and the new
Order Details retry behavior.
**What stays untouched**
This PR does not change Order Content amount rendering, list display
formatting, or duplicate placeholder cleanup. It is scoped only to
fixing the external-browser redirection and callback-resolution path.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
Paypal Order going to build quote page first:
Uploading Screen Recording 2026-03-23 at 1.00.39 PM.mov…
### **After**
<!-- [screenshots/recordings] -->
Native Transak Redirection
https://github.com/user-attachments/assets/32d1a7f9-23c7-4df1-aba8-f639338d7a6f
Bailed Paypal order (return to build quote page):
https://github.com/user-attachments/assets/8ed07fa3-e7df-4b69-b2f0-9318799c8249
Paypal order going to order details page:
https://github.com/user-attachments/assets/5a2e8489-a4b0-488d-8aca-7982df63c45c
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes the unified ramps external-browser return flow and navigation
params, which can impact users reaching the correct order state after
checkout; failures may surface as new retry/error behaviors.
>
> **Overview**
> Fixes unified ramps external-browser return handling by **moving
callback URL resolution out of `BuildQuote` and into `OrderDetails`**.
>
> `BuildQuote` no longer calls `getOrderFromCallback`/`addOrder` on
InAppBrowser success; it now resets navigation to `OrderDetails` with
`callbackUrl`, `providerCode`, and `walletAddress`. `OrderDetails`
bootstraps from these callback params, fetches the real order (bailing
back to `BuildQuote` for invalid/bailed statuses), updates route params
to the resolved `orderId`, and shows a retryable error state if the
callback fetch fails.
>
> Updates `rampsNavigation` to support an `OrderDetails` route shaped
around callback params (and makes `orderId` optional), and adjusts/adds
tests to cover the new handoff and retry behavior.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0eabfd6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent b7b8475 commit 27d3f35
6 files changed
Lines changed: 212 additions & 57 deletions
File tree
- app/components/UI/Ramp
- Views
- BuildQuote
- OrderDetails
- utils
Lines changed: 6 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | 479 | | |
486 | 480 | | |
487 | 481 | | |
| |||
497 | 491 | | |
498 | 492 | | |
499 | 493 | | |
500 | | - | |
| 494 | + | |
| 495 | + | |
501 | 496 | | |
502 | 497 | | |
503 | 498 | | |
504 | 499 | | |
505 | 500 | | |
506 | 501 | | |
507 | | - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
508 | 506 | | |
509 | 507 | | |
510 | 508 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
176 | 175 | | |
177 | 176 | | |
178 | 177 | | |
179 | | - | |
180 | | - | |
181 | 178 | | |
182 | 179 | | |
183 | 180 | | |
| |||
683 | 680 | | |
684 | 681 | | |
685 | 682 | | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
| 683 | + | |
714 | 684 | | |
| 685 | + | |
715 | 686 | | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
716 | 694 | | |
717 | 695 | | |
718 | 696 | | |
| |||
757 | 735 | | |
758 | 736 | | |
759 | 737 | | |
760 | | - | |
761 | | - | |
762 | 738 | | |
763 | 739 | | |
764 | 740 | | |
| |||
Lines changed: 45 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
| |||
52 | 60 | | |
53 | 61 | | |
54 | 62 | | |
55 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
56 | 66 | | |
57 | 67 | | |
58 | 68 | | |
| |||
167 | 177 | | |
168 | 178 | | |
169 | 179 | | |
170 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
171 | 183 | | |
172 | 184 | | |
173 | 185 | | |
| |||
187 | 199 | | |
188 | 200 | | |
189 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
190 | 232 | | |
Lines changed: 112 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
76 | 81 | | |
77 | | - | |
| 82 | + | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
85 | 156 | | |
86 | 157 | | |
87 | 158 | | |
| |||
148 | 219 | | |
149 | 220 | | |
150 | 221 | | |
151 | | - | |
| 222 | + | |
152 | 223 | | |
153 | 224 | | |
154 | 225 | | |
155 | 226 | | |
156 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
157 | 254 | | |
158 | 255 | | |
159 | 256 | | |
| |||
166 | 263 | | |
167 | 264 | | |
168 | 265 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
174 | 270 | | |
175 | 271 | | |
176 | 272 | | |
| |||
198 | 294 | | |
199 | 295 | | |
200 | 296 | | |
201 | | - | |
| 297 | + | |
202 | 298 | | |
203 | 299 | | |
204 | 300 | | |
205 | 301 | | |
206 | 302 | | |
207 | 303 | | |
208 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
209 | 309 | | |
210 | 310 | | |
211 | 311 | | |
| |||
0 commit comments