Skip to content

fix(add-money): remove the duplicate method selection, not the method screen (TASK-20033)#2476

Merged
kushagrasarathe merged 3 commits into
devfrom
fix/add-money-single-method-selection
Jul 23, 2026
Merged

fix(add-money): remove the duplicate method selection, not the method screen (TASK-20033)#2476
kushagrasarathe merged 3 commits into
devfrom
fix/add-money-single-method-selection

Conversation

@kushagrasarathe

@kushagrasarathe kushagrasarathe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The add-money flow asked users to choose "Bank or Crypto" twice — once on a standalone method screen, then again on the per-country screen after they'd already picked a country (TASK-20033).

Approach: keep the up-front method screen, remove the redundant second one. The user picks Bank / Crypto once (bank is clearly visible), and after choosing Bank + a country we go straight to that country's deposit screen instead of showing a second "From Bank / From Crypto" list:

  • AR / BR/add-money/<country>/manteca (the Manteca screen surfaces Pix / Mercado Pago itself)
  • Other bank-supported countries (US, MX, SEPA) → /add-money/<country>/bank
  • Coming-soon countries (bank not enabled — ~196 of 244) → keep the per-country screen, which is still useful there: it shows the "coming soon" bank state and the crypto fallback.

Every add-method for a given country already converged on one of those two deposit screens, so the per-country list was pure repetition wherever bank is live.

Why not the first attempt (Option A)

An earlier commit deleted the method screen and made /add-money land directly on the country list. It removed the wrong screen — users could no longer tell that a bank option existed (the country list gave no method context). Reverted; this PR keeps the method screen and instead collapses the second one.

Changes

  • add-money/page.tsxhandleCountryClick routes bank-supported countries straight to their deposit screen (Manteca/Bridge), and keeps the per-country screen only for coming-soon countries. Also fixed the mount-only useEffect deps (clears stale onramp state on back-nav to the root; resetOnrampFlow is a stable useCallback).
  • Tests — three routing cases (Manteca → /manteca, Bridge → /bank, coming-soon → per-country screen).

Diff is intentionally tiny — the method screen, the offramp card, and the per-country component are all unchanged from dev.

Risk

Low, FE-only, no backend/contract change. Blast radius = the country-tap handler on the add-money bank path. Coming-soon countries are unchanged (still see the per-country screen). Native (?country=/view=) routing preserved via rewriteMethodPath.

QA (sandbox)

  1. /add-money → Bank / Crypto method screen (bank clearly visible).
  2. Bank → pick Germany → lands directly on the bank amount screen (no second "From Bank"). Method chosen once.
  3. Bank → pick Argentina/Brazil → lands directly on the Manteca deposit (Pix/Mercado Pago shown there).
  4. Bank → pick a coming-soon country (e.g. Chad) → per-country screen still shows "From Bank → Soon" + crypto (no regression).
  5. Crypto → network drawer → /add-money/crypto?network=….

Summary by CodeRabbit

  • New Features

    • Added country-specific routing for Add Money:
      • Supported countries open the Manteca deposit flow.
      • Bridge-supported countries open the bank deposit flow.
      • Other countries continue to open their country-specific page.
  • Bug Fixes

    • Reset stale onramp state when returning to the country-selection screen.

The add-money flow asked "Bank or Crypto" twice — once on a standalone
method screen, then again on the per-country screen after picking a
country. Customers reported this as buggy/confusing (TASK-20033).

Collapse the redundant first screen: /add-money now lands directly on the
country list (with a crypto shortcut + the offramp-migrate entry), and the
country-aware per-country screen remains the single place the method is
chosen. The per-country screen already knows each country's real methods
and coming-soon states, so no country regresses.
@notion-workspace

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 372278ef-6307-4489-bbb3-ede05c7c7818

📥 Commits

Reviewing files that changed from the base of the PR and between 62c5bcc and 3e0519f.

📒 Files selected for processing (2)
  • src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
  • src/app/(mobile-ui)/add-money/page.tsx

📝 Walkthrough

Walkthrough

Changes

Add Money country routing

Layer / File(s) Summary
Country routing and flow reset
src/app/(mobile-ui)/add-money/page.tsx
Country selection routes Manteca-supported countries to the Manteca flow, Bridge-supported countries to the bank flow, and other countries to their generic route. Onramp state resets when the country query changes.
Country routing tests
src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
State-matrix coverage verifies Argentina, Germany, and Chad route to their expected destinations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CountryList
  participant AddMoneyPage
  participant Router
  CountryList->>AddMoneyPage: select country
  AddMoneyPage->>Router: navigate to provider or country route
  Router-->>AddMoneyPage: update country query
  AddMoneyPage->>AddMoneyPage: reset onramp state
Loading

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: hugo0, jjramirezn

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the add-money flow change and specifically captures preserving the method screen while removing the redundant second selection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/add-money-single-method-selection

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands.

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment Jul 23, 2026 7:23am

Request Review

@kushagrasarathe

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 6233.75 → 6235.79 (+2.04)
Findings: +1 net (+6 new, -5 resolved)

🆕 New findings (6)

  • high hotspot — src/components/AddWithdraw/AddWithdrawCountriesList.tsx — 44 commits, +709/-523 lines since 6 months ago
  • medium high-mdd — src/app/(mobile-ui)/add-money/page.tsx:24 — AddMoneyPage: MDD 33.5 (uses across many lines from declarations)
  • medium complexity — src/app/(mobile-ui)/add-money/page.tsx — CC 22, MI 61.26, SLOC 78
  • low high-dlt — src/app/(mobile-ui)/add-money/page.tsx:24 — AddMoneyPage: DLT 19 (calls 19 distinct functions — high context load)
  • low high-mdd — src/app/(mobile-ui)/add-money/page.tsx:71 — handleCountryClick: MDD 11.0 (uses across many lines from declarations)
  • low missing-return-type — src/app/(mobile-ui)/add-money/page.tsx:24 — AddMoneyPage: exported fn missing return type annotation

✅ Resolved (5)

  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx — 42 commits, +705/-519 lines since 6 months ago
  • src/app/(mobile-ui)/add-money/page.tsx:22 — AddMoneyPage: MDD 25.3 (uses across many lines from declarations)
  • src/app/(mobile-ui)/add-money/page.tsx — CC 20, MI 63.53, SLOC 68
  • src/app/(mobile-ui)/add-money/page.tsx:22 — AddMoneyPage: DLT 16 (calls 16 distinct functions — high context load)
  • src/app/(mobile-ui)/add-money/page.tsx:22 — AddMoneyPage: exported fn missing return type annotation

📈 Painscore deltas (top movers)

File Before After Δ
src/app/(mobile-ui)/add-money/page.tsx 7.3 8.6 +1.2

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 2014 ran, 0 failed, 0 skipped, 33.2s

📊 Coverage (unit)

metric %
statements 59.8%
branches 43.5%
functions 48.8%
lines 60.1%
⏱ 10 slowest test cases
time test
3.6s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › never places two stickers in heavy overlap (broad seed sweep)
1.0s src/utils/__tests__/demo-api.test.ts › isDemoMode() is false when not running under Capacitor
0.5s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every sticker stays within canvas at any count
0.4s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in validateInviteCode
0.3s src/app/(mobile-ui)/withdraw/__tests__/withdraw-states.test.tsx › Bank withdrawal keeps the $1 minimum for sub-$1 amounts
0.3s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in validateInviteCode body
0.2s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › keeps stickers off the username pill (final pass respects the keep-out)
0.1s src/utils/__tests__/demo-balance.test.ts › starts at the full balance on a fresh install and stamps a timestamp
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid 9-digit US account
0.1s src/utils/__tests__/demo-balance.test.ts › keeps a spent-down balance across a cold start within the TTL
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/`(mobile-ui)/add-money/page.tsx:
- Around line 41-43: Update the useEffect in the add-money page to depend on
countryFromQuery and resetOnrampFlow, so it reruns when the query country or
reset callback changes and clears stale onramp state when countryFromQuery is
absent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 98ee814e-b478-4405-9fb7-a4dcee0a0b57

📥 Commits

Reviewing files that changed from the base of the PR and between 74f02f5 and 62c5bcc.

📒 Files selected for processing (4)
  • src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
  • src/app/(mobile-ui)/add-money/page.tsx
  • src/components/AddMoney/views/AddMoneyMethodSelection.view.tsx
  • src/components/Invites/campaign-maps.ts
💤 Files with no reviewable changes (1)
  • src/components/AddMoney/views/AddMoneyMethodSelection.view.tsx

Comment thread src/app/(mobile-ui)/add-money/page.tsx Outdated
…parity

- useEffect now depends on countryFromQuery + (stable) resetOnrampFlow, so
  stale onramp state is cleared on native back-nav to the root, not only on
  mount (CodeRabbit + code-review). Also clears the exhaustive-deps warning.
- drop the unreachable countryFromQuery branch in handleBack (the ?country
  sub-views early-return their own NavHeader).
- fire DEPOSIT_METHOD_SELECTED{method_type:'crypto'} on network select so
  root crypto deposits match the bank event in the deposit-method funnel.
- AddWithdrawCountriesList add-flow back-nav → '/add-money' (drop the now-dead
  ?method=bank param).
- cover the offramp-badge landing card (present with badge, absent without).
Switch from Option A (which deleted the Bank/Crypto method screen and left an
ambiguous country list — users couldn't tell bank was an option) to Option B:

- Keep the up-front Bank/Crypto method screen (bank is clearly visible).
- After the user picks Bank + a country, go STRAIGHT to that country's deposit
  screen instead of showing a second "From Bank / From Crypto" list:
    - AR/BR  -> /add-money/<country>/manteca (Manteca surfaces Pix/Mercado Pago)
    - other bank-supported countries -> /add-money/<country>/bank
  Every add method for a given country converges on one of these two screens
  anyway, so the per-country list was pure repetition where bank is live.
- Coming-soon countries (bank not enabled) keep the per-country screen — there
  it's still useful: it shows the "soon" bank state and the crypto fallback.

Net effect: the user clicks "bank" once, up front; the duplicate second
selection is gone. This reverts the Option A page/view/test churn — the diff is
now just handleCountryClick routing (+ effect-deps cleanup) and its tests.
@kushagrasarathe kushagrasarathe changed the title fix(add-money): choose deposit method once, not twice (TASK-20033) fix(add-money): remove the duplicate method selection, not the method screen (TASK-20033) Jul 23, 2026

@innolope-dev innolope-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff looks solid — the Manteca/Bridge/coming-soon routing is correct and covered by tests. Checked COUNTRY_SPECIFIC_METHODS: no country currently has two live bank options, so skipping straight to bank/manteca once "Bank" is chosen doesn't hide a real choice anywhere.

One thing worth a fix: the PR description's QA step 2 ("Tap a bank-enabled country (e.g. Germany) → per-country methods → bank flow") is now stale relative to this diff — Germany (and other Bridge-supported countries) now route straight to /add-money/germany/bank, skipping the per-country method screen entirely, per the diff's own test (selecting a Bridge-supported country goes straight to the bank deposit). Worth updating the description so it matches actual behavior for the next reader.

Heads up: this touches the same two files (page.tsx, add-money-states.test.tsx) as my open #2447 — no conflict yet since neither's merged, but whichever lands second will need a quick rebase.

Also, the eslint check failure looks like stale-cache noise rather than a real issue — I linted the [country]/bank/page.tsx errors it's flagging directly against this PR's head commit and got 0 errors, 1 unrelated warning. Wouldn't block on it.

Approving — logic and tests look right.

@kushagrasarathe

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kushagrasarathe
kushagrasarathe merged commit ba9a051 into dev Jul 23, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants