Skip to content

feat(kyc): honest UK-resident block on Bridge bank flows (TASK-20729)#2457

Open
kushagrasarathe wants to merge 2 commits into
devfrom
feat/block-uk-residents
Open

feat(kyc): honest UK-resident block on Bridge bank flows (TASK-20729)#2457
kushagrasarathe wants to merge 2 commits into
devfrom
feat/block-uk-residents

Conversation

@kushagrasarathe

@kushagrasarathe kushagrasarathe commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Surface the UK-resident block honestly on the Bridge bank deposit/withdraw flows. The backend (peanut-api-ts PR, TASK-20729) now marks every Bridge rail blocked for UK residents with reason.code = 'uk_resident_blocked'. Without this, the FE would show the generic "We couldn't unlock this / contact support" (ID-failure) framing — wrong and misleading for a regulatory block.

  • InitiateKycModal gains a region-unavailable variant — title "Not available in the UK", regulatory copy, a single "Got it" dismiss (no verify, no contact-support).
  • add-money/[country]/bank + withdraw/[country]/bank pick that variant when gate.reason?.code === 'uk_resident_blocked'.
  • The card block rides on the existing eligibility machinery (BE denylist → info.ts returns not-eligible for GB, same path as other prohibited countries).

Risks / breaking changes

  • Cross-repo: depends on the peanut-api-ts PR emitting uk_resident_blocked. Until BE ships, this variant simply never triggers (no regression). BE-first deploy is safe.
  • Presentational only — no capability logic changed on the FE.

QA

  • add-money-states + withdraw-states suites pass with the change.
  • Typecheck clean for touched files (only pre-existing @capacitor/* native-module resolution noise in the worktree).
  • Manual: as a UK-resident (Bridge bridge_geo=GB), add-money → bank and withdraw → bank show "Not available in the UK" instead of a KYC/contact-support modal; non-UK users unaffected.
image Screenshot 2026-07-21 at 2 54 31 PM

Backend now marks every Bridge rail blocked for UK residents with reason
code 'uk_resident_blocked'. Surface it honestly instead of the generic
'we couldn't unlock this / contact support' (ID-failure) framing:

- InitiateKycModal gains a 'region-unavailable' variant — 'Not available
  in the UK', regulatory copy, single 'Got it' dismiss (no verify, no
  contact-support)
- add-money + withdraw bank pages pick that variant when the gate's reason
  is uk_resident_blocked

Card block rides on the existing eligibility machinery (BE denylist).
@notion-workspace

Copy link
Copy Markdown

block uk

@vercel

vercel Bot commented Jul 20, 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 21, 2026 11:24am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 56aa602d-f081-4aba-bd64-7d52999ec382

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/block-uk-residents

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

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 6233.95 → 6236.16 (+2.21)
Findings: +2 net (+22 new, -20 resolved)

🆕 New findings (22)

  • critical complexity — src/components/AddWithdraw/AddWithdrawCountriesList.tsx — CC 125, MI 56.8, SLOC 351
  • critical complexity — src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx — CC 103, MI 54.38, SLOC 352
  • critical complexity — src/app/(mobile-ui)/add-money/[country]/bank/page.tsx — CC 98, MI 57.44, SLOC 347
  • high hotspot — src/app/(mobile-ui)/add-money/[country]/bank/page.tsx — 54 commits, +529/-449 lines since 6 months ago
  • high hotspot — src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx — 50 commits, +523/-234 lines since 6 months ago
  • high complexity — src/components/Kyc/InitiateKycModal.tsx — CC 46, MI 55.73, SLOC 84
  • high hotspot — src/components/AddWithdraw/AddWithdrawCountriesList.tsx — 45 commits, +787/-533 lines since 6 months ago
  • high method-complexity — src/app/(mobile-ui)/add-money/[country]/bank/page.tsx:52 — OnrampBankPage CC 31 SLOC 164
  • high method-complexity — src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx:63 — WithdrawBankPage CC 30 SLOC 131
  • medium react-long-component — src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx:63 — WithdrawBankPage is 552 lines — split it
  • medium react-long-component — src/app/(mobile-ui)/add-money/[country]/bank/page.tsx:52 — OnrampBankPage is 486 lines — split it
  • medium high-mdd — src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx:63 — WithdrawBankPage: MDD 168.8 (uses across many lines from declarations)
  • medium high-mdd — src/app/(mobile-ui)/add-money/[country]/bank/page.tsx:52 — OnrampBankPage: MDD 149.7 (uses across many lines from declarations)
  • medium high-mdd — src/components/AddWithdraw/AddWithdrawCountriesList.tsx:45 — AddWithdrawCountriesList: MDD 146.0 (uses across many lines from declarations)
  • medium high-mdd — src/components/Kyc/InitiateKycModal.tsx:29 — InitiateKycModal: MDD 48.8 (uses across many lines from declarations)
  • medium high-mdd — src/components/AddWithdraw/AddWithdrawCountriesList.tsx:457 — : MDD 28.5 (uses across many lines from declarations)
  • medium high-mdd — src/components/AddWithdraw/AddWithdrawCountriesList.tsx:448 — renderPaymentMethods: MDD 27.3 (uses across many lines from declarations)
  • medium method-complexity — src/components/AddWithdraw/AddWithdrawCountriesList.tsx:45 — CC 23 SLOC 118
  • low structural-dup — app/(mobile-ui)/add-money/[country]/bank/page.tsx:494 — 18 duplicate lines / 75 tokens with app/(mobile-ui)/withdraw/[country]/bank/page.tsx:586
  • low structural-dup — app/(mobile-ui)/add-money/[country]/bank/page.tsx:500 — 12 duplicate lines / 56 tokens with components/AddWithdraw/AddWithdrawCountriesList.tsx:371

…and 2 more.

✅ Resolved (20)

  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx — CC 123, MI 56.9, SLOC 351
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx — CC 101, MI 54.47, SLOC 352
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx — CC 96, MI 57.55, SLOC 347
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx — 53 commits, +524/-448 lines since 6 months ago
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx — 49 commits, +518/-233 lines since 6 months ago
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx — 44 commits, +782/-532 lines since 6 months ago
  • src/components/Kyc/InitiateKycModal.tsx — CC 39, MI 55.8, SLOC 69
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx:63 — WithdrawBankPage is 548 lines — split it
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx:52 — OnrampBankPage is 482 lines — split it
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx:63 — WithdrawBankPage: MDD 161.9 (uses across many lines from declarations)
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx:52 — OnrampBankPage: MDD 146.3 (uses across many lines from declarations)
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx:45 — AddWithdrawCountriesList: MDD 143.6 (uses across many lines from declarations)
  • src/components/Kyc/InitiateKycModal.tsx:26 — InitiateKycModal: MDD 39.9 (uses across many lines from declarations)
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx:52 — OnrampBankPage CC 29 SLOC 164
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx:453 — : MDD 28.5 (uses across many lines from declarations)
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx:63 — WithdrawBankPage CC 28 SLOC 131
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx:444 — renderPaymentMethods: MDD 27.3 (uses across many lines from declarations)
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx:45 — CC 21 SLOC 118
  • app/(mobile-ui)/add-money/[country]/bank/page.tsx:494 — 14 duplicate lines / 61 tokens with app/(mobile-ui)/withdraw/[country]/bank/page.tsx:586
  • src/components/Kyc/InitiateKycModal.tsx:26 — InitiateKycModal: exported fn missing return type annotation

📈 Painscore deltas (top movers)

File Before After Δ
src/components/Kyc/InitiateKycModal.tsx 8.8 10.4 +1.5

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 2010 ran, 0 failed, 0 skipped, 35.3s

📊 Coverage (unit)

metric %
statements 59.8%
branches 43.4%
functions 48.6%
lines 60.0%
⏱ 10 slowest test cases
time test
3.8s 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/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in validateInviteCode body
0.3s src/app/(mobile-ui)/withdraw/__tests__/withdraw-states.test.tsx › Bank withdrawal keeps the $1 minimum for sub-$1 amounts
0.2s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › keeps stickers off the username pill (final pass respects the keep-out)
0.2s src/utils/__tests__/demo-balance.test.ts › keeps a spent-down balance across a cold start within the TTL
0.2s src/utils/__tests__/demo-balance.test.ts › starts at the full balance on a fresh install and stamps a timestamp
0.2s src/utils/__tests__/demo-balance.test.ts › debits and floors at zero
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@kushagrasarathe
kushagrasarathe marked this pull request as ready for review July 20, 2026 18:32
@kushagrasarathe
kushagrasarathe requested a review from Hugo0 July 20, 2026 18:32
- title 'Not available for UK residents' (conveys residence, not the
  destination country — a UK resident is blocked even withdrawing to SEPA)
- drop the card mention from the bank-flow copy
- CTA 'Withdraw funds' -> /withdraw so users can exit via crypto
- wire the region-unavailable variant into AddWithdrawCountriesList (the
  country-selection modal), not just the add-money/withdraw bank pages
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.

1 participant