CountryValidator 1.0.0

Country Validator is a library that can be used to validate VAT/TVA codes, social security numbers and TINs (Tax Identification Numbers).

There is a newer version of this package available.
See the version list below for details.
Install-Package CountryValidator -Version 1.0.0
dotnet add package CountryValidator --version 1.0.0
<PackageReference Include="CountryValidator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CountryValidator --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CountryValidator, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CountryValidator as a Cake Addin
#addin nuget:?package=CountryValidator&version=1.0.0

// Install CountryValidator as a Cake Tool
#tool nuget:?package=CountryValidator&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Country Validator

Country Validator is a .NET library that can validate VAT codes, national identification numbers and tax identification numbers for individuals and companies

Features

  • Validate Social Security Numbers/Personal Identity Numbers
  • Validate VAT Codes
  • Validate Tax Indentification Numbers for Individuals
  • Validate Tax Identification Numbers For Companies

How to use Country Validator

Using Validator Class

CountryValidator validator = new CountryValidator();
ValidationResult validationResult = validator.ValidateNationalIdentityCode(ssn, Country.US);
if (validationResult.IsValid)
{
    Console.WriteLine("Valid");
}
else
{
    Console.WriteLine(validationResult.ErrorMessage);
}

Using Data Annotations

[HttpPost]
public IActionResult ValidateSSN([Required, SSNAttribute(Country.US)]string ssn)
{
    if (!ModelState.IsValid)
    {
        //log exception
    }
    return Ok();
}

Live Demo

Social Security Number Validation

VAT Code Validation

License

Copyright 2020 Anghel Valentin

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

Country Validator

Country Validator is a .NET library that can validate VAT codes, national identification numbers and tax identification numbers for individuals and companies

Features

  • Validate Social Security Numbers/Personal Identity Numbers
  • Validate VAT Codes
  • Validate Tax Indentification Numbers for Individuals
  • Validate Tax Identification Numbers For Companies

How to use Country Validator

Using Validator Class

CountryValidator validator = new CountryValidator();
ValidationResult validationResult = validator.ValidateNationalIdentityCode(ssn, Country.US);
if (validationResult.IsValid)
{
    Console.WriteLine("Valid");
}
else
{
    Console.WriteLine(validationResult.ErrorMessage);
}

Using Data Annotations

[HttpPost]
public IActionResult ValidateSSN([Required, SSNAttribute(Country.US)]string ssn)
{
    if (!ModelState.IsValid)
    {
        //log exception
    }
    return Ok();
}

Live Demo

Social Security Number Validation

VAT Code Validation

License

Copyright 2020 Anghel Valentin

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETStandard 1.2

  • .NETStandard 1.6

  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CountryValidator:

Package Downloads
CountryValidator.DataAnnotations
DataAnnotations to validate VAT codes, social security numbers or tin numbers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.2 5,267 8/21/2020
1.1.1 206 8/18/2020
1.1.0 9,911 5/5/2020
1.0.0 212 5/4/2020