Comments (4)
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.
Let me know if you accept pull requests? Dont want to waste time... :)
from vat.
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 theCountries
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.
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)
- Update readme for "path-for-storing-cached-file"
- IPv6 and the Geolocators HOT 2
- Error while trying to validate VAT HOT 1
- The jsonvat.com service has now been discontinued HOT 1
- Current PHP version requirements HOT 1
- Please rollback to php 7.1 or 7.3 HOT 2
- use https for vies
- Add VAT modulus11 check for countries HOT 4
- RegEx for Northern Ireland (XI) HOT 2
- vat rates package abandoned? HOT 1
- Get linked company info if VAT number exists HOT 1
- UK/GB Vat number support HOT 2
- Use WSDL for obtaining VAT rates
- Always Invalid country code when trying to get rates HOT 1
- CURL Refresh Fails HOT 2
- ip2country.info is dead? HOT 1
- Additional Geolocator implementations
- BE vat numbers starting with 1 instead of 0 HOT 3
- Single country char
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vat.