Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -56,6 +57,17 @@ export default function WithdrawBankPage() {
const country = params.country as string
const [balanceErrorMessage, setBalanceErrorMessage] = useState<string | null>(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')
Expand Down
9 changes: 8 additions & 1 deletion src/app/(mobile-ui)/withdraw/manteca/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PeanutLoading />
}

Expand Down
1 change: 1 addition & 0 deletions src/components/AddWithdraw/AddWithdrawRouterView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export const AddWithdrawRouterView: FC<AddWithdrawRouterViewProps> = ({
<CountryList
inputTitle={mainHeading}
viewMode="add-withdraw"
enforceSupportedCountries={isBankFromSend}
onCountryClick={(country) => {
if (flow === 'add') {
posthog.capture(ANALYTICS_EVENTS.DEPOSIT_METHOD_SELECTED, {
Expand Down
Loading