fix(add-money): bounce Manteca countries off the Bridge bank page (no EUR)#2502
Conversation
… EUR) Brazil/Argentina deposit via their own PIX/Mercado Pago (Manteca) flow, but the Bridge SEPA bank page derives its currency from getCurrencyConfig, which has no BR/AR branch and falls through to EUR. A KYC-success redirect or a deep link can still land a Manteca country on /add-money/[country]/bank, showing the amount in euros with no way forward (TASK-20225). Guard the page at the single chokepoint: redirect any Manteca country to its /manteca route, render loading meanwhile so the EUR UI never flashes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Code-analysis diffPainscore total: 6231.08 → 6231.14 (+0.06) 🆕 New findings (16)
✅ Resolved (16)
|
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe bank page redirects Brazil and Argentina deposits to the native Manteca route and shows a loading state during navigation. Tests verify the redirect and confirm Mexico continues using the Bridge bank flow. ChangesManteca routing
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant User
participant BankPage
participant Router
participant MantecaRoute
User->>BankPage: Open bank route for BR/AR
BankPage->>Router: replace(rewriteMethodPath(...))
Router->>MantecaRoute: Navigate to native deposit route
BankPage-->>User: Render PeanutLoading during redirect
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx (1)
1374-1383: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover Argentina in this regression test.
The production requirement includes Brazil and Argentina, but this test exercises only Brazil. Parameterize it for
brazilandargentinaso both Manteca routes are protected.🤖 Prompt for 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. In `@src/app/`(mobile-ui)/add-money/__tests__/add-money-states.test.tsx around lines 1374 - 1383, Parameterize the regression test around the Manteca country redirect to run for both “brazil” and “argentina”. For each case, set the country, render OnrampBankPage, and assert replacement to the matching /add-money/{country}/manteca route while preserving the existing EUR UI and loading-state assertions.
🤖 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.
Nitpick comments:
In `@src/app/`(mobile-ui)/add-money/__tests__/add-money-states.test.tsx:
- Around line 1374-1383: Parameterize the regression test around the Manteca
country redirect to run for both “brazil” and “argentina”. For each case, set
the country, render OnrampBankPage, and assert replacement to the matching
/add-money/{country}/manteca route while preserving the existing EUR UI and
loading-state assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b7033d24-2edf-4207-82f8-28c690473bc9
📒 Files selected for processing (2)
src/app/(mobile-ui)/add-money/[country]/bank/page.tsxsrc/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
|
Good catch — parameterized the regression test to cover both |
…atcher Use isMantecaSupportedCountryCode(id) like add-money/page.tsx instead of isMantecaCountry(path). Both routing sites now read the same source (MANTECA_SUPPORTED_EXCHANGES), so adding a Manteca country can't leave the guard and dispatcher disagreeing and silently re-exposing the EUR bug.
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx (1)
1374-1387: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a non-Manteca control case.
This covers the Brazil/Argentina redirect, but not the contract that other countries remain on the Bridge flow. Add a case such as Mexico that asserts no route replacement occurs and the Bridge amount UI remains visible.
🤖 Prompt for 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. In `@src/app/`(mobile-ui)/add-money/__tests__/add-money-states.test.tsx around lines 1374 - 1387, Add a Mexico control test alongside the existing Brazil/Argentina cases, using the same OnrampBankPage render setup, and assert mockRouterReplace is not called while the “How much do you want to add?” Bridge UI remains visible.
🤖 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.
Nitpick comments:
In `@src/app/`(mobile-ui)/add-money/__tests__/add-money-states.test.tsx:
- Around line 1374-1387: Add a Mexico control test alongside the existing
Brazil/Argentina cases, using the same OnrampBankPage render setup, and assert
mockRouterReplace is not called while the “How much do you want to add?” Bridge
UI remains visible.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bdb1ca91-56b5-4530-99a3-842e82eb5cc6
📒 Files selected for processing (2)
src/app/(mobile-ui)/add-money/[country]/bank/page.tsxsrc/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
|
Added a Mexico control case asserting a non-Manteca country stays on the Bridge amount UI with no route replacement — locks the contract that the guard doesn't over-fire. Suite now 53 green. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx (1)
1374-1384: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the Capacitor rewrite path as well.
These assertions verify
/add-money/${country}/manteca, but production passes the target throughrewriteMethodPath, which produces/add-money?country=${country}&view=mantecaon Capacitor. Add a native-mode case or confirm that an existingrewriteMethodPathtest covers Brazil and Argentina.🤖 Prompt for 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. In `@src/app/`(mobile-ui)/add-money/__tests__/add-money-states.test.tsx around lines 1374 - 1384, Extend the Manteca redirect tests for both Brazil and Argentina to cover Capacitor/native mode, asserting mockRouterReplace receives the rewriteMethodPath result `/add-money?country=${country}&view=manteca`. Reuse the existing assertions that the Bridge SEPA UI does not render, or verify equivalent coverage in an existing rewriteMethodPath test if one already covers both countries.
🤖 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/[country]/bank/page.tsx:
- Around line 114-127: The Bridge page’s initial-step and showDetails URL-state
effects must not run for Manteca countries. Update those effects to guard their
existing URL rewrites with !isMantecaRoute, using the isMantecaRoute predicate
and redirect flow near the bank page’s router setup; preserve their current
behavior for non-Manteca routes.
---
Nitpick comments:
In `@src/app/`(mobile-ui)/add-money/__tests__/add-money-states.test.tsx:
- Around line 1374-1384: Extend the Manteca redirect tests for both Brazil and
Argentina to cover Capacitor/native mode, asserting mockRouterReplace receives
the rewriteMethodPath result `/add-money?country=${country}&view=manteca`. Reuse
the existing assertions that the Bridge SEPA UI does not render, or verify
equivalent coverage in an existing rewriteMethodPath test if one already covers
both countries.
🪄 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: e0bc8f18-63d9-4424-82cb-7f5be32d2dc6
📒 Files selected for processing (2)
src/app/(mobile-ui)/add-money/[country]/bank/page.tsxsrc/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
…inside the Bridge page Move the BR/AR redirect into the default-export wrapper so BridgeBankOnrampPage never mounts for a Manteca country — none of its data hooks or URL-state effects run during the redirect (addresses CodeRabbit + code-review: Bridge effects could rewrite the bank URL mid-redirect for a Manteca deep link).
|
Addressed both:
|
|
@coderabbitai full review |
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 2 minutes. |
Summary
Brazil & Argentina are Manteca-only deposit markets — they add money through their own PIX / Mercado Pago flow (
/add-money/[country]/manteca). The Bridge SEPA bank page (/add-money/[country]/bank) derives its displayed currency fromgetCurrencyConfig, which only branches on US/MX/GB and falls through toEUR/SEPAfor everything else — including BR/AR. So any Manteca country that lands on the bank page renders the amount in euros with no way to proceed.This is exactly what a user hit (TASK-20225 / Crisp): verified with non-Brazilian docs, picked Brazil → PIX, and the amount screen showed EUR and wouldn't advance. The in-app Manteca amount screen was already fixed to default to BRL (Jul 2), but the bank page remained a live EUR entry point — reachable via the
onKycSuccessredirect (AddWithdrawCountriesListpushes/add-money/${slug}/bankforflow === 'add') and via deep/shared links.Fix: guard at the route entry. The default export is now a thin wrapper that resolves the country and, if it's a Manteca country,
router.replaces to the/mantecaroute and renders loading — so the Bridge page component (BridgeBankOnrampPage) never mounts for BR/AR. One chokepoint covers every entry path (KYC redirect, deep link, direct URL), and none of the Bridge page's data hooks or URL-state effects run during the redirect.Risk
Low, FE-only. Blast radius is the one route; non-Manteca countries (US/MX/GB/EU) render
BridgeBankOnrampPageexactly as before. The Manteca predicate (isMantecaSupportedCountryCode) is the same one the root dispatcher (add-money/page.tsx) already routes with, so the guard and dispatcher read one source of truth (MANTECA_SUPPORTED_EXCHANGES) and can't disagree.QA
/add-money/brazil/bankand/add-money/argentina/bank→ redirect to/add-money/<country>/manteca, no EUR shown./add-money/germany/bank,/add-money/usa/bank,/add-money/mexico/bank→ unchanged (correct currency, Bridge flow).add-money-statessuite (53) green — Brazil + Argentina redirect cases, a Mexico non-Manteca control (stays on Bridge UI, no redirect); Capacitor rewrite covered bynative-routes.test.ts.Design notes
/bank. Also means the Bridge page's effects never fire for a Manteca deep link (raised in review).getCurrencyConfigstill has no BR/AR branch (correct — BR/AR are Manteca rails, not Bridge, so they should never reach it); the/add-money/<path>/mantecaroute string is built in a few places and could fold into amantecaMethodUrl()helper.