Skip to content

Commit 70c2a03

Browse files
authored
fix: Invalid IBAN for UK (#1151)
1 parent 04e2142 commit 70c2a03

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/components/AddMoney/consts/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export interface CountryData {
143143
currency?: string
144144
description?: string
145145
path: string
146+
iso2?: string
146147
}
147148

148149
export interface DepositMethods extends CountryData {
@@ -777,6 +778,7 @@ export const countryData: CountryData[] = [
777778
title: 'United Kingdom',
778779
currency: 'GBP',
779780
path: 'united-kingdom',
781+
iso2: 'GB',
780782
},
781783
{
782784
id: 'GD',

src/utils/withdraw.utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const getCountryFromIban = (iban: string): string | null => {
1313
const countryCode = cleanIban.substring(0, 2)
1414

1515
// Try to find country by 2-letter code directly in countryData
16-
let country = countryData.find((c) => c.type === 'country' && c.id === countryCode)
16+
let country = countryData.find((c) => c.type === 'country' && (c.id === countryCode || c.iso2 === countryCode)) // @dev TODO - fix the UK issue properly
1717

1818
// If not found, get the 3-letter code and try that
1919
if (!country) {
@@ -23,7 +23,7 @@ export const getCountryFromIban = (iban: string): string | null => {
2323
}
2424
}
2525

26-
return country ? country.title : null
26+
return country ? country.path : null
2727
}
2828

2929
/**

0 commit comments

Comments
 (0)