Skip to content

Commit

Permalink
Fix numbers starting with 1 (REGEX was not updated)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinLaevaert authored and zapadi committed Mar 28, 2024
1 parent f0eef29 commit 006b894
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/vies-dotnet-api/Validators/BEVatValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Padi.Vies.Validators;
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
public sealed class BeVatValidator : VatValidatorAbstract
{
private const string REGEX_PATTERN = @"^0?\d{9}$";
private const string REGEX_PATTERN = @"^[0|1]?\d{9}$";
private const string COUNTRY_CODE = nameof(EuCountryCode.BE);

private static readonly Regex _regex = new(REGEX_PATTERN, RegexOptions.Compiled, TimeSpan.FromSeconds(5));
Expand Down
12 changes: 8 additions & 4 deletions tests/vies-dotnet-api-test/ViesEUUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public async Task Should_Throw_ViesValidationException(string vat)
[InlineData(" BE8972226a80")]
[InlineData(" BE89722268a0")]
[InlineData(" BE897222680a")]
[InlineData(" BE1602602623")]
[InlineData(" BE1400521335")]
[InlineData(" BE1400521330")]
[InlineData(" BE1400004463")]
[InlineData(" BE2602602623")]
[InlineData(" BE2400521335")]
[InlineData(" BE2400521330")]
[InlineData(" BE2400004463")]
[InlineData(" BE0603601206")]
[InlineData(" BE603601206")]
[InlineData(" BE60260262")]
Expand Down Expand Up @@ -210,6 +210,10 @@ public void Should_Not_Validate_Vat(string vatNumber)
[InlineData(" FRAB012345678")]
[InlineData("PT 980526779")]
[InlineData(" BE0000200334")]
[InlineData("BE1000019421")]
[InlineData(" BE1602602623")]
[InlineData(" BE1400521335")]
[InlineData(" BE1400004463")]
[InlineData("SK2120046819")]
[InlineData("LT684289716")]
[InlineData("LT100003346713")]
Expand Down

0 comments on commit 006b894

Please sign in to comment.