Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: Updating EU tax ids (#27440)

Kevin Grünebergeecafc41e038
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.ts b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.ts
index 08e48d3aaed..39a17cbf1bb 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.ts
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.ts
@@ -7,6 +7,7 @@ export interface TaxId {
name: string
type: string
country: string
+ countryIso2: string
placeholder: string
vatPrefix?: string
}
@@ -17,6 +18,7 @@ export const TAX_IDS: TaxId[] = [
type: 'ae_trn',
country: 'United Arab Emirates',
placeholder: '123456789012345',
+ countryIso2: 'AE',
},
{
name: 'AT VAT',
@@ -24,30 +26,35 @@ export const TAX_IDS: TaxId[] = [
country: 'Austria',
placeholder: 'ATU12345678',
vatPrefix: 'ATU',
+ countryIso2: 'AT',
},
{
name: 'AD NRT',
type: 'ad_nrt',
country: 'Andorra',
placeholder: 'A-123456-Z',
+ countryIso2: 'AD',
},
{
name: 'AR CUIT',
type: 'ar_cuit',
country: 'Argentina',
placeholder: '12-3456789-01',
+ countryIso2: 'AR',
},
{
name: 'AU ABN',
type: 'au_abn',
country: 'Australia',
placeholder: '12345678912',
+ countryIso2: 'AU',
},
{
name: 'AU ARN',
type: 'au_arn',
country: 'Australia',
placeholder: '123456789123',
+ countryIso2: 'AU',
},
{
name: 'BE VAT',
@@ -55,12 +62,14 @@ export const TAX_IDS: TaxId[] = [
country: 'Belgium',
placeholder: 'BE0123456789',
vatPrefix: 'BE',
+ countryIso2: 'BE',
},
{
name: 'BO TIN',
type: 'bo_tin',
country: 'Bolivia',
placeholder: '123456789',
+ countryIso2: 'BO',
},
{
name: 'BG VAT',
@@ -68,54 +77,63 @@ export const TAX_IDS: TaxId[] = [
country: 'Bulgaria',
placeholder: 'BG0123456789',
vatPrefix: 'BG',
+ countryIso2: 'BG',
},
{
name: 'BR CNPJ',
type: 'br_cnpj',
country: 'Brazil',
placeholder: '01.234.456/5432-10',
+ countryIso2: 'BR',
},
{
name: 'BR CPF',
type: 'br_cpf',
country: 'Brazil',
placeholder: '123.456.789-87',
+ countryIso2: 'BR',
},
{
name: 'CA BN',
type: 'ca_bn',
country: 'Canada',
placeholder: '123456789',
+ countryIso2: 'CA',
},
{
name: 'CA GST/HST',
type: 'ca_gst_hst',
country: 'Canada',
placeholder: '123456789RT0002',
+ countryIso2: 'CA',
},
{
name: 'CA PST-BC',
type: 'ca_pst_bc',
country: 'Canada',
placeholder: 'PST-1234-5678',
+ countryIso2: 'CA',
},
{
name: 'CA PST-MB',
type: 'ca_pst_mb',
country: 'Canada',
placeholder: '123456-7',
+ countryIso2: 'CA',
},
{
name: 'CA PST-SK',
type: 'ca_pst_mb',
country: 'Canada',
placeholder: '1234567',
+ countryIso2: 'CA',
},
{
name: 'CA QST',
type: 'ca_qst',
country: 'Canada',
placeholder: '1234567890TQ1234',
+ countryIso2: 'CA',
},
{
name: 'CH VAT',
@@ -123,30 +141,35 @@ export const TAX_IDS: TaxId[] = [
country: 'Switzerland',
placeholder: 'CHE-123.456.789 MWST',
vatPrefix: 'CHE',
+ countryIso2: 'CH',
},
{
name: 'CL TIN',
type: 'cl_tin',
country: 'Chile',
placeholder: '12.345.678-K',
+ countryIso2: 'CL',
},
{
name: 'CN TIN',
type: 'cn_tin',
country: 'China',
placeholder: '123456789012345678',
+ countryIso2: 'CN',
},
{
name: 'CO NIT',
type: 'co_nit',
country: 'Colombia',
placeholder: '123.456.789-0',
+ countryIso2: 'CO',
},
{
name: 'CR TIN',
type: 'cr_tin',
country: 'Costa Rica',
placeholder: '1-234-567890',
+ countryIso2: 'CR',
},
{
name: 'CY VAT',
@@ -154,6 +177,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Cyprus',
placeholder: 'CY12345678Z',
vatPrefix: 'CY',
+ countryIso2: 'CY',
},
{
name: 'CZ VAT',
@@ -161,6 +185,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Czech Republic',
placeholder: 'CZ1234567890',
vatPrefix: 'CZ',
+ countryIso2: 'CZ',
},
{
name: 'DE VAT',
@@ -168,6 +193,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Germany',
placeholder: 'DE123456789',
vatPrefix: 'DE',
+ countryIso2: 'DE',
},
{
name: 'DK VAT',
@@ -175,12 +201,14 @@ export const TAX_IDS: TaxId[] = [
country: 'Denmark',
placeholder: 'DK12345678',
vatPrefix: 'DK',
+ countryIso2: 'DK',
},
{
name: 'DO RCN',
type: 'do_rcn',
country: 'Dominican Republic',
placeholder: '123-4567890-1',
+ countryIso2: 'DO',
},
{
name: 'EE VAT',
@@ -188,12 +216,14 @@ export const TAX_IDS: TaxId[] = [
country: 'Estonia',
placeholder: 'EE123456789',
vatPrefix: 'EE',
+ countryIso2: 'EE',
},
{
name: 'ES CIF',
type: 'es_cif',
country: 'Spain',
placeholder: 'A12345678',
+ countryIso2: 'ES',
},
{
name: 'ES VAT',
@@ -201,6 +231,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Spain',
placeholder: 'ESX1234567Z',
vatPrefix: 'ES',
+ countryIso2: 'ES',
},
{
name: 'FI VAT',
@@ -208,6 +239,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Finland',
placeholder: 'FI12345678',
vatPrefix: 'FI',
+ countryIso2: 'FI',
},
{
name: 'FR VAT',
@@ -215,6 +247,7 @@ export const TAX_IDS: TaxId[] = [
country: 'France',
placeholder: 'FRAB123456789',
vatPrefix: 'FR',
+ countryIso2: 'FR',
},
{
name: 'GB VAT',
@@ -222,17 +255,20 @@ export const TAX_IDS: TaxId[] = [
country: 'United Kingdom',
placeholder: 'GB123456789',
vatPrefix: 'GB',
+ countryIso2: 'GB',
},
{
name: 'GE VAT',
type: 'ge_vat',
country: 'Georgia',
placeholder: '123456789',
+ countryIso2: 'GE',
},
{
name: 'EL VAT',
type: 'eu_vat',
country: 'Greece',
+ countryIso2: 'GR',
placeholder: 'EL123456789',
vatPrefix: 'EL',
},
@@ -241,6 +277,7 @@ export const TAX_IDS: TaxId[] = [
type: 'hk_br',
country: 'Hong Kong SAR China',
placeholder: '12345678',
+ countryIso2: 'HK',
},
{
name: 'HR VAT',
@@ -248,6 +285,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Croatia',
placeholder: 'HR12345678912',
vatPrefix: 'HR',
+ countryIso2: 'HR',
},
{
name: 'HU VAT',
@@ -255,12 +293,14 @@ export const TAX_IDS: TaxId[] = [
country: 'Hungary',
placeholder: 'HU12345678912',
vatPrefix: 'HU',
+ countryIso2: 'HU',
},
{
name: 'ID NPWP',
type: 'id_npwp',
country: 'Indonesia',
placeholder: '12.345.678.9-012.345',
+ countryIso2: 'ID',
},
{
name: 'IE VAT',
@@ -268,24 +308,28 @@ export const TAX_IDS: TaxId[] = [
country: 'Ireland',
placeholder: 'IE1234567AB',
vatPrefix: 'IE',
+ countryIso2: 'IE',
},
{
name: 'IL VAT',
type: 'il_vat',
country: 'Israel',
placeholder: '000012345',
+ countryIso2: 'IL',
},
{
name: 'IN GST',
type: 'in_gst',
country: 'India',
placeholder: '12ABCDE3456FGZH',
+ countryIso2: 'IN',
},
{
name: 'IS VAT',
type: 'is_vat',
country: 'Iceland',
placeholder: '123456',
+ countryIso2: 'IS',
},
{
name: 'IT VAT',
@@ -293,36 +337,42 @@ export const TAX_IDS: TaxId[] = [
country: 'Italy',
placeholder: 'IT12345678912',
vatPrefix: 'IT',
+ countryIso2: 'IT',
},
{
name: 'JP CN',
type: 'jp_cn',
country: 'Japan',
placeholder: '1234567891234',
+ countryIso2: 'JP',
},
{
name: 'KE PIN',
type: 'ke_pin',
country: 'Kenya',
placeholder: 'P000111111A',
+ countryIso2: 'KE',
},
{
name: 'JP RN',
type: 'jp_rn',
country: 'Japan',
placeholder: '12345',
+ countryIso2: 'JP',
},
{
name: 'KR BRN',
type: 'kr_brn',
country: 'Korea',
placeholder: '123-45-67890',
+ countryIso2: 'Kr',
},
{
name: 'LI UID',
type: 'li_uid',
country: 'Liechtenstein',
placeholder: 'CHE123456789',
+ countryIso2: 'LI',
},
{
name: 'LT VAT',
@@ -330,6 +380,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Lithuania',
placeholder: 'LT123456789123',
vatPrefix: 'LT',
+ countryIso2: 'LT',
},
{
name: 'LU VAT',
@@ -337,6 +388,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Luxembourg',
placeholder: 'LU12345678',
vatPrefix: 'LU',
+ countryIso2: 'LU',
},
{
name: 'LV VAT',
@@ -344,6 +396,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Latvia',
placeholder: 'LV12345678912',
vatPrefix: 'LV',
+ countryIso2: 'LV',
},
{
name: 'MT VAT',
@@ -351,30 +404,35 @@ export const TAX_IDS: TaxId[] = [
country: 'Malta',
placeholder: 'MT12345678',
vatPrefix: 'MT',
+ countryIso2: 'MT',
},
{
name: 'MX RFC',
type: 'mx_rfc',
country: 'Mexico',
placeholder: 'ABC010203AB9',
+ countryIso2: 'MX',
},
{
name: 'MY FRP',
type: 'my_frp',
country: 'Malaysia',
placeholder: '12345678',
+ countryIso2: 'MY',
},
{
name: 'MY ITN',
type: 'my_itn',
country: 'Malaysia',
placeholder: 'C 1234567890',
+ countryIso2: 'MY',
},
{
name: 'MY SST',
type: 'my_sst',
country: 'Malaysia',
placeholder: 'A12-3456-78912345',
+ countryIso2: 'MY',
},
{
name: 'NL VAT',
@@ -382,30 +440,35 @@ export const TAX_IDS: TaxId[] = [
country: 'Netherlands',
placeholder: 'NL123456789B12',
vatPrefix: 'NL',
+ countryIso2: 'NL',
},
{
name: 'NO VAT',
type: 'no_vat',
country: 'Norway',
placeholder: '123456789MVA',
+ countryIso2: 'NO',
},
{
name: 'PE RUC',
type: 'pe_ruc',
country: 'Peru',
placeholder: '12345678901',
+ countryIso2: 'PE',
},
{
name: 'PH TIN',
type: 'ph_tin',
country: 'Philippines',
placeholder: '123456789012',
+ countryIso2: 'PH',
},
{
name: 'NZ GST',
type: 'nz_gst',
country: 'New Zealand',
placeholder: '123456789',
+ countryIso2: 'NZ',
},
{
name: 'PL VAT',
@@ -413,6 +476,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Poland',
placeholder: 'PL1234567890',
vatPrefix: 'PL',
+ countryIso2: 'PL',
},
{
name: 'PT VAT',
@@ -420,6 +484,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Portugal',
placeholder: 'PT123456789',
vatPrefix: 'PT',
+ countryIso2: 'PT',
},
{
name: 'RO VAT',
@@ -427,30 +492,35 @@ export const TAX_IDS: TaxId[] = [
country: 'Romania',
placeholder: 'RO1234567891',
vatPrefix: 'RO',
+ countryIso2: 'RO',
},
{
name: 'RU INN',
type: 'ru_inn',
country: 'Russia',
placeholder: '1234567891',
+ countryIso2: 'RU',
},
{
name: 'RU KPP',
type: 'ru_kpp',
country: 'Russia',
placeholder: '123456789',
+ countryIso2: 'RU',
},
{
name: 'SA VAT',
type: 'sa_vat',
country: 'Saudi Arabia',
placeholder: '123456789012345',
+ countryIso2: 'SA',
},
{
name: 'RS PIB',
type: 'rs_pib',
country: 'Serbia',
placeholder: '123456789',
+ countryIso2: 'RS',
},
{
name: 'SE VAT',
@@ -458,18 +528,21 @@ export const TAX_IDS: TaxId[] = [
country: 'Sweden',
placeholder: 'SE123456789123',
vatPrefix: 'SE',
+ countryIso2: 'SE',
},
{
name: 'SG GST',
type: 'sg_gst',
country: 'Singapore',
placeholder: 'M12345678X',
+ countryIso2: 'SG',
},
{
name: 'SG UEN',
type: 'sg_uen',
country: 'Singapore',
placeholder: '123456789F',
+ countryIso2: 'SG',
},
{
name: 'SI VAT',
@@ -477,6 +550,7 @@ export const TAX_IDS: TaxId[] = [
country: 'Slovenia',
placeholder: 'SI12345678',
vatPrefix: 'SI',
+ countryIso2: 'SI',
},
{
name: 'SK VAT',
@@ -484,36 +558,42 @@ export const TAX_IDS: TaxId[] = [
country: 'Slovakia',
placeholder: 'SK1234567891',
vatPrefix: 'SK',
+ countryIso2: 'SK',
},
{
name: 'TH VAT',
type: 'th_vat',
country: 'Thailand',
placeholder: '1234567891234',
+ countryIso2: 'TH',
},
{
name: 'TR TIN',
type: 'tr_tin',
country: 'Turkey',
placeholder: '0123456789',
+ countryIso2: 'TR',
},
{
name: 'TW VAT',
type: 'tw_vat',
country: 'Taiwan',
placeholder: '12345678',
+ countryIso2: 'TW',
},
{
name: 'UA VAT',
type: 'ua_vat',
country: 'Ukraine',
placeholder: '123456789',
+ countryIso2: 'UA',
},
{
name: 'US EIN',
type: 'us_ein',
country: 'United States',
placeholder: '12-3456789',
+ countryIso2: 'US',
},
{
name: 'XI VAT',
@@ -521,29 +601,34 @@ export const TAX_IDS: TaxId[] = [
country: 'United Kingdom (Northern Ireland)',
placeholder: 'XI123456789',
vatPrefix: 'XI',
+ countryIso2: 'GB',
},
{
name: 'ZA VAT',
type: 'za_vat',
country: 'South Africa',
placeholder: '4123456789',
+ countryIso2: 'ZA',
},
{
name: 'UY RUC',
type: 'uy_ruc',
country: 'Uruguay',
placeholder: '123456789012',
+ countryIso2: 'UY',
},
{
name: 'VE RIF',
type: 've_rif',
country: 'Venezuela',
placeholder: 'A-12345678-9',
+ countryIso2: 'VE',
},
{
name: 'VN TIN',
type: 'vn_tin',
country: 'Vietnam',
placeholder: '1234567890',
+ countryIso2: 'VN',
},
]
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx
index 97f2c03c6e7..a50b80737e2 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx
@@ -59,9 +59,9 @@ const TaxID = () => {
type: taxId.type,
value: taxId.value,
name:
- taxId.type === 'eu_vat'
- ? `${taxId.country} VAT`
- : TAX_IDS.find((option) => option.type === taxId.type)?.name ?? '',
+ TAX_IDS.find(
+ (option) => option.type === taxId.type && option.countryIso2 === taxId.country
+ )?.name ?? '',
}
: { type: '', value: '', name: '' }
@@ -94,7 +94,7 @@ const TaxID = () => {
type?.length && value?.length
? {
type: type,
- value: sanitizeTaxIdValue({ type, value }),
+ value: sanitizeTaxIdValue({ value, name: form.getValues().name }),
}
: null,
})
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.utils.ts b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.utils.ts
index ce69896aff4..b96a035b24a 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.utils.ts
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.utils.ts
@@ -1,7 +1,7 @@
import { TAX_IDS } from './TaxID.constants'
-export const sanitizeTaxIdValue = (taxId: { type: string; value: string }) => {
- const selectedTaxId = TAX_IDS.find((option) => option.type === taxId.type)
+export const sanitizeTaxIdValue = (taxId: { name: string; value: string }) => {
+ const selectedTaxId = TAX_IDS.find((option) => option.name === taxId.name)
const vatIdPrefix = selectedTaxId?.vatPrefix