fix: disable sepa non euro currency withdrwals and claims#1384
fix: disable sepa non euro currency withdrwals and claims#1384kushagrasarathe merged 2 commits intopeanut-wallet-devfrom
Conversation
kushagrasarathe
commented
Oct 31, 2025
- fixes TASK-16347 : disable sepa non euro currency withdrwals and claims
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdded NON_EUR_SEPA_ALPHA2 and internal isCountryEnabledForBankTransfer; updated AddMoney country processing to disable bank-withdraw for SEPA corridors whose local currency is not EUR and adjusted CountryList to reflect this in the claim-request view. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (5)📓 Common learnings📚 Learning: 2025-08-14T14:42:54.411ZApplied to files:
📚 Learning: 2025-05-22T15:38:48.586ZApplied to files:
📚 Learning: 2025-09-03T12:23:31.845ZApplied to files:
📚 Learning: 2025-08-14T14:36:18.758ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (4)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/AddMoney/consts/index.ts (1)
2553-2555: Consider removing redundant 'US' for clarity.The logic correctly filters out non-EUR SEPA countries from withdrawals. However, 'US' is already included in
Object.values(BRIDGE_ALPHA3_TO_ALPHA2)(from the 'USA': 'US' mapping at line 2530), making the explicit 'US' redundant.Apply this diff to remove the redundancy:
const enabledBankWithdrawCountries = new Set( - [...Object.values(BRIDGE_ALPHA3_TO_ALPHA2), 'US', 'MX', 'AR'].filter((code) => !NON_EUR_SEPA_ALPHA2.has(code)) + [...Object.values(BRIDGE_ALPHA3_TO_ALPHA2), 'MX', 'AR'].filter((code) => !NON_EUR_SEPA_ALPHA2.has(code)) )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/AddMoney/consts/index.ts(1 hunks)src/components/Common/CountryList.tsx(2 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.
Applied to files:
src/components/Common/CountryList.tsxsrc/components/AddMoney/consts/index.ts
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".
Applied to files:
src/components/Common/CountryList.tsxsrc/components/AddMoney/consts/index.ts
📚 Learning: 2025-09-03T12:23:31.845Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1173
File: src/components/Common/SavedAccountsView.tsx:86-87
Timestamp: 2025-09-03T12:23:31.845Z
Learning: In the CountryData interface from src/components/AddMoney/consts, the path field is required (not optional) for all country entries.
Applied to files:
src/components/Common/CountryList.tsx
📚 Learning: 2025-09-03T12:23:31.845Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1173
File: src/components/Common/SavedAccountsView.tsx:86-87
Timestamp: 2025-09-03T12:23:31.845Z
Learning: In the ALL_METHODS_DATA structure from src/components/AddMoney/consts, the path field is required (not optional) for all country entries.
Applied to files:
src/components/Common/CountryList.tsxsrc/components/AddMoney/consts/index.ts
📚 Learning: 2025-09-18T09:30:42.901Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1230
File: src/app/(mobile-ui)/withdraw/page.tsx:92-97
Timestamp: 2025-09-18T09:30:42.901Z
Learning: In src/app/(mobile-ui)/withdraw/page.tsx, the useEffect that calls setShowAllWithdrawMethods(true) when amountFromContext exists is intentionally designed to run only on component mount (empty dependency array), not when amountFromContext changes. This is the correct behavior for the withdraw flow where showing all methods should only happen on initial load when an amount is already present.
Applied to files:
src/components/AddMoney/consts/index.ts
📚 Learning: 2025-08-14T14:36:18.758Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1094
File: src/components/Claim/Link/views/BankFlowManager.view.tsx:0-0
Timestamp: 2025-08-14T14:36:18.758Z
Learning: Bridge API requires ISO3 country codes (3-letter codes like "USA", "GBR") while flag display components need ISO2 codes (2-letter codes like "US", "GB").
Applied to files:
src/components/AddMoney/consts/index.ts
🧬 Code graph analysis (1)
src/components/Common/CountryList.tsx (1)
src/components/AddMoney/consts/index.ts (1)
NON_EUR_SEPA_ALPHA2(2545-2551)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (2)
src/components/AddMoney/consts/index.ts (1)
2559-2571: LGTM! Helper function correctly handles both code formats.The function elegantly handles the inconsistent ID formats in
countryData(2-letter vs 3-letter) by checking the enabled set directly and falling back to mapped codes. The implementation is clean and will work correctly when used at lines 2658 and 2687.src/components/Common/CountryList.tsx (1)
8-8: LGTM! Correctly implements non-EUR SEPA filtering for claim-request flow.The implementation properly disables non-EUR SEPA countries for the claim-request view while preserving existing behavior for other flows. The
.toUpperCase()call at line 164 is essential for correct Set lookup, sincetwoLetterCountryCodemay be lowercase from the fallback at line 133.The logic
(bridge AND not disabled) OR mantecacorrectly allows Manteca-supported countries regardless of SEPA status, which is appropriate for the withdrawal/claim flows.Also applies to: 162-166