Giter Club home page Giter Club logo

countryvalidator's People

Contributors

anghelvalentin avatar heikomilke avatar matthewsteeples avatar tonyqus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

countryvalidator's Issues

Valid Ssn number returned as invalid (for Belgium)

Hi,

For several cases, SSN number in Belgium failed to validate correctly. Indeed, in BelgiumValidation class, line 50 :
bool isValid = ModFunction(nrToCheck).ToString() == checkDigit;
At that time, if checkDigit has a number below 10, it fails. It seems that int type doesn't keep the 0 in the beginning of a number.

For exemple :
checkDigit returns '09' and ModFunction returns '9'.

You can try with this SSN : 96091736909

Thanks for your time !

Current Dutch VAT numbers do not validate

Hi,

I am not really sure about this, but aparrently the Netherlands has changed the format of their VAT numbers. The number NL000099998B57 (example taken from this webpage of the Dutch goverment) does not validate.

Validate Swiss TVA

It does not allow me to validate the Swiss tva, the error is:
"input string was not in a correct format".
My code:
image

When I enter the same data in the demo validator it works, where can I check the format of the string I have to pass to the "CountryValidator" method?
https://randommer.io/SocialNumber/VatValidator
image

Doc format:
CHE-xxx.xxx.xxx TVA

Finnish VAT number spec has been changed since 1.1.2023

public override ValidationResult ValidateIndividualTaxCode(string id)
{
if (!Regex.IsMatch(id, "^[0-9]{6}[-+A][0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$"))
{
return ValidationResult.Invalid("Invalid code");
}
var day = int.Parse(id.Substring(0, 2));
var month = int.Parse(id.Substring(2, 2));
var year = int.Parse(id.Substring(4, 2));
var centuries = new Dictionary<char, int>(){
{ '+', 1800 },
{ '-', 1900},
{ 'A', 2000}
};
year = centuries[id[6]] + year;
try
{
DateTime date = new DateTime(year, month, day);
if (date > DateTime.Now)
{
return ValidationResult.InvalidDate();
}
}
catch
{
return ValidationResult.InvalidDate();
}
var individual = int.Parse(id.Substring(7, 3));
if (individual < 2)
{
return ValidationResult.Invalid("Invalid");
}
var n = id.Substring(0, 6) + id.Substring(7, 3);
long intn = long.Parse(n);
return "0123456789ABCDEFHJKLMNPRSTUVWXY"[(int)intn % 31] == id[10] ? ValidationResult.Success() : ValidationResult.InvalidChecksum();
}

There are new separator characters being introduced in addition to -, + and A.

More information and test data available here: https://dvv.fi/en/reform-of-personal-identity-code

Wrong calculation for Israel ID

HI.
Israel ID allows digits only, but your logic considers the following value "AA1404105" as valid.
I suggest adding

 public override ValidationResult ValidateIndividualTaxCode(string ssn)
        {
            ssn = ssn.RemoveSpecialCharacthers();
            if (ssn?.Length != 9)
            {
                return ValidationResult.Invalid("Invalid length. The code must have 9 digits");
            }

            **if (!ssn.All(char.IsDigit))
            {
                return ValidationResult.Invalid("Only digits are allowed");
            }**

Stack overflow on VATIN verification

foreach (var supportedCountry in CountryValidation.CountryValidator.SupportedCountries)
{
    var countryEnum = Enum.Parse<CountryValidation.Country>(supportedCountry);
    var result = validator.ValidateVAT("K7399859412", countryEnum);
    if (result.IsValid)
    {
        return true;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.