From 6a4fb298af99d988aa61a31617607abdbffb1e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Ram=C3=ADrez?= Date: Wed, 18 Mar 2026 17:06:31 -0300 Subject: [PATCH 1/2] fix: restrict send flow to supported countries + validate country param on withdraw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Pass enforceSupportedCountries to CountryList when coming from send flow (unsupported countries show 'Soon' badge and are disabled) - Validate country param on withdraw/[country]/bank — redirect to /withdraw if country is not bridge-supported - Validate country param on withdraw/manteca — redirect to /withdraw if country is not in MANTECA_COUNTRIES_CONFIG --- .../(mobile-ui)/withdraw/[country]/bank/page.tsx | 14 +++++++++++++- src/app/(mobile-ui)/withdraw/manteca/page.tsx | 9 ++++++++- .../AddWithdraw/AddWithdrawRouterView.tsx | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx b/src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx index 11248f01c..0f9d24e5e 100644 --- a/src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx +++ b/src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx @@ -23,11 +23,12 @@ import { useEffect, useState } from 'react' import PaymentSuccessView from '@/features/payments/shared/components/PaymentSuccessView' import { ErrorHandler } from '@/utils/sdkErrorHandler.utils' import { getBridgeChainName } from '@/utils/bridge-accounts.utils' -import { getOfframpCurrencyConfig } from '@/utils/bridge.utils' +import { getOfframpCurrencyConfig, getCountryFromPath } from '@/utils/bridge.utils' import { createOfframp, confirmOfframp } from '@/app/actions/offramp' import { useAuth } from '@/context/authContext' import ExchangeRate from '@/components/ExchangeRate' import countryCurrencyMappings, { isNonEuroSepaCountry } from '@/constants/countryCurrencyMapping' +import { useIdentityVerification } from '@/hooks/useIdentityVerification' import { PointsAction } from '@/services/services.types' import { usePointsCalculation } from '@/hooks/usePointsCalculation' import { useSearchParams } from 'next/navigation' @@ -56,6 +57,17 @@ export default function WithdrawBankPage() { const country = params.country as string const [balanceErrorMessage, setBalanceErrorMessage] = useState(null) const { hasPendingTransactions } = usePendingTransactions() + const { isBridgeSupportedCountry } = useIdentityVerification() + + // validate country is supported for bank withdrawals + useEffect(() => { + if (country) { + const countryInfo = getCountryFromPath(country) + if (!countryInfo || !isBridgeSupportedCountry(countryInfo.id)) { + router.replace('/withdraw') + } + } + }, [country, isBridgeSupportedCountry, router]) // check if we came from send flow - using method param to detect (only bank goes through this page) const methodParam = searchParams.get('method') diff --git a/src/app/(mobile-ui)/withdraw/manteca/page.tsx b/src/app/(mobile-ui)/withdraw/manteca/page.tsx index 85e17af0a..c555bfcb0 100644 --- a/src/app/(mobile-ui)/withdraw/manteca/page.tsx +++ b/src/app/(mobile-ui)/withdraw/manteca/page.tsx @@ -430,7 +430,14 @@ export default function MantecaWithdrawFlow() { } }, [step, queryClient]) - if (isCurrencyLoading || !currencyPrice || !selectedCountry) { + // redirect to withdraw page if country is not supported by manteca + useEffect(() => { + if (selectedCountry && !MANTECA_COUNTRIES_CONFIG[selectedCountry.id]) { + router.replace('/withdraw') + } + }, [selectedCountry, router]) + + if (isCurrencyLoading || !currencyPrice || !selectedCountry || !countryConfig) { return } diff --git a/src/components/AddWithdraw/AddWithdrawRouterView.tsx b/src/components/AddWithdraw/AddWithdrawRouterView.tsx index 34d7c8187..e2ec6d4cb 100644 --- a/src/components/AddWithdraw/AddWithdrawRouterView.tsx +++ b/src/components/AddWithdraw/AddWithdrawRouterView.tsx @@ -309,6 +309,7 @@ export const AddWithdrawRouterView: FC = ({ { if (flow === 'add') { posthog.capture(ANALYTICS_EVENTS.DEPOSIT_METHOD_SELECTED, { From 20c99a8f4c223d5129ca97bedea965d20285033e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Ram=C3=ADrez?= Date: Wed, 18 Mar 2026 17:22:32 -0300 Subject: [PATCH 2/2] fix: also redirect when country param is completely invalid on manteca withdraw --- src/app/(mobile-ui)/withdraw/manteca/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/(mobile-ui)/withdraw/manteca/page.tsx b/src/app/(mobile-ui)/withdraw/manteca/page.tsx index c555bfcb0..158ee8142 100644 --- a/src/app/(mobile-ui)/withdraw/manteca/page.tsx +++ b/src/app/(mobile-ui)/withdraw/manteca/page.tsx @@ -432,7 +432,7 @@ export default function MantecaWithdrawFlow() { // redirect to withdraw page if country is not supported by manteca useEffect(() => { - if (selectedCountry && !MANTECA_COUNTRIES_CONFIG[selectedCountry.id]) { + if (!selectedCountry || !MANTECA_COUNTRIES_CONFIG[selectedCountry.id]) { router.replace('/withdraw') } }, [selectedCountry, router])