From 306ac6f7ea69c1aa7b3a8022b68b3028f23eb3d9 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Thu, 25 Dec 2025 23:09:37 +0800 Subject: [PATCH 1/4] feat: update iban based on wikipedia page Wikipedia link: https://en.wikipedia.org/wiki/International_Bank_Account_Number --- country/data.go | 123 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/country/data.go b/country/data.go index de6340d..f774712 100644 --- a/country/data.go +++ b/country/data.go @@ -97,6 +97,16 @@ var ( bban.NewOwnerAccountType(1, bban.AlphaNum), ), }, + "BI": { + Name: "Burundi", + Alpha2Code: "BI", + Alpha3Code: "BDI", + Structure: bban.NewStructure( + bban.NewBankCode(5, bban.Num), + bban.NewBranchCode(5, bban.Num), + bban.NewAccountNumber(13, bban.Num), + ), + }, "VG": { Name: "British Virgin Islands", Alpha2Code: "VG", @@ -164,6 +174,16 @@ var ( bban.NewAccountNumber(10, bban.Num), ), }, + "DJ": { + Name: "Djibouti", + Alpha2Code: "DJ", + Alpha3Code: "DJI", + Structure: bban.NewStructure( + bban.NewBankCode(5, bban.Num), + bban.NewBranchCode(5, bban.Num), + bban.NewAccountNumber(13, bban.Num), + ), + }, "DO": { Name: "Dominican Republic", Alpha2Code: "DO", @@ -184,6 +204,15 @@ var ( bban.NewNationalCheckDigit(1, bban.Num), ), }, + "SV": { + Name: "El Salvador", + Alpha2Code: "SV", + Alpha3Code: "SLV", + Structure: bban.NewStructure( + bban.NewBankCode(4, bban.AlphaUpper), + bban.NewAccountNumber(20, bban.Num), + ), + }, "EG": { Name: "Egypt", Alpha2Code: "EG", @@ -225,6 +254,15 @@ var ( bban.NewNationalCheckDigit(2, bban.Num), ), }, + "FK": { + Name: "Falkland Islands", + Alpha2Code: "FK", + Alpha3Code: "FLK", + Structure: bban.NewStructure( + bban.NewBankCode(2, bban.AlphaUpper), + bban.NewAccountNumber(12, bban.Num), + ), + }, "GE": { Name: "Georgia", Alpha2Code: "GE", @@ -291,6 +329,15 @@ var ( bban.NewNationalCheckDigit(1, bban.Num), ), }, + "HN": { + Name: "Honduras", + Alpha2Code: "HN", + Alpha3Code: "HND", + Structure: bban.NewStructure( + bban.NewBankCode(4, bban.AlphaUpper), + bban.NewAccountNumber(20, bban.Num), + ), + }, "IS": { Name: "Iceland", Alpha2Code: "IS", @@ -434,6 +481,16 @@ var ( bban.NewAccountNumber(13, bban.AlphaNum), ), }, + "LY": { + Name: "Libya", + Alpha2Code: "LY", + Alpha3Code: "LBY", + Structure: bban.NewStructure( + bban.NewBankCode(3, bban.Num), + bban.NewBranchCode(3, bban.Num), + bban.NewAccountNumber(15, bban.Num), + ), + }, "MK": { Name: "Macedonia", Alpha2Code: "MK", @@ -507,6 +564,24 @@ var ( bban.NewNationalCheckDigit(2, bban.Num), ), }, + "MN": { + Name: "Mongolia", + Alpha2Code: "MN", + Alpha3Code: "MNG", + Structure: bban.NewStructure( + bban.NewBankCode(4, bban.Num), + bban.NewAccountNumber(12, bban.Num), + ), + }, + "NI": { + Name: "Nicaragua", + Alpha2Code: "NI", + Alpha3Code: "NIC", + Structure: bban.NewStructure( + bban.NewBankCode(4, bban.AlphaUpper), + bban.NewAccountNumber(20, bban.Num), + ), + }, "NL": { Name: "Netherlands", Alpha2Code: "NL", @@ -526,6 +601,15 @@ var ( bban.NewNationalCheckDigit(1, bban.Num), ), }, + "OM": { + Name: "Oman", + Alpha2Code: "OM", + Alpha3Code: "OMN", + Structure: bban.NewStructure( + bban.NewBankCode(3, bban.Num), + bban.NewAccountNumber(16, bban.AlphaNum), + ), + }, "PK": { Name: "Pakistan", Alpha2Code: "PK", @@ -584,6 +668,16 @@ var ( bban.NewAccountNumber(16, bban.AlphaNum), ), }, + "RU": { + Name: "Russia", + Alpha2Code: "RU", + Alpha3Code: "RUS", + Structure: bban.NewStructure( + bban.NewBankCode(9, bban.Num), + bban.NewBranchCode(5, bban.Num), + bban.NewAccountNumber(15, bban.AlphaNum), + ), + }, "SM": { Name: "San Marino", Alpha2Code: "SM", @@ -625,6 +719,15 @@ var ( bban.NewCurrency(3, bban.AlphaUpper), ), }, + "SD": { + Name: "Sudan", + Alpha2Code: "SD", + Alpha3Code: "SDN", + Structure: bban.NewStructure( + bban.NewBankCode(2, bban.Num), + bban.NewAccountNumber(12, bban.Num), + ), + }, "SK": { Name: "Slovakia", Alpha2Code: "SK", @@ -645,6 +748,16 @@ var ( bban.NewNationalCheckDigit(2, bban.Num), ), }, + "SO": { + Name: "Somalia", + Alpha2Code: "SO", + Alpha3Code: "SOM", + Structure: bban.NewStructure( + bban.NewBankCode(4, bban.Num), + bban.NewBranchCode(3, bban.Num), + bban.NewAccountNumber(12, bban.Num), + ), + }, "ES": { Name: "Spain", Alpha2Code: "ES", @@ -741,5 +854,15 @@ var ( bban.NewAccountNumber(19, bban.AlphaNum), ), }, + "YE": { + Name: "Yemen", + Alpha2Code: "YE", + Alpha3Code: "YEM", + Structure: bban.NewStructure( + bban.NewBranchCode(4, bban.AlphaUpper), + bban.NewBranchCode(4, bban.Num), + bban.NewAccountNumber(18, bban.AlphaNum), + ), + }, } ) From 987ec2e51748edf15c94645d257ff2a01c33484b Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Thu, 25 Dec 2025 23:10:10 +0800 Subject: [PATCH 2/4] feat: add st --- country/data.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/country/data.go b/country/data.go index f774712..e71fef2 100644 --- a/country/data.go +++ b/country/data.go @@ -698,6 +698,16 @@ var ( bban.NewAccountNumber(18, bban.AlphaNum), ), }, + "ST": { + Name: "Sao Tome and Principe", + Alpha2Code: "ST", + Alpha3Code: "STP", + Structure: bban.NewStructure( + bban.NewBranchCode(4, bban.Num), + bban.NewBranchCode(4, bban.Num), + bban.NewAccountNumber(13, bban.Num), + ), + }, "RS": { Name: "Serbia", Alpha2Code: "RS", From c0893620d56e78e5fb68122ba00803c8d9722dc1 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Thu, 25 Dec 2025 23:24:24 +0800 Subject: [PATCH 3/4] feat: add all country codes and alphas --- country/countries.json | 527 +++++++++++++++++++++++++++++++++++++++++ country/country.go | 9 +- country/data.go | 6 +- 3 files changed, 539 insertions(+), 3 deletions(-) create mode 100644 country/countries.json diff --git a/country/countries.json b/country/countries.json new file mode 100644 index 0000000..c800efd --- /dev/null +++ b/country/countries.json @@ -0,0 +1,527 @@ +{ + "AF": { "Name": "Afghanistan", "Alpha2Code": "AF", "Alpha3Code": "AFG" }, + "AL": { "Name": "Albania", "Alpha2Code": "AL", "Alpha3Code": "ALB" }, + "DZ": { "Name": "Algeria", "Alpha2Code": "DZ", "Alpha3Code": "DZA" }, + "AS": { + "Name": "American Samoa", + "Alpha2Code": "AS", + "Alpha3Code": "ASM" + }, + "AD": { "Name": "Andorra", "Alpha2Code": "AD", "Alpha3Code": "AND" }, + "AO": { "Name": "Angola", "Alpha2Code": "AO", "Alpha3Code": "AGO" }, + "AI": { "Name": "Anguilla", "Alpha2Code": "AI", "Alpha3Code": "AIA" }, + "AQ": { "Name": "Antarctica", "Alpha2Code": "AQ", "Alpha3Code": "ATA" }, + "AG": { + "Name": "Antigua and Barbuda", + "Alpha2Code": "AG", + "Alpha3Code": "ATG" + }, + "AR": { "Name": "Argentina", "Alpha2Code": "AR", "Alpha3Code": "ARG" }, + "AM": { "Name": "Armenia", "Alpha2Code": "AM", "Alpha3Code": "ARM" }, + "AW": { "Name": "Aruba", "Alpha2Code": "AW", "Alpha3Code": "ABW" }, + "AU": { "Name": "Australia", "Alpha2Code": "AU", "Alpha3Code": "AUS" }, + "AT": { "Name": "Austria", "Alpha2Code": "AT", "Alpha3Code": "AUT" }, + "AZ": { "Name": "Azerbaijan", "Alpha2Code": "AZ", "Alpha3Code": "AZE" }, + "BS": { + "Name": "Bahamas (the)", + "Alpha2Code": "BS", + "Alpha3Code": "BHS" + }, + "BH": { "Name": "Bahrain", "Alpha2Code": "BH", "Alpha3Code": "BHR" }, + "BD": { "Name": "Bangladesh", "Alpha2Code": "BD", "Alpha3Code": "BGD" }, + "BB": { "Name": "Barbados", "Alpha2Code": "BB", "Alpha3Code": "BRB" }, + "BY": { "Name": "Belarus", "Alpha2Code": "BY", "Alpha3Code": "BLR" }, + "BE": { "Name": "Belgium", "Alpha2Code": "BE", "Alpha3Code": "BEL" }, + "BZ": { "Name": "Belize", "Alpha2Code": "BZ", "Alpha3Code": "BLZ" }, + "BJ": { "Name": "Benin", "Alpha2Code": "BJ", "Alpha3Code": "BEN" }, + "BM": { "Name": "Bermuda", "Alpha2Code": "BM", "Alpha3Code": "BMU" }, + "BT": { "Name": "Bhutan", "Alpha2Code": "BT", "Alpha3Code": "BTN" }, + "BO": { + "Name": "Bolivia (Plurinational State of)", + "Alpha2Code": "BO", + "Alpha3Code": "BOL" + }, + "BQ": { + "Name": "Bonaire, Sint Eustatius and Saba", + "Alpha2Code": "BQ", + "Alpha3Code": "BES" + }, + "BA": { + "Name": "Bosnia and Herzegovina", + "Alpha2Code": "BA", + "Alpha3Code": "BIH" + }, + "BW": { "Name": "Botswana", "Alpha2Code": "BW", "Alpha3Code": "BWA" }, + "BV": { + "Name": "Bouvet Island", + "Alpha2Code": "BV", + "Alpha3Code": "BVT" + }, + "BR": { "Name": "Brazil", "Alpha2Code": "BR", "Alpha3Code": "BRA" }, + "IO": { + "Name": "British Indian Ocean Territory (the)", + "Alpha2Code": "IO", + "Alpha3Code": "IOT" + }, + "BN": { + "Name": "Brunei Darussalam", + "Alpha2Code": "BN", + "Alpha3Code": "BRN" + }, + "BG": { "Name": "Bulgaria", "Alpha2Code": "BG", "Alpha3Code": "BGR" }, + "BF": { "Name": "Burkina Faso", "Alpha2Code": "BF", "Alpha3Code": "BFA" }, + "BI": { "Name": "Burundi", "Alpha2Code": "BI", "Alpha3Code": "BDI" }, + "CV": { "Name": "Cabo Verde", "Alpha2Code": "CV", "Alpha3Code": "CPV" }, + "KH": { "Name": "Cambodia", "Alpha2Code": "KH", "Alpha3Code": "KHM" }, + "CM": { "Name": "Cameroon", "Alpha2Code": "CM", "Alpha3Code": "CMR" }, + "CA": { "Name": "Canada", "Alpha2Code": "CA", "Alpha3Code": "CAN" }, + "KY": { + "Name": "Cayman Islands (the)", + "Alpha2Code": "KY", + "Alpha3Code": "CYM" + }, + "CF": { + "Name": "Central African Republic (the)", + "Alpha2Code": "CF", + "Alpha3Code": "CAF" + }, + "TD": { "Name": "Chad", "Alpha2Code": "TD", "Alpha3Code": "TCD" }, + "CL": { "Name": "Chile", "Alpha2Code": "CL", "Alpha3Code": "CHL" }, + "CN": { "Name": "China", "Alpha2Code": "CN", "Alpha3Code": "CHN" }, + "CX": { + "Name": "Christmas Island", + "Alpha2Code": "CX", + "Alpha3Code": "CXR" + }, + "CC": { + "Name": "Cocos (Keeling) Islands (the)", + "Alpha2Code": "CC", + "Alpha3Code": "CCK" + }, + "CO": { "Name": "Colombia", "Alpha2Code": "CO", "Alpha3Code": "COL" }, + "KM": { + "Name": "Comoros (the)", + "Alpha2Code": "KM", + "Alpha3Code": "COM" + }, + "CD": { + "Name": "Congo (the Democratic Republic of the)", + "Alpha2Code": "CD", + "Alpha3Code": "COD" + }, + "CG": { "Name": "Congo (the)", "Alpha2Code": "CG", "Alpha3Code": "COG" }, + "CK": { + "Name": "Cook Islands (the)", + "Alpha2Code": "CK", + "Alpha3Code": "COK" + }, + "CR": { "Name": "Costa Rica", "Alpha2Code": "CR", "Alpha3Code": "CRI" }, + "HR": { "Name": "Croatia", "Alpha2Code": "HR", "Alpha3Code": "HRV" }, + "CU": { "Name": "Cuba", "Alpha2Code": "CU", "Alpha3Code": "CUB" }, + "CW": { "Name": "Curaçao", "Alpha2Code": "CW", "Alpha3Code": "CUW" }, + "CY": { "Name": "Cyprus", "Alpha2Code": "CY", "Alpha3Code": "CYP" }, + "CZ": { "Name": "Czechia", "Alpha2Code": "CZ", "Alpha3Code": "CZE" }, + "CI": { + "Name": "Côte d'Ivoire", + "Alpha2Code": "CI", + "Alpha3Code": "CIV" + }, + "DK": { "Name": "Denmark", "Alpha2Code": "DK", "Alpha3Code": "DNK" }, + "DJ": { "Name": "Djibouti", "Alpha2Code": "DJ", "Alpha3Code": "DJI" }, + "DM": { "Name": "Dominica", "Alpha2Code": "DM", "Alpha3Code": "DMA" }, + "DO": { + "Name": "Dominican Republic (the)", + "Alpha2Code": "DO", + "Alpha3Code": "DOM" + }, + "EC": { "Name": "Ecuador", "Alpha2Code": "EC", "Alpha3Code": "ECU" }, + "EG": { "Name": "Egypt", "Alpha2Code": "EG", "Alpha3Code": "EGY" }, + "SV": { "Name": "El Salvador", "Alpha2Code": "SV", "Alpha3Code": "SLV" }, + "GQ": { + "Name": "Equatorial Guinea", + "Alpha2Code": "GQ", + "Alpha3Code": "GNQ" + }, + "ER": { "Name": "Eritrea", "Alpha2Code": "ER", "Alpha3Code": "ERI" }, + "EE": { "Name": "Estonia", "Alpha2Code": "EE", "Alpha3Code": "EST" }, + "SZ": { "Name": "Eswatini", "Alpha2Code": "SZ", "Alpha3Code": "SWZ" }, + "ET": { "Name": "Ethiopia", "Alpha2Code": "ET", "Alpha3Code": "ETH" }, + "FK": { + "Name": "Falkland Islands (the) [Malvinas]", + "Alpha2Code": "FK", + "Alpha3Code": "FLK" + }, + "FO": { + "Name": "Faroe Islands (the)", + "Alpha2Code": "FO", + "Alpha3Code": "FRO" + }, + "FJ": { "Name": "Fiji", "Alpha2Code": "FJ", "Alpha3Code": "FJI" }, + "FI": { "Name": "Finland", "Alpha2Code": "FI", "Alpha3Code": "FIN" }, + "FR": { "Name": "France", "Alpha2Code": "FR", "Alpha3Code": "FRA" }, + "GF": { + "Name": "French Guiana", + "Alpha2Code": "GF", + "Alpha3Code": "GUF" + }, + "PF": { + "Name": "French Polynesia", + "Alpha2Code": "PF", + "Alpha3Code": "PYF" + }, + "TF": { + "Name": "French Southern Territories (the)", + "Alpha2Code": "TF", + "Alpha3Code": "ATF" + }, + "GA": { "Name": "Gabon", "Alpha2Code": "GA", "Alpha3Code": "GAB" }, + "GM": { "Name": "Gambia (the)", "Alpha2Code": "GM", "Alpha3Code": "GMB" }, + "GE": { "Name": "Georgia", "Alpha2Code": "GE", "Alpha3Code": "GEO" }, + "DE": { "Name": "Germany", "Alpha2Code": "DE", "Alpha3Code": "DEU" }, + "GH": { "Name": "Ghana", "Alpha2Code": "GH", "Alpha3Code": "GHA" }, + "GI": { "Name": "Gibraltar", "Alpha2Code": "GI", "Alpha3Code": "GIB" }, + "GR": { "Name": "Greece", "Alpha2Code": "GR", "Alpha3Code": "GRC" }, + "GL": { "Name": "Greenland", "Alpha2Code": "GL", "Alpha3Code": "GRL" }, + "GD": { "Name": "Grenada", "Alpha2Code": "GD", "Alpha3Code": "GRD" }, + "GP": { "Name": "Guadeloupe", "Alpha2Code": "GP", "Alpha3Code": "GLP" }, + "GU": { "Name": "Guam", "Alpha2Code": "GU", "Alpha3Code": "GUM" }, + "GT": { "Name": "Guatemala", "Alpha2Code": "GT", "Alpha3Code": "GTM" }, + "GG": { "Name": "Guernsey", "Alpha2Code": "GG", "Alpha3Code": "GGY" }, + "GN": { "Name": "Guinea", "Alpha2Code": "GN", "Alpha3Code": "GIN" }, + "GW": { + "Name": "Guinea-Bissau", + "Alpha2Code": "GW", + "Alpha3Code": "GNB" + }, + "GY": { "Name": "Guyana", "Alpha2Code": "GY", "Alpha3Code": "GUY" }, + "HT": { "Name": "Haiti", "Alpha2Code": "HT", "Alpha3Code": "HTI" }, + "HM": { + "Name": "Heard Island and McDonald Islands", + "Alpha2Code": "HM", + "Alpha3Code": "HMD" + }, + "VA": { + "Name": "Holy See (the)", + "Alpha2Code": "VA", + "Alpha3Code": "VAT" + }, + "HN": { "Name": "Honduras", "Alpha2Code": "HN", "Alpha3Code": "HND" }, + "HK": { "Name": "Hong Kong", "Alpha2Code": "HK", "Alpha3Code": "HKG" }, + "HU": { "Name": "Hungary", "Alpha2Code": "HU", "Alpha3Code": "HUN" }, + "IS": { "Name": "Iceland", "Alpha2Code": "IS", "Alpha3Code": "ISL" }, + "IN": { "Name": "India", "Alpha2Code": "IN", "Alpha3Code": "IND" }, + "ID": { "Name": "Indonesia", "Alpha2Code": "ID", "Alpha3Code": "IDN" }, + "IR": { + "Name": "Iran (Islamic Republic of)", + "Alpha2Code": "IR", + "Alpha3Code": "IRN" + }, + "IQ": { "Name": "Iraq", "Alpha2Code": "IQ", "Alpha3Code": "IRQ" }, + "IE": { "Name": "Ireland", "Alpha2Code": "IE", "Alpha3Code": "IRL" }, + "IM": { "Name": "Isle of Man", "Alpha2Code": "IM", "Alpha3Code": "IMN" }, + "IL": { "Name": "Israel", "Alpha2Code": "IL", "Alpha3Code": "ISR" }, + "IT": { "Name": "Italy", "Alpha2Code": "IT", "Alpha3Code": "ITA" }, + "JM": { "Name": "Jamaica", "Alpha2Code": "JM", "Alpha3Code": "JAM" }, + "JP": { "Name": "Japan", "Alpha2Code": "JP", "Alpha3Code": "JPN" }, + "JE": { "Name": "Jersey", "Alpha2Code": "JE", "Alpha3Code": "JEY" }, + "JO": { "Name": "Jordan", "Alpha2Code": "JO", "Alpha3Code": "JOR" }, + "KZ": { "Name": "Kazakhstan", "Alpha2Code": "KZ", "Alpha3Code": "KAZ" }, + "KE": { "Name": "Kenya", "Alpha2Code": "KE", "Alpha3Code": "KEN" }, + "KI": { "Name": "Kiribati", "Alpha2Code": "KI", "Alpha3Code": "KIR" }, + "KP": { + "Name": "Korea (the Democratic People's Republic of)", + "Alpha2Code": "KP", + "Alpha3Code": "PRK" + }, + "KR": { + "Name": "Korea (the Republic of)", + "Alpha2Code": "KR", + "Alpha3Code": "KOR" + }, + "KW": { "Name": "Kuwait", "Alpha2Code": "KW", "Alpha3Code": "KWT" }, + "KG": { "Name": "Kyrgyzstan", "Alpha2Code": "KG", "Alpha3Code": "KGZ" }, + "LA": { + "Name": "Lao People's Democratic Republic (the)", + "Alpha2Code": "LA", + "Alpha3Code": "LAO" + }, + "LV": { "Name": "Latvia", "Alpha2Code": "LV", "Alpha3Code": "LVA" }, + "LB": { "Name": "Lebanon", "Alpha2Code": "LB", "Alpha3Code": "LBN" }, + "LS": { "Name": "Lesotho", "Alpha2Code": "LS", "Alpha3Code": "LSO" }, + "LR": { "Name": "Liberia", "Alpha2Code": "LR", "Alpha3Code": "LBR" }, + "LY": { "Name": "Libya", "Alpha2Code": "LY", "Alpha3Code": "LBY" }, + "LI": { + "Name": "Liechtenstein", + "Alpha2Code": "LI", + "Alpha3Code": "LIE" + }, + "LT": { "Name": "Lithuania", "Alpha2Code": "LT", "Alpha3Code": "LTU" }, + "LU": { "Name": "Luxembourg", "Alpha2Code": "LU", "Alpha3Code": "LUX" }, + "MO": { "Name": "Macao", "Alpha2Code": "MO", "Alpha3Code": "MAC" }, + "MG": { "Name": "Madagascar", "Alpha2Code": "MG", "Alpha3Code": "MDG" }, + "MW": { "Name": "Malawi", "Alpha2Code": "MW", "Alpha3Code": "MWI" }, + "MY": { "Name": "Malaysia", "Alpha2Code": "MY", "Alpha3Code": "MYS" }, + "MV": { "Name": "Maldives", "Alpha2Code": "MV", "Alpha3Code": "MDV" }, + "ML": { "Name": "Mali", "Alpha2Code": "ML", "Alpha3Code": "MLI" }, + "MT": { "Name": "Malta", "Alpha2Code": "MT", "Alpha3Code": "MLT" }, + "MH": { + "Name": "Marshall Islands (the)", + "Alpha2Code": "MH", + "Alpha3Code": "MHL" + }, + "MQ": { "Name": "Martinique", "Alpha2Code": "MQ", "Alpha3Code": "MTQ" }, + "MR": { "Name": "Mauritania", "Alpha2Code": "MR", "Alpha3Code": "MRT" }, + "MU": { "Name": "Mauritius", "Alpha2Code": "MU", "Alpha3Code": "MUS" }, + "YT": { "Name": "Mayotte", "Alpha2Code": "YT", "Alpha3Code": "MYT" }, + "MX": { "Name": "Mexico", "Alpha2Code": "MX", "Alpha3Code": "MEX" }, + "FM": { + "Name": "Micronesia (Federated States of)", + "Alpha2Code": "FM", + "Alpha3Code": "FSM" + }, + "MD": { + "Name": "Moldova (the Republic of)", + "Alpha2Code": "MD", + "Alpha3Code": "MDA" + }, + "MC": { "Name": "Monaco", "Alpha2Code": "MC", "Alpha3Code": "MCO" }, + "MN": { "Name": "Mongolia", "Alpha2Code": "MN", "Alpha3Code": "MNG" }, + "ME": { "Name": "Montenegro", "Alpha2Code": "ME", "Alpha3Code": "MNE" }, + "MS": { "Name": "Montserrat", "Alpha2Code": "MS", "Alpha3Code": "MSR" }, + "MA": { "Name": "Morocco", "Alpha2Code": "MA", "Alpha3Code": "MAR" }, + "MZ": { "Name": "Mozambique", "Alpha2Code": "MZ", "Alpha3Code": "MOZ" }, + "MM": { "Name": "Myanmar", "Alpha2Code": "MM", "Alpha3Code": "MMR" }, + "NA": { "Name": "Namibia", "Alpha2Code": "NA", "Alpha3Code": "NAM" }, + "NR": { "Name": "Nauru", "Alpha2Code": "NR", "Alpha3Code": "NRU" }, + "NP": { "Name": "Nepal", "Alpha2Code": "NP", "Alpha3Code": "NPL" }, + "NL": { + "Name": "Netherlands (the)", + "Alpha2Code": "NL", + "Alpha3Code": "NLD" + }, + "NC": { + "Name": "New Caledonia", + "Alpha2Code": "NC", + "Alpha3Code": "NCL" + }, + "NZ": { "Name": "New Zealand", "Alpha2Code": "NZ", "Alpha3Code": "NZL" }, + "NI": { "Name": "Nicaragua", "Alpha2Code": "NI", "Alpha3Code": "NIC" }, + "NE": { "Name": "Niger (the)", "Alpha2Code": "NE", "Alpha3Code": "NER" }, + "NG": { "Name": "Nigeria", "Alpha2Code": "NG", "Alpha3Code": "NGA" }, + "NU": { "Name": "Niue", "Alpha2Code": "NU", "Alpha3Code": "NIU" }, + "NF": { + "Name": "Norfolk Island", + "Alpha2Code": "NF", + "Alpha3Code": "NFK" + }, + "MP": { + "Name": "Northern Mariana Islands (the)", + "Alpha2Code": "MP", + "Alpha3Code": "MNP" + }, + "NO": { "Name": "Norway", "Alpha2Code": "NO", "Alpha3Code": "NOR" }, + "OM": { "Name": "Oman", "Alpha2Code": "OM", "Alpha3Code": "OMN" }, + "PK": { "Name": "Pakistan", "Alpha2Code": "PK", "Alpha3Code": "PAK" }, + "PW": { "Name": "Palau", "Alpha2Code": "PW", "Alpha3Code": "PLW" }, + "PS": { + "Name": "Palestine, State of", + "Alpha2Code": "PS", + "Alpha3Code": "PSE" + }, + "PA": { "Name": "Panama", "Alpha2Code": "PA", "Alpha3Code": "PAN" }, + "PG": { + "Name": "Papua New Guinea", + "Alpha2Code": "PG", + "Alpha3Code": "PNG" + }, + "PY": { "Name": "Paraguay", "Alpha2Code": "PY", "Alpha3Code": "PRY" }, + "PE": { "Name": "Peru", "Alpha2Code": "PE", "Alpha3Code": "PER" }, + "PH": { + "Name": "Philippines (the)", + "Alpha2Code": "PH", + "Alpha3Code": "PHL" + }, + "PN": { "Name": "Pitcairn", "Alpha2Code": "PN", "Alpha3Code": "PCN" }, + "PL": { "Name": "Poland", "Alpha2Code": "PL", "Alpha3Code": "POL" }, + "PT": { "Name": "Portugal", "Alpha2Code": "PT", "Alpha3Code": "PRT" }, + "PR": { "Name": "Puerto Rico", "Alpha2Code": "PR", "Alpha3Code": "PRI" }, + "QA": { "Name": "Qatar", "Alpha2Code": "QA", "Alpha3Code": "QAT" }, + "MK": { + "Name": "Republic of North Macedonia", + "Alpha2Code": "MK", + "Alpha3Code": "MKD" + }, + "RO": { "Name": "Romania", "Alpha2Code": "RO", "Alpha3Code": "ROU" }, + "RU": { + "Name": "Russian Federation (the)", + "Alpha2Code": "RU", + "Alpha3Code": "RUS" + }, + "RW": { "Name": "Rwanda", "Alpha2Code": "RW", "Alpha3Code": "RWA" }, + "RE": { "Name": "Réunion", "Alpha2Code": "RE", "Alpha3Code": "REU" }, + "BL": { + "Name": "Saint Barthélemy", + "Alpha2Code": "BL", + "Alpha3Code": "BLM" + }, + "SH": { + "Name": "Saint Helena, Ascension and Tristan da Cunha", + "Alpha2Code": "SH", + "Alpha3Code": "SHN" + }, + "KN": { + "Name": "Saint Kitts and Nevis", + "Alpha2Code": "KN", + "Alpha3Code": "KNA" + }, + "LC": { "Name": "Saint Lucia", "Alpha2Code": "LC", "Alpha3Code": "LCA" }, + "MF": { + "Name": "Saint Martin (French part)", + "Alpha2Code": "MF", + "Alpha3Code": "MAF" + }, + "PM": { + "Name": "Saint Pierre and Miquelon", + "Alpha2Code": "PM", + "Alpha3Code": "SPM" + }, + "VC": { + "Name": "Saint Vincent and the Grenadines", + "Alpha2Code": "VC", + "Alpha3Code": "VCT" + }, + "WS": { "Name": "Samoa", "Alpha2Code": "WS", "Alpha3Code": "WSM" }, + "SM": { "Name": "San Marino", "Alpha2Code": "SM", "Alpha3Code": "SMR" }, + "ST": { + "Name": "Sao Tome and Principe", + "Alpha2Code": "ST", + "Alpha3Code": "STP" + }, + "SA": { "Name": "Saudi Arabia", "Alpha2Code": "SA", "Alpha3Code": "SAU" }, + "SN": { "Name": "Senegal", "Alpha2Code": "SN", "Alpha3Code": "SEN" }, + "RS": { "Name": "Serbia", "Alpha2Code": "RS", "Alpha3Code": "SRB" }, + "SC": { "Name": "Seychelles", "Alpha2Code": "SC", "Alpha3Code": "SYC" }, + "SL": { "Name": "Sierra Leone", "Alpha2Code": "SL", "Alpha3Code": "SLE" }, + "SG": { "Name": "Singapore", "Alpha2Code": "SG", "Alpha3Code": "SGP" }, + "SX": { + "Name": "Sint Maarten (Dutch part)", + "Alpha2Code": "SX", + "Alpha3Code": "SXM" + }, + "SK": { "Name": "Slovakia", "Alpha2Code": "SK", "Alpha3Code": "SVK" }, + "SI": { "Name": "Slovenia", "Alpha2Code": "SI", "Alpha3Code": "SVN" }, + "SB": { + "Name": "Solomon Islands", + "Alpha2Code": "SB", + "Alpha3Code": "SLB" + }, + "SO": { "Name": "Somalia", "Alpha2Code": "SO", "Alpha3Code": "SOM" }, + "ZA": { "Name": "South Africa", "Alpha2Code": "ZA", "Alpha3Code": "ZAF" }, + "GS": { + "Name": "South Georgia and the South Sandwich Islands", + "Alpha2Code": "GS", + "Alpha3Code": "SGS" + }, + "SS": { "Name": "South Sudan", "Alpha2Code": "SS", "Alpha3Code": "SSD" }, + "ES": { "Name": "Spain", "Alpha2Code": "ES", "Alpha3Code": "ESP" }, + "LK": { "Name": "Sri Lanka", "Alpha2Code": "LK", "Alpha3Code": "LKA" }, + "SD": { "Name": "Sudan (the)", "Alpha2Code": "SD", "Alpha3Code": "SDN" }, + "SR": { "Name": "Suriname", "Alpha2Code": "SR", "Alpha3Code": "SUR" }, + "SJ": { + "Name": "Svalbard and Jan Mayen", + "Alpha2Code": "SJ", + "Alpha3Code": "SJM" + }, + "SE": { "Name": "Sweden", "Alpha2Code": "SE", "Alpha3Code": "SWE" }, + "CH": { "Name": "Switzerland", "Alpha2Code": "CH", "Alpha3Code": "CHE" }, + "SY": { + "Name": "Syrian Arab Republic", + "Alpha2Code": "SY", + "Alpha3Code": "SYR" + }, + "TW": { + "Name": "Taiwan (Province of China)", + "Alpha2Code": "TW", + "Alpha3Code": "TWN" + }, + "TJ": { "Name": "Tajikistan", "Alpha2Code": "TJ", "Alpha3Code": "TJK" }, + "TZ": { + "Name": "Tanzania, United Republic of", + "Alpha2Code": "TZ", + "Alpha3Code": "TZA" + }, + "TH": { "Name": "Thailand", "Alpha2Code": "TH", "Alpha3Code": "THA" }, + "TL": { "Name": "Timor-Leste", "Alpha2Code": "TL", "Alpha3Code": "TLS" }, + "TG": { "Name": "Togo", "Alpha2Code": "TG", "Alpha3Code": "TGO" }, + "TK": { "Name": "Tokelau", "Alpha2Code": "TK", "Alpha3Code": "TKL" }, + "TO": { "Name": "Tonga", "Alpha2Code": "TO", "Alpha3Code": "TON" }, + "TT": { + "Name": "Trinidad and Tobago", + "Alpha2Code": "TT", + "Alpha3Code": "TTO" + }, + "TN": { "Name": "Tunisia", "Alpha2Code": "TN", "Alpha3Code": "TUN" }, + "TR": { "Name": "Turkey", "Alpha2Code": "TR", "Alpha3Code": "TUR" }, + "TM": { "Name": "Turkmenistan", "Alpha2Code": "TM", "Alpha3Code": "TKM" }, + "TC": { + "Name": "Turks and Caicos Islands (the)", + "Alpha2Code": "TC", + "Alpha3Code": "TCA" + }, + "TV": { "Name": "Tuvalu", "Alpha2Code": "TV", "Alpha3Code": "TUV" }, + "UG": { "Name": "Uganda", "Alpha2Code": "UG", "Alpha3Code": "UGA" }, + "UA": { "Name": "Ukraine", "Alpha2Code": "UA", "Alpha3Code": "UKR" }, + "AE": { + "Name": "United Arab Emirates (the)", + "Alpha2Code": "AE", + "Alpha3Code": "ARE" + }, + "GB": { + "Name": "United Kingdom of Great Britain and Northern Ireland (the)", + "Alpha2Code": "GB", + "Alpha3Code": "GBR" + }, + "UM": { + "Name": "United States Minor Outlying Islands (the)", + "Alpha2Code": "UM", + "Alpha3Code": "UMI" + }, + "US": { + "Name": "United States of America (the)", + "Alpha2Code": "US", + "Alpha3Code": "USA" + }, + "UY": { "Name": "Uruguay", "Alpha2Code": "UY", "Alpha3Code": "URY" }, + "UZ": { "Name": "Uzbekistan", "Alpha2Code": "UZ", "Alpha3Code": "UZB" }, + "VU": { "Name": "Vanuatu", "Alpha2Code": "VU", "Alpha3Code": "VUT" }, + "VE": { + "Name": "Venezuela (Bolivarian Republic of)", + "Alpha2Code": "VE", + "Alpha3Code": "VEN" + }, + "VN": { "Name": "Viet Nam", "Alpha2Code": "VN", "Alpha3Code": "VNM" }, + "VG": { + "Name": "Virgin Islands (British)", + "Alpha2Code": "VG", + "Alpha3Code": "VGB" + }, + "VI": { + "Name": "Virgin Islands (U.S.)", + "Alpha2Code": "VI", + "Alpha3Code": "VIR" + }, + "WF": { + "Name": "Wallis and Futuna", + "Alpha2Code": "WF", + "Alpha3Code": "WLF" + }, + "EH": { + "Name": "Western Sahara", + "Alpha2Code": "EH", + "Alpha3Code": "ESH" + }, + "YE": { "Name": "Yemen", "Alpha2Code": "YE", "Alpha3Code": "YEM" }, + "ZM": { "Name": "Zambia", "Alpha2Code": "ZM", "Alpha3Code": "ZMB" }, + "ZW": { "Name": "Zimbabwe", "Alpha2Code": "ZW", "Alpha3Code": "ZWE" }, + "AX": { "Name": "Åland Islands", "Alpha2Code": "AX", "Alpha3Code": "ALA" } +} diff --git a/country/country.go b/country/country.go index 92a9aa0..a20ac46 100644 --- a/country/country.go +++ b/country/country.go @@ -25,8 +25,13 @@ func Exists(code string) bool { // Get returns country by given country code. func Get(code string) (Country, bool) { - country, ok := countries[code] - return country, ok + country, ok := countriesWithStructure[code] + if ok { + return country, ok + } + + country2, ok := countries[code] + return country2, ok } // GetBbanStructure returns bban.Structure by given country code. diff --git a/country/data.go b/country/data.go index e71fef2..98ffed1 100644 --- a/country/data.go +++ b/country/data.go @@ -1,11 +1,15 @@ package country import ( + _ "embed" + "github.com/jbub/banking/bban" ) var ( - countries = map[string]Country{ + //go:embed countries.json + countries map[string]Country + countriesWithStructure = map[string]Country{ "AL": { Name: "Albania", Alpha2Code: "AL", From 2e731d5e5ee710dd943ac6eca5ed37c249095a37 Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Thu, 25 Dec 2025 23:30:05 +0800 Subject: [PATCH 4/4] Revert "feat: add all country codes and alphas" This reverts commit c0893620d56e78e5fb68122ba00803c8d9722dc1. --- country/countries.json | 527 ----------------------------------------- country/country.go | 9 +- country/data.go | 6 +- 3 files changed, 3 insertions(+), 539 deletions(-) delete mode 100644 country/countries.json diff --git a/country/countries.json b/country/countries.json deleted file mode 100644 index c800efd..0000000 --- a/country/countries.json +++ /dev/null @@ -1,527 +0,0 @@ -{ - "AF": { "Name": "Afghanistan", "Alpha2Code": "AF", "Alpha3Code": "AFG" }, - "AL": { "Name": "Albania", "Alpha2Code": "AL", "Alpha3Code": "ALB" }, - "DZ": { "Name": "Algeria", "Alpha2Code": "DZ", "Alpha3Code": "DZA" }, - "AS": { - "Name": "American Samoa", - "Alpha2Code": "AS", - "Alpha3Code": "ASM" - }, - "AD": { "Name": "Andorra", "Alpha2Code": "AD", "Alpha3Code": "AND" }, - "AO": { "Name": "Angola", "Alpha2Code": "AO", "Alpha3Code": "AGO" }, - "AI": { "Name": "Anguilla", "Alpha2Code": "AI", "Alpha3Code": "AIA" }, - "AQ": { "Name": "Antarctica", "Alpha2Code": "AQ", "Alpha3Code": "ATA" }, - "AG": { - "Name": "Antigua and Barbuda", - "Alpha2Code": "AG", - "Alpha3Code": "ATG" - }, - "AR": { "Name": "Argentina", "Alpha2Code": "AR", "Alpha3Code": "ARG" }, - "AM": { "Name": "Armenia", "Alpha2Code": "AM", "Alpha3Code": "ARM" }, - "AW": { "Name": "Aruba", "Alpha2Code": "AW", "Alpha3Code": "ABW" }, - "AU": { "Name": "Australia", "Alpha2Code": "AU", "Alpha3Code": "AUS" }, - "AT": { "Name": "Austria", "Alpha2Code": "AT", "Alpha3Code": "AUT" }, - "AZ": { "Name": "Azerbaijan", "Alpha2Code": "AZ", "Alpha3Code": "AZE" }, - "BS": { - "Name": "Bahamas (the)", - "Alpha2Code": "BS", - "Alpha3Code": "BHS" - }, - "BH": { "Name": "Bahrain", "Alpha2Code": "BH", "Alpha3Code": "BHR" }, - "BD": { "Name": "Bangladesh", "Alpha2Code": "BD", "Alpha3Code": "BGD" }, - "BB": { "Name": "Barbados", "Alpha2Code": "BB", "Alpha3Code": "BRB" }, - "BY": { "Name": "Belarus", "Alpha2Code": "BY", "Alpha3Code": "BLR" }, - "BE": { "Name": "Belgium", "Alpha2Code": "BE", "Alpha3Code": "BEL" }, - "BZ": { "Name": "Belize", "Alpha2Code": "BZ", "Alpha3Code": "BLZ" }, - "BJ": { "Name": "Benin", "Alpha2Code": "BJ", "Alpha3Code": "BEN" }, - "BM": { "Name": "Bermuda", "Alpha2Code": "BM", "Alpha3Code": "BMU" }, - "BT": { "Name": "Bhutan", "Alpha2Code": "BT", "Alpha3Code": "BTN" }, - "BO": { - "Name": "Bolivia (Plurinational State of)", - "Alpha2Code": "BO", - "Alpha3Code": "BOL" - }, - "BQ": { - "Name": "Bonaire, Sint Eustatius and Saba", - "Alpha2Code": "BQ", - "Alpha3Code": "BES" - }, - "BA": { - "Name": "Bosnia and Herzegovina", - "Alpha2Code": "BA", - "Alpha3Code": "BIH" - }, - "BW": { "Name": "Botswana", "Alpha2Code": "BW", "Alpha3Code": "BWA" }, - "BV": { - "Name": "Bouvet Island", - "Alpha2Code": "BV", - "Alpha3Code": "BVT" - }, - "BR": { "Name": "Brazil", "Alpha2Code": "BR", "Alpha3Code": "BRA" }, - "IO": { - "Name": "British Indian Ocean Territory (the)", - "Alpha2Code": "IO", - "Alpha3Code": "IOT" - }, - "BN": { - "Name": "Brunei Darussalam", - "Alpha2Code": "BN", - "Alpha3Code": "BRN" - }, - "BG": { "Name": "Bulgaria", "Alpha2Code": "BG", "Alpha3Code": "BGR" }, - "BF": { "Name": "Burkina Faso", "Alpha2Code": "BF", "Alpha3Code": "BFA" }, - "BI": { "Name": "Burundi", "Alpha2Code": "BI", "Alpha3Code": "BDI" }, - "CV": { "Name": "Cabo Verde", "Alpha2Code": "CV", "Alpha3Code": "CPV" }, - "KH": { "Name": "Cambodia", "Alpha2Code": "KH", "Alpha3Code": "KHM" }, - "CM": { "Name": "Cameroon", "Alpha2Code": "CM", "Alpha3Code": "CMR" }, - "CA": { "Name": "Canada", "Alpha2Code": "CA", "Alpha3Code": "CAN" }, - "KY": { - "Name": "Cayman Islands (the)", - "Alpha2Code": "KY", - "Alpha3Code": "CYM" - }, - "CF": { - "Name": "Central African Republic (the)", - "Alpha2Code": "CF", - "Alpha3Code": "CAF" - }, - "TD": { "Name": "Chad", "Alpha2Code": "TD", "Alpha3Code": "TCD" }, - "CL": { "Name": "Chile", "Alpha2Code": "CL", "Alpha3Code": "CHL" }, - "CN": { "Name": "China", "Alpha2Code": "CN", "Alpha3Code": "CHN" }, - "CX": { - "Name": "Christmas Island", - "Alpha2Code": "CX", - "Alpha3Code": "CXR" - }, - "CC": { - "Name": "Cocos (Keeling) Islands (the)", - "Alpha2Code": "CC", - "Alpha3Code": "CCK" - }, - "CO": { "Name": "Colombia", "Alpha2Code": "CO", "Alpha3Code": "COL" }, - "KM": { - "Name": "Comoros (the)", - "Alpha2Code": "KM", - "Alpha3Code": "COM" - }, - "CD": { - "Name": "Congo (the Democratic Republic of the)", - "Alpha2Code": "CD", - "Alpha3Code": "COD" - }, - "CG": { "Name": "Congo (the)", "Alpha2Code": "CG", "Alpha3Code": "COG" }, - "CK": { - "Name": "Cook Islands (the)", - "Alpha2Code": "CK", - "Alpha3Code": "COK" - }, - "CR": { "Name": "Costa Rica", "Alpha2Code": "CR", "Alpha3Code": "CRI" }, - "HR": { "Name": "Croatia", "Alpha2Code": "HR", "Alpha3Code": "HRV" }, - "CU": { "Name": "Cuba", "Alpha2Code": "CU", "Alpha3Code": "CUB" }, - "CW": { "Name": "Curaçao", "Alpha2Code": "CW", "Alpha3Code": "CUW" }, - "CY": { "Name": "Cyprus", "Alpha2Code": "CY", "Alpha3Code": "CYP" }, - "CZ": { "Name": "Czechia", "Alpha2Code": "CZ", "Alpha3Code": "CZE" }, - "CI": { - "Name": "Côte d'Ivoire", - "Alpha2Code": "CI", - "Alpha3Code": "CIV" - }, - "DK": { "Name": "Denmark", "Alpha2Code": "DK", "Alpha3Code": "DNK" }, - "DJ": { "Name": "Djibouti", "Alpha2Code": "DJ", "Alpha3Code": "DJI" }, - "DM": { "Name": "Dominica", "Alpha2Code": "DM", "Alpha3Code": "DMA" }, - "DO": { - "Name": "Dominican Republic (the)", - "Alpha2Code": "DO", - "Alpha3Code": "DOM" - }, - "EC": { "Name": "Ecuador", "Alpha2Code": "EC", "Alpha3Code": "ECU" }, - "EG": { "Name": "Egypt", "Alpha2Code": "EG", "Alpha3Code": "EGY" }, - "SV": { "Name": "El Salvador", "Alpha2Code": "SV", "Alpha3Code": "SLV" }, - "GQ": { - "Name": "Equatorial Guinea", - "Alpha2Code": "GQ", - "Alpha3Code": "GNQ" - }, - "ER": { "Name": "Eritrea", "Alpha2Code": "ER", "Alpha3Code": "ERI" }, - "EE": { "Name": "Estonia", "Alpha2Code": "EE", "Alpha3Code": "EST" }, - "SZ": { "Name": "Eswatini", "Alpha2Code": "SZ", "Alpha3Code": "SWZ" }, - "ET": { "Name": "Ethiopia", "Alpha2Code": "ET", "Alpha3Code": "ETH" }, - "FK": { - "Name": "Falkland Islands (the) [Malvinas]", - "Alpha2Code": "FK", - "Alpha3Code": "FLK" - }, - "FO": { - "Name": "Faroe Islands (the)", - "Alpha2Code": "FO", - "Alpha3Code": "FRO" - }, - "FJ": { "Name": "Fiji", "Alpha2Code": "FJ", "Alpha3Code": "FJI" }, - "FI": { "Name": "Finland", "Alpha2Code": "FI", "Alpha3Code": "FIN" }, - "FR": { "Name": "France", "Alpha2Code": "FR", "Alpha3Code": "FRA" }, - "GF": { - "Name": "French Guiana", - "Alpha2Code": "GF", - "Alpha3Code": "GUF" - }, - "PF": { - "Name": "French Polynesia", - "Alpha2Code": "PF", - "Alpha3Code": "PYF" - }, - "TF": { - "Name": "French Southern Territories (the)", - "Alpha2Code": "TF", - "Alpha3Code": "ATF" - }, - "GA": { "Name": "Gabon", "Alpha2Code": "GA", "Alpha3Code": "GAB" }, - "GM": { "Name": "Gambia (the)", "Alpha2Code": "GM", "Alpha3Code": "GMB" }, - "GE": { "Name": "Georgia", "Alpha2Code": "GE", "Alpha3Code": "GEO" }, - "DE": { "Name": "Germany", "Alpha2Code": "DE", "Alpha3Code": "DEU" }, - "GH": { "Name": "Ghana", "Alpha2Code": "GH", "Alpha3Code": "GHA" }, - "GI": { "Name": "Gibraltar", "Alpha2Code": "GI", "Alpha3Code": "GIB" }, - "GR": { "Name": "Greece", "Alpha2Code": "GR", "Alpha3Code": "GRC" }, - "GL": { "Name": "Greenland", "Alpha2Code": "GL", "Alpha3Code": "GRL" }, - "GD": { "Name": "Grenada", "Alpha2Code": "GD", "Alpha3Code": "GRD" }, - "GP": { "Name": "Guadeloupe", "Alpha2Code": "GP", "Alpha3Code": "GLP" }, - "GU": { "Name": "Guam", "Alpha2Code": "GU", "Alpha3Code": "GUM" }, - "GT": { "Name": "Guatemala", "Alpha2Code": "GT", "Alpha3Code": "GTM" }, - "GG": { "Name": "Guernsey", "Alpha2Code": "GG", "Alpha3Code": "GGY" }, - "GN": { "Name": "Guinea", "Alpha2Code": "GN", "Alpha3Code": "GIN" }, - "GW": { - "Name": "Guinea-Bissau", - "Alpha2Code": "GW", - "Alpha3Code": "GNB" - }, - "GY": { "Name": "Guyana", "Alpha2Code": "GY", "Alpha3Code": "GUY" }, - "HT": { "Name": "Haiti", "Alpha2Code": "HT", "Alpha3Code": "HTI" }, - "HM": { - "Name": "Heard Island and McDonald Islands", - "Alpha2Code": "HM", - "Alpha3Code": "HMD" - }, - "VA": { - "Name": "Holy See (the)", - "Alpha2Code": "VA", - "Alpha3Code": "VAT" - }, - "HN": { "Name": "Honduras", "Alpha2Code": "HN", "Alpha3Code": "HND" }, - "HK": { "Name": "Hong Kong", "Alpha2Code": "HK", "Alpha3Code": "HKG" }, - "HU": { "Name": "Hungary", "Alpha2Code": "HU", "Alpha3Code": "HUN" }, - "IS": { "Name": "Iceland", "Alpha2Code": "IS", "Alpha3Code": "ISL" }, - "IN": { "Name": "India", "Alpha2Code": "IN", "Alpha3Code": "IND" }, - "ID": { "Name": "Indonesia", "Alpha2Code": "ID", "Alpha3Code": "IDN" }, - "IR": { - "Name": "Iran (Islamic Republic of)", - "Alpha2Code": "IR", - "Alpha3Code": "IRN" - }, - "IQ": { "Name": "Iraq", "Alpha2Code": "IQ", "Alpha3Code": "IRQ" }, - "IE": { "Name": "Ireland", "Alpha2Code": "IE", "Alpha3Code": "IRL" }, - "IM": { "Name": "Isle of Man", "Alpha2Code": "IM", "Alpha3Code": "IMN" }, - "IL": { "Name": "Israel", "Alpha2Code": "IL", "Alpha3Code": "ISR" }, - "IT": { "Name": "Italy", "Alpha2Code": "IT", "Alpha3Code": "ITA" }, - "JM": { "Name": "Jamaica", "Alpha2Code": "JM", "Alpha3Code": "JAM" }, - "JP": { "Name": "Japan", "Alpha2Code": "JP", "Alpha3Code": "JPN" }, - "JE": { "Name": "Jersey", "Alpha2Code": "JE", "Alpha3Code": "JEY" }, - "JO": { "Name": "Jordan", "Alpha2Code": "JO", "Alpha3Code": "JOR" }, - "KZ": { "Name": "Kazakhstan", "Alpha2Code": "KZ", "Alpha3Code": "KAZ" }, - "KE": { "Name": "Kenya", "Alpha2Code": "KE", "Alpha3Code": "KEN" }, - "KI": { "Name": "Kiribati", "Alpha2Code": "KI", "Alpha3Code": "KIR" }, - "KP": { - "Name": "Korea (the Democratic People's Republic of)", - "Alpha2Code": "KP", - "Alpha3Code": "PRK" - }, - "KR": { - "Name": "Korea (the Republic of)", - "Alpha2Code": "KR", - "Alpha3Code": "KOR" - }, - "KW": { "Name": "Kuwait", "Alpha2Code": "KW", "Alpha3Code": "KWT" }, - "KG": { "Name": "Kyrgyzstan", "Alpha2Code": "KG", "Alpha3Code": "KGZ" }, - "LA": { - "Name": "Lao People's Democratic Republic (the)", - "Alpha2Code": "LA", - "Alpha3Code": "LAO" - }, - "LV": { "Name": "Latvia", "Alpha2Code": "LV", "Alpha3Code": "LVA" }, - "LB": { "Name": "Lebanon", "Alpha2Code": "LB", "Alpha3Code": "LBN" }, - "LS": { "Name": "Lesotho", "Alpha2Code": "LS", "Alpha3Code": "LSO" }, - "LR": { "Name": "Liberia", "Alpha2Code": "LR", "Alpha3Code": "LBR" }, - "LY": { "Name": "Libya", "Alpha2Code": "LY", "Alpha3Code": "LBY" }, - "LI": { - "Name": "Liechtenstein", - "Alpha2Code": "LI", - "Alpha3Code": "LIE" - }, - "LT": { "Name": "Lithuania", "Alpha2Code": "LT", "Alpha3Code": "LTU" }, - "LU": { "Name": "Luxembourg", "Alpha2Code": "LU", "Alpha3Code": "LUX" }, - "MO": { "Name": "Macao", "Alpha2Code": "MO", "Alpha3Code": "MAC" }, - "MG": { "Name": "Madagascar", "Alpha2Code": "MG", "Alpha3Code": "MDG" }, - "MW": { "Name": "Malawi", "Alpha2Code": "MW", "Alpha3Code": "MWI" }, - "MY": { "Name": "Malaysia", "Alpha2Code": "MY", "Alpha3Code": "MYS" }, - "MV": { "Name": "Maldives", "Alpha2Code": "MV", "Alpha3Code": "MDV" }, - "ML": { "Name": "Mali", "Alpha2Code": "ML", "Alpha3Code": "MLI" }, - "MT": { "Name": "Malta", "Alpha2Code": "MT", "Alpha3Code": "MLT" }, - "MH": { - "Name": "Marshall Islands (the)", - "Alpha2Code": "MH", - "Alpha3Code": "MHL" - }, - "MQ": { "Name": "Martinique", "Alpha2Code": "MQ", "Alpha3Code": "MTQ" }, - "MR": { "Name": "Mauritania", "Alpha2Code": "MR", "Alpha3Code": "MRT" }, - "MU": { "Name": "Mauritius", "Alpha2Code": "MU", "Alpha3Code": "MUS" }, - "YT": { "Name": "Mayotte", "Alpha2Code": "YT", "Alpha3Code": "MYT" }, - "MX": { "Name": "Mexico", "Alpha2Code": "MX", "Alpha3Code": "MEX" }, - "FM": { - "Name": "Micronesia (Federated States of)", - "Alpha2Code": "FM", - "Alpha3Code": "FSM" - }, - "MD": { - "Name": "Moldova (the Republic of)", - "Alpha2Code": "MD", - "Alpha3Code": "MDA" - }, - "MC": { "Name": "Monaco", "Alpha2Code": "MC", "Alpha3Code": "MCO" }, - "MN": { "Name": "Mongolia", "Alpha2Code": "MN", "Alpha3Code": "MNG" }, - "ME": { "Name": "Montenegro", "Alpha2Code": "ME", "Alpha3Code": "MNE" }, - "MS": { "Name": "Montserrat", "Alpha2Code": "MS", "Alpha3Code": "MSR" }, - "MA": { "Name": "Morocco", "Alpha2Code": "MA", "Alpha3Code": "MAR" }, - "MZ": { "Name": "Mozambique", "Alpha2Code": "MZ", "Alpha3Code": "MOZ" }, - "MM": { "Name": "Myanmar", "Alpha2Code": "MM", "Alpha3Code": "MMR" }, - "NA": { "Name": "Namibia", "Alpha2Code": "NA", "Alpha3Code": "NAM" }, - "NR": { "Name": "Nauru", "Alpha2Code": "NR", "Alpha3Code": "NRU" }, - "NP": { "Name": "Nepal", "Alpha2Code": "NP", "Alpha3Code": "NPL" }, - "NL": { - "Name": "Netherlands (the)", - "Alpha2Code": "NL", - "Alpha3Code": "NLD" - }, - "NC": { - "Name": "New Caledonia", - "Alpha2Code": "NC", - "Alpha3Code": "NCL" - }, - "NZ": { "Name": "New Zealand", "Alpha2Code": "NZ", "Alpha3Code": "NZL" }, - "NI": { "Name": "Nicaragua", "Alpha2Code": "NI", "Alpha3Code": "NIC" }, - "NE": { "Name": "Niger (the)", "Alpha2Code": "NE", "Alpha3Code": "NER" }, - "NG": { "Name": "Nigeria", "Alpha2Code": "NG", "Alpha3Code": "NGA" }, - "NU": { "Name": "Niue", "Alpha2Code": "NU", "Alpha3Code": "NIU" }, - "NF": { - "Name": "Norfolk Island", - "Alpha2Code": "NF", - "Alpha3Code": "NFK" - }, - "MP": { - "Name": "Northern Mariana Islands (the)", - "Alpha2Code": "MP", - "Alpha3Code": "MNP" - }, - "NO": { "Name": "Norway", "Alpha2Code": "NO", "Alpha3Code": "NOR" }, - "OM": { "Name": "Oman", "Alpha2Code": "OM", "Alpha3Code": "OMN" }, - "PK": { "Name": "Pakistan", "Alpha2Code": "PK", "Alpha3Code": "PAK" }, - "PW": { "Name": "Palau", "Alpha2Code": "PW", "Alpha3Code": "PLW" }, - "PS": { - "Name": "Palestine, State of", - "Alpha2Code": "PS", - "Alpha3Code": "PSE" - }, - "PA": { "Name": "Panama", "Alpha2Code": "PA", "Alpha3Code": "PAN" }, - "PG": { - "Name": "Papua New Guinea", - "Alpha2Code": "PG", - "Alpha3Code": "PNG" - }, - "PY": { "Name": "Paraguay", "Alpha2Code": "PY", "Alpha3Code": "PRY" }, - "PE": { "Name": "Peru", "Alpha2Code": "PE", "Alpha3Code": "PER" }, - "PH": { - "Name": "Philippines (the)", - "Alpha2Code": "PH", - "Alpha3Code": "PHL" - }, - "PN": { "Name": "Pitcairn", "Alpha2Code": "PN", "Alpha3Code": "PCN" }, - "PL": { "Name": "Poland", "Alpha2Code": "PL", "Alpha3Code": "POL" }, - "PT": { "Name": "Portugal", "Alpha2Code": "PT", "Alpha3Code": "PRT" }, - "PR": { "Name": "Puerto Rico", "Alpha2Code": "PR", "Alpha3Code": "PRI" }, - "QA": { "Name": "Qatar", "Alpha2Code": "QA", "Alpha3Code": "QAT" }, - "MK": { - "Name": "Republic of North Macedonia", - "Alpha2Code": "MK", - "Alpha3Code": "MKD" - }, - "RO": { "Name": "Romania", "Alpha2Code": "RO", "Alpha3Code": "ROU" }, - "RU": { - "Name": "Russian Federation (the)", - "Alpha2Code": "RU", - "Alpha3Code": "RUS" - }, - "RW": { "Name": "Rwanda", "Alpha2Code": "RW", "Alpha3Code": "RWA" }, - "RE": { "Name": "Réunion", "Alpha2Code": "RE", "Alpha3Code": "REU" }, - "BL": { - "Name": "Saint Barthélemy", - "Alpha2Code": "BL", - "Alpha3Code": "BLM" - }, - "SH": { - "Name": "Saint Helena, Ascension and Tristan da Cunha", - "Alpha2Code": "SH", - "Alpha3Code": "SHN" - }, - "KN": { - "Name": "Saint Kitts and Nevis", - "Alpha2Code": "KN", - "Alpha3Code": "KNA" - }, - "LC": { "Name": "Saint Lucia", "Alpha2Code": "LC", "Alpha3Code": "LCA" }, - "MF": { - "Name": "Saint Martin (French part)", - "Alpha2Code": "MF", - "Alpha3Code": "MAF" - }, - "PM": { - "Name": "Saint Pierre and Miquelon", - "Alpha2Code": "PM", - "Alpha3Code": "SPM" - }, - "VC": { - "Name": "Saint Vincent and the Grenadines", - "Alpha2Code": "VC", - "Alpha3Code": "VCT" - }, - "WS": { "Name": "Samoa", "Alpha2Code": "WS", "Alpha3Code": "WSM" }, - "SM": { "Name": "San Marino", "Alpha2Code": "SM", "Alpha3Code": "SMR" }, - "ST": { - "Name": "Sao Tome and Principe", - "Alpha2Code": "ST", - "Alpha3Code": "STP" - }, - "SA": { "Name": "Saudi Arabia", "Alpha2Code": "SA", "Alpha3Code": "SAU" }, - "SN": { "Name": "Senegal", "Alpha2Code": "SN", "Alpha3Code": "SEN" }, - "RS": { "Name": "Serbia", "Alpha2Code": "RS", "Alpha3Code": "SRB" }, - "SC": { "Name": "Seychelles", "Alpha2Code": "SC", "Alpha3Code": "SYC" }, - "SL": { "Name": "Sierra Leone", "Alpha2Code": "SL", "Alpha3Code": "SLE" }, - "SG": { "Name": "Singapore", "Alpha2Code": "SG", "Alpha3Code": "SGP" }, - "SX": { - "Name": "Sint Maarten (Dutch part)", - "Alpha2Code": "SX", - "Alpha3Code": "SXM" - }, - "SK": { "Name": "Slovakia", "Alpha2Code": "SK", "Alpha3Code": "SVK" }, - "SI": { "Name": "Slovenia", "Alpha2Code": "SI", "Alpha3Code": "SVN" }, - "SB": { - "Name": "Solomon Islands", - "Alpha2Code": "SB", - "Alpha3Code": "SLB" - }, - "SO": { "Name": "Somalia", "Alpha2Code": "SO", "Alpha3Code": "SOM" }, - "ZA": { "Name": "South Africa", "Alpha2Code": "ZA", "Alpha3Code": "ZAF" }, - "GS": { - "Name": "South Georgia and the South Sandwich Islands", - "Alpha2Code": "GS", - "Alpha3Code": "SGS" - }, - "SS": { "Name": "South Sudan", "Alpha2Code": "SS", "Alpha3Code": "SSD" }, - "ES": { "Name": "Spain", "Alpha2Code": "ES", "Alpha3Code": "ESP" }, - "LK": { "Name": "Sri Lanka", "Alpha2Code": "LK", "Alpha3Code": "LKA" }, - "SD": { "Name": "Sudan (the)", "Alpha2Code": "SD", "Alpha3Code": "SDN" }, - "SR": { "Name": "Suriname", "Alpha2Code": "SR", "Alpha3Code": "SUR" }, - "SJ": { - "Name": "Svalbard and Jan Mayen", - "Alpha2Code": "SJ", - "Alpha3Code": "SJM" - }, - "SE": { "Name": "Sweden", "Alpha2Code": "SE", "Alpha3Code": "SWE" }, - "CH": { "Name": "Switzerland", "Alpha2Code": "CH", "Alpha3Code": "CHE" }, - "SY": { - "Name": "Syrian Arab Republic", - "Alpha2Code": "SY", - "Alpha3Code": "SYR" - }, - "TW": { - "Name": "Taiwan (Province of China)", - "Alpha2Code": "TW", - "Alpha3Code": "TWN" - }, - "TJ": { "Name": "Tajikistan", "Alpha2Code": "TJ", "Alpha3Code": "TJK" }, - "TZ": { - "Name": "Tanzania, United Republic of", - "Alpha2Code": "TZ", - "Alpha3Code": "TZA" - }, - "TH": { "Name": "Thailand", "Alpha2Code": "TH", "Alpha3Code": "THA" }, - "TL": { "Name": "Timor-Leste", "Alpha2Code": "TL", "Alpha3Code": "TLS" }, - "TG": { "Name": "Togo", "Alpha2Code": "TG", "Alpha3Code": "TGO" }, - "TK": { "Name": "Tokelau", "Alpha2Code": "TK", "Alpha3Code": "TKL" }, - "TO": { "Name": "Tonga", "Alpha2Code": "TO", "Alpha3Code": "TON" }, - "TT": { - "Name": "Trinidad and Tobago", - "Alpha2Code": "TT", - "Alpha3Code": "TTO" - }, - "TN": { "Name": "Tunisia", "Alpha2Code": "TN", "Alpha3Code": "TUN" }, - "TR": { "Name": "Turkey", "Alpha2Code": "TR", "Alpha3Code": "TUR" }, - "TM": { "Name": "Turkmenistan", "Alpha2Code": "TM", "Alpha3Code": "TKM" }, - "TC": { - "Name": "Turks and Caicos Islands (the)", - "Alpha2Code": "TC", - "Alpha3Code": "TCA" - }, - "TV": { "Name": "Tuvalu", "Alpha2Code": "TV", "Alpha3Code": "TUV" }, - "UG": { "Name": "Uganda", "Alpha2Code": "UG", "Alpha3Code": "UGA" }, - "UA": { "Name": "Ukraine", "Alpha2Code": "UA", "Alpha3Code": "UKR" }, - "AE": { - "Name": "United Arab Emirates (the)", - "Alpha2Code": "AE", - "Alpha3Code": "ARE" - }, - "GB": { - "Name": "United Kingdom of Great Britain and Northern Ireland (the)", - "Alpha2Code": "GB", - "Alpha3Code": "GBR" - }, - "UM": { - "Name": "United States Minor Outlying Islands (the)", - "Alpha2Code": "UM", - "Alpha3Code": "UMI" - }, - "US": { - "Name": "United States of America (the)", - "Alpha2Code": "US", - "Alpha3Code": "USA" - }, - "UY": { "Name": "Uruguay", "Alpha2Code": "UY", "Alpha3Code": "URY" }, - "UZ": { "Name": "Uzbekistan", "Alpha2Code": "UZ", "Alpha3Code": "UZB" }, - "VU": { "Name": "Vanuatu", "Alpha2Code": "VU", "Alpha3Code": "VUT" }, - "VE": { - "Name": "Venezuela (Bolivarian Republic of)", - "Alpha2Code": "VE", - "Alpha3Code": "VEN" - }, - "VN": { "Name": "Viet Nam", "Alpha2Code": "VN", "Alpha3Code": "VNM" }, - "VG": { - "Name": "Virgin Islands (British)", - "Alpha2Code": "VG", - "Alpha3Code": "VGB" - }, - "VI": { - "Name": "Virgin Islands (U.S.)", - "Alpha2Code": "VI", - "Alpha3Code": "VIR" - }, - "WF": { - "Name": "Wallis and Futuna", - "Alpha2Code": "WF", - "Alpha3Code": "WLF" - }, - "EH": { - "Name": "Western Sahara", - "Alpha2Code": "EH", - "Alpha3Code": "ESH" - }, - "YE": { "Name": "Yemen", "Alpha2Code": "YE", "Alpha3Code": "YEM" }, - "ZM": { "Name": "Zambia", "Alpha2Code": "ZM", "Alpha3Code": "ZMB" }, - "ZW": { "Name": "Zimbabwe", "Alpha2Code": "ZW", "Alpha3Code": "ZWE" }, - "AX": { "Name": "Åland Islands", "Alpha2Code": "AX", "Alpha3Code": "ALA" } -} diff --git a/country/country.go b/country/country.go index a20ac46..92a9aa0 100644 --- a/country/country.go +++ b/country/country.go @@ -25,13 +25,8 @@ func Exists(code string) bool { // Get returns country by given country code. func Get(code string) (Country, bool) { - country, ok := countriesWithStructure[code] - if ok { - return country, ok - } - - country2, ok := countries[code] - return country2, ok + country, ok := countries[code] + return country, ok } // GetBbanStructure returns bban.Structure by given country code. diff --git a/country/data.go b/country/data.go index 98ffed1..e71fef2 100644 --- a/country/data.go +++ b/country/data.go @@ -1,15 +1,11 @@ package country import ( - _ "embed" - "github.com/jbub/banking/bban" ) var ( - //go:embed countries.json - countries map[string]Country - countriesWithStructure = map[string]Country{ + countries = map[string]Country{ "AL": { Name: "Albania", Alpha2Code: "AL",