return false if input to validation is empty string
This commit is contained in:
parent
a17c03a45c
commit
d8f5895dbb
1 changed files with 4 additions and 0 deletions
|
@ -49,7 +49,11 @@ namespace FCS.Lib.Utility
|
||||||
/// <returns>bool indicating if the vat number conform to country specification</returns>
|
/// <returns>bool indicating if the vat number conform to country specification</returns>
|
||||||
public static bool CheckVat(string countryCode, string vatNumber)
|
public static bool CheckVat(string countryCode, string vatNumber)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(vatNumber))
|
||||||
|
return false;
|
||||||
|
|
||||||
var sanitizedVat = SanitizeVatNumber(vatNumber);
|
var sanitizedVat = SanitizeVatNumber(vatNumber);
|
||||||
|
|
||||||
return countryCode.ToUpperInvariant() switch
|
return countryCode.ToUpperInvariant() switch
|
||||||
{
|
{
|
||||||
"DK" => ValidateDkVat(sanitizedVat),
|
"DK" => ValidateDkVat(sanitizedVat),
|
||||||
|
|
Loading…
Reference in a new issue