Skip to content

Commit fb5c15b

Browse files
committed
Fix VAT numbers validators
1 parent df544e5 commit fb5c15b

File tree

6 files changed

+50
-43
lines changed

6 files changed

+50
-43
lines changed

nip24Example/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.4.5.0")]
35-
[assembly: AssemblyFileVersion("1.4.5.0")]
34+
[assembly: AssemblyVersion("1.4.6.0")]
35+
[assembly: AssemblyFileVersion("1.4.6.0")]

nip24Example/nip24Example.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>NIP24</RootNamespace>
1111
<AssemblyName>nip24Example</AssemblyName>
12-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1515
<TargetFrameworkProfile />

nip24Library/EUVAT.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -66,34 +66,34 @@ public class EUVAT : IEUVAT
6666

6767
static EUVAT()
6868
{
69-
map.Add("AT", @"ATU\d{8}$");
70-
map.Add("BE", @"BE0\d{9}$");
71-
map.Add("BG", @"BG\d{9,10}$");
72-
map.Add("CY", @"CY\d{8}[A-Z]{1}$");
73-
map.Add("CZ", @"CZ\d{8,10}$");
74-
map.Add("DE", @"DE\d{9}$");
75-
map.Add("DK", @"DK\d{8}$");
76-
map.Add("EE", @"EE\d{9}$");
77-
map.Add("EL", @"EL\d{9}$");
78-
map.Add("ES", @"ES[A-Z0-9]{9}$");
79-
map.Add("FI", @"FI\d{8}$");
80-
map.Add("FR", @"FR[A-Z0-9]{2}\d{9}$");
81-
map.Add("GB", @"GB[A-Z0-9]{5,12}$");
82-
map.Add("HR", @"HR\d{11}$");
83-
map.Add("HU", @"HU\d{8}$");
84-
map.Add("IE", @"IE[A-Z0-9]{8,9}$");
85-
map.Add("IT", @"IT\d{11}$");
86-
map.Add("LT", @"LT\d{9,12}$");
87-
map.Add("LU", @"LU\d{8}$");
88-
map.Add("LV", @"LV\d{11}$");
89-
map.Add("MT", @"MT\d{8}$");
90-
map.Add("NL", @"NL\d{9}B\d{2}$");
91-
map.Add("PL", @"PL\d{10}$");
92-
map.Add("PT", @"PT\d{9}$");
93-
map.Add("RO", @"RO\d{2,10}$");
94-
map.Add("SE", @"SE\d{12}$");
95-
map.Add("SI", @"SI\d{8}$");
96-
map.Add("SK", @"SK\d{10}$");
69+
map.Add("AT", @"^ATU\d{8}$");
70+
map.Add("BE", @"^BE[0-1]{1}\d{9}$");
71+
map.Add("BG", @"^BG\d{9,10}$");
72+
map.Add("CY", @"^CY\d{8}[A-Z]{1}$");
73+
map.Add("CZ", @"^CZ\d{8,10}$");
74+
map.Add("DE", @"^DE\d{9}$");
75+
map.Add("DK", @"^DK\d{8}$");
76+
map.Add("EE", @"^EE\d{9}$");
77+
map.Add("EL", @"^EL\d{9}$");
78+
map.Add("ES", @"^ES[A-Z0-9]{1}\d{7}[A-Z0-9]{1}$");
79+
map.Add("FI", @"^FI\d{8}$");
80+
map.Add("FR", @"^FR[A-Z0-9]{2}\d{9}$");
81+
map.Add("HR", @"^HR\d{11}$");
82+
map.Add("HU", @"^HU\d{8}$");
83+
map.Add("IE", @"^IE[A-Z0-9+*]{8,9}$");
84+
map.Add("IT", @"^IT\d{11}$");
85+
map.Add("LT", @"^LT\d{9,12}$");
86+
map.Add("LU", @"^LU\d{8}$");
87+
map.Add("LV", @"^LV\d{11}$");
88+
map.Add("MT", @"^MT\d{8}$");
89+
map.Add("NL", @"^NL[A-Z0-9+*]{12}$");
90+
map.Add("PL", @"^PL\d{10}$");
91+
map.Add("PT", @"^PT\d{9}$");
92+
map.Add("RO", @"^RO\d{2,10}$");
93+
map.Add("SE", @"^SE\d{12}$");
94+
map.Add("SI", @"^SI\d{8}$");
95+
map.Add("SK", @"^SK\d{10}$");
96+
map.Add("XI", @"^XI[A-Z0-9]{5,12}$");
9797
}
9898

9999
/// <summary>
@@ -113,7 +113,7 @@ public static string Normalize(string nip)
113113
nip = nip.Replace(" ", "");
114114
nip = nip.Trim().ToUpper();
115115

116-
Regex re = new Regex(@"^[A-Z]{2}[A-Z0-9]{2,12}$");
116+
Regex re = new Regex(@"^[A-Z]{2}[A-Z0-9+*]{2,12}$");
117117

118118
if (!re.IsMatch(nip))
119119
{

nip24Library/NIP24Client.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public interface INIP24Client
333333
[ComVisible(true)]
334334
public class NIP24Client : INIP24Client
335335
{
336-
public const string VERSION = "1.4.5";
336+
public const string VERSION = "1.4.6";
337337

338338
public const string PRODUCTION_URL = "https://www.nip24.pl/api";
339339
public const string TEST_URL = "https://www.nip24.pl/api-test";
@@ -1546,21 +1546,21 @@ private XPathDocument Get(Uri url)
15461546
{
15471547
ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072 | (SecurityProtocolType)12288;
15481548
}
1549-
catch (Exception e1)
1549+
catch (Exception)
15501550
{
15511551
// no tls13
15521552
try
15531553
{
15541554
ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;
15551555
}
1556-
catch (Exception e2)
1557-
{
1556+
catch (Exception)
1557+
{
15581558
// no tls12
15591559
try
15601560
{
15611561
ServicePointManager.SecurityProtocol = (SecurityProtocolType)768;
15621562
}
1563-
catch (Exception e3)
1563+
catch (Exception)
15641564
{
15651565
// no tls11
15661566
}

nip24Library/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
// You can specify all the values or you can default the Build and Revision Numbers
2626
// by using the '*' as shown below:
2727
// [assembly: AssemblyVersion("1.0.*")]
28-
[assembly: AssemblyVersion("1.4.5.0")]
29-
[assembly: AssemblyFileVersion("1.4.5.0")]
28+
[assembly: AssemblyVersion("1.4.6.0")]
29+
[assembly: AssemblyFileVersion("1.4.6.0")]
3030

3131
#endif
3232

nip24Library/nip24Library.csproj

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net20;net452;net462;net472;netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
3+
<TargetFrameworks>net20;net452;net462;net472;net48;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
44
<RuntimeIdentifiers>win</RuntimeIdentifiers>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
66

77
<PackageId>NIP24.NIP24Client</PackageId>
8-
<Version>1.4.5</Version>
9-
<AssemblyVersion>1.4.5.0</AssemblyVersion>
10-
<FileVersion>1.4.5.0</FileVersion>
8+
<Version>1.4.6</Version>
9+
<AssemblyVersion>1.4.6.0</AssemblyVersion>
10+
<FileVersion>1.4.6.0</FileVersion>
1111

1212
<Title>NIP24 Service Client</Title>
1313
<Summary>NIP24 Service Client for .NET Framework (C#)</Summary>
@@ -54,4 +54,11 @@
5454
<Reference Include="System.Data" />
5555
<Reference Include="System.Xml" />
5656
</ItemGroup>
57+
58+
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
59+
<Reference Include="System" />
60+
<Reference Include="System.Web" />
61+
<Reference Include="System.Data" />
62+
<Reference Include="System.Xml" />
63+
</ItemGroup>
5764
</Project>

0 commit comments

Comments
 (0)