Giter VIP home page Giter VIP logo

Comments (4)

dannyvankooten avatar dannyvankooten commented on August 20, 2024 1

Perhaps we should throw an Exception if calling the validate method using an unsupported country code prefix?

Currently the library assumes that the validation method is only called after the isCountryCodeInEU( $countryCode ) method on an instance of the Countries class is called. I agree that we should probably design this in a better way... Open to any ideas you might have!

from vat.

gemal avatar gemal commented on August 20, 2024

Let me know if you accept pull requests? Dont want to waste time... :)

from vat.

VincentLanglet avatar VincentLanglet commented on August 20, 2024

Perhaps we should throw an Exception if calling the validate method using an unsupported country code prefix?

This would require a new major version since it's a BC break.

Also, every support of new countries could be considered as a BC break like
#57

Maybe we should let the behavior be decided by the user, with

public function validateVatNumberFormat(string $vatNumber, bool $failIfUnknown = true): bool
{
    // ...
    if (! isset($this->patterns[$country])) {
        return !$failIfUnknown;
    }
    // ...
}

Still, exposing a method to know if the Vat country is supported could be useful

Currently the library assumes that the validation method is only called after the isCountryCodeInEU( $countryCode ) method on an instance of the Countries class is called.

If so, there is currently no call in the VatBundle
https://github.com/ibericode/vat-bundle/blob/32ab2529929952b5921e71763390f7453ca03423/src/Validator/Constraints/VatNumberValidator.php#L15-L51

And the methods/constraints are called validVatNumber and not validEUVatNumber which is an issue.

from vat.

indykoning avatar indykoning commented on August 20, 2024

Somewhat within the same scope i would love to be able to get the patterns themselves per country in some way.
Usecase being the ability to add quick pre-validation using the html "pattern" attribute before making the call to validate the vat id

from vat.

Related Issues (20)

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.