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..158ee8142 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, {