Skip to content

Commit

Permalink
Allow new VAT numbers in Belgium (#21)
Browse files Browse the repository at this point in the history
* fix: allow new belgium vat numbers

* fix: changed validation message for BE validation

---------

Co-authored-by: Warre Dreesen <[email protected]>
  • Loading branch information
warredr and Warre Dreesen committed Jan 25, 2024
1 parent 3feabbd commit 0d1d3b9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/vies-dotnet-api/Validators/BEVatValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
namespace Padi.Vies.Validators;

/// <summary>
///
///
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
public sealed class BeVatValidator : VatValidatorAbstract
Expand All @@ -34,14 +34,14 @@ public BeVatValidator()
this.Regex = _regex;
CountryCode = COUNTRY_CODE;
}

protected override VatValidationResult OnValidate(string vat)
{
if (vat.Length == 10 && vat[0] != '0')
if (vat.Length == 10 && vat[0] != '0' && vat[0] != '1')
{
return VatValidationResult.Failed("First character of 10 digit numbers should be 0.");
return VatValidationResult.Failed("First character of 10 digit numbers should be 0 or 1.");
}

if (vat.Length == 9)
{
vat = vat.PadLeft(10, '0');
Expand All @@ -54,4 +54,4 @@ protected override VatValidationResult OnValidate(string vat)
? VatValidationResult.Failed("Invalid BE vat: checkValue.")
: VatValidationResult.Success();
}
}
}

0 comments on commit 0d1d3b9

Please sign in to comment.