ibericode / vat Goto Github PK
View Code? Open in Web Editor NEWPHP library for dealing with European VAT
Home Page: https://packagist.org/packages/ibericode/vat
License: MIT License
PHP library for dealing with European VAT
Home Page: https://packagist.org/packages/ibericode/vat
License: MIT License
Hi, i embedded your lib in a plugin and it works perfectly, but one of my users gets the following error, which seem to be linked to your code:
[08-Apr-2018 13:05:09 UTC] PHP Fatal error: Uncaught Error: Class 'SoapClient' not found in /var/www/html/illustration.tools/public_html/wp-content/plugins/rcp-vat/libs/vendor/dannyvankooten/vat.php/src/Vies/Client.php:63
Stack trace:
#0 /var/www/html/illustration.tools/public_html/wp-content/plugins/rcp-vat/libs/vendor/dannyvankooten/vat.php/src/Vies/Client.php(44): DvK\Vat\Vies\Client->getClient()
#1 /var/www/html/illustration.tools/public_html/wp-content/plugins/rcp-vat/libs/vendor/dannyvankooten/vat.php/src/Validator.php(93): DvK\Vat\Vies\Client->checkVat('39', '281928M')
#2 /var/www/html/illustration.tools/public_html/wp-content/plugins/rcp-vat/admin/class-rcp-vat-admin.php(666): DvK\Vat\Validator->validateExistence('39281928M')
#3 /var/www/html/illustration.tools/public_html/wp-content/plugins/rcp-vat/admin/class-rcp-vat-admin.php(724): Rcp_Vat_Admin->validateUserFields(Array, 'register')
#4 /var/www/html/illustration.tools/public_html/wp-includes/class-wp-hook.php(286): Rcp_Vat_Admin->rcp_vat_rcp_validate_user_fields_on_register(Array)
#5 /var/w in /var/www/html/illustration.tools/public_html/wp-content/plugins/rcp-vat/libs/vendor/dannyvankooten/vat.php/src/Vies/Client.php on line 63```
Any idea ?
Thanks
some countries has a modulus 11 check build into the number
The VAT validator should be able to check that
Pleas rollback composer changes: bf3dcf2
As of 01/01/2021 (Brexit) the Vies validator no longer supports GB VAT numbers.
Currently this library still supports validateVatNumberFormat('GB000000000') as true, but running validate on any GB code throws a ViesException of invalid input.
There is a (new) API from the UK here - Would you be open to a PR that added support for GB numbers using this or do you want to stay EU/Vies specific?
As desribed at https://ec.europa.eu/taxation_customs/vies/faqvies.do#item_11 :
'XI' => '(GD\d{3}|HA\d{3}|\d{9}|\d{12})'
Just something I learned today, VIES only manages VAT numbers where the company has to pay VAT. For example Doctors or Libraries in Belgium don't have to pay VAT, but they have a VAT number. However you won't find those VAT numbers on VIES.
So I think the method name "validateExistence()" is not 100% accurate.
besides that: thanks for this library!
Could you add San Marino (SM)?
Thanks
As title, according to the .travis.yml file, it only tests for php-7.3
and php-7.4
versions.
When looking at the composer.json file, it requires php-7.1
version at least.
What's the PHP versions requirements currently? If this package requires php-7.1
and php-7.2
, it should add above PHP version tests during Travis CI building.
Otherwise, it should modify the composer.json
and using the >=7.3
to let this package require php-7.3
version at least.
Once this issue is accepted by repository owner, I will be happy to work on this.
This is a valid Spain VAT Number recording to MIAS:
B57391567 (https://ec.europa.eu/taxation_customs/vies/#/vat-validation)
Since the validator checks for ISO-3316 alpha-2 country codes, it always fails.
Hi, I would suggest renaming the functions, your "$countries->inEurope()" lists countries in EU, not in Europe - I mean, Switzerland is in Europe but not in EU. It's bit confusing and the code is not easily readable. However, thanks for a great plugin!
To ease maintainability.
With ip2country.info
dead, we need more implementations of Ibericode\Vat\Geolocation\GeolocatorInterface
.
Ibericode\Vat\Geolocation\IP2C is an example implementation.
Happy to accept PR's for this!
being able to check if here is a pattern for a country would it possible to add fx VAT number format check for Norway
so I could first do a check for "hasPattern" and then call the validateVatNumberFormat if hasPattern returned true
Today all numbers from Norway return false due to this check:
if (! isset($this->patterns[$country])) {
return false;
}
For some countries, like ours, the VIES data service returns linked company info. We would like to be able to retrieve that info too, if a VAT number exists.
VIES FAQ:
https://ec.europa.eu/taxation_customs/vies/faq.html#item_17
VIES Example:
https://ec.europa.eu/taxation_customs/vies/vatResponse.html
NL 809901973B01
It was requested in v1.2.1 with a PR before, but it was closed without getting into master branch.
#22
By giving a country code and business id, a function could return a VAT ID formatted to international format.
Examples:
format('FI', '1234567-1') would return FI12345671
format('SE', '556697-6009') would return SE556697600901
Hi, I see your package relies on this (https://github.com/adamcooke/vat-rates) which is no more available.
So your package will still be able to get updated VAT rates by countries?
Composer requires php >= 7.0 but documentation says it is supported by PHP 5.6+.
Haven't tested compatibility yet.
Hi,
I'm getting this weird errorwhen i'm trying to use the library: "SSL certificate problem: unable to get local issuer certificate curl". Am i doing something wrong?
Doing the same process as months ago, today IĀ“m getting this error:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl' : Premature end of data in tag html line 1
I have no clue how all this VAT stuff works, that's why I'm using mpociot/vat-calculator
at the moment. I saw that the other package has exceptions for cities:
I didn't see this used in your package. Is this something you should consider? Sorry again for not knowing anything about VAT, but I thought it's something you want to be aware of.
From now on Belgian VAT numbers can start with a 1 instead of a zero, will they be validated correctly?
This could just be my setup but I was getting failure when
IbericodeVatRatesClient fetch() was being called. Returning an empty body and no status code. Throwing an exception preventing all other code doing-the-do.
Had to add in curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); to get it to work, not ideal as a temp mod to the main library... but might be an cert issue on the HTTPS for https://raw.githubusercontent.com/ibericode/vat-rates/master/vat-rates.json that needs resolving? Or could be something else but this fixed it for me.
Looks like ip2country.info is now ipapi.com and requires an API key to be used. I think we should follow suit and add a provider for that.
The library is crashing because https://jsonvat.com has an expired certificate.
Please change https://jsonvat.com/ to http://jsonvat.com/ by removing the https or add a rule to curl to accept invalid certificate.
Where data from jsonvat.com is stored locally.
I'm trying to grab VAT rates for specific countries but i always get the error:
Invalid country code "country"
What i'm doing:
$rates = new Rates($_SERVER["DOCUMENT_ROOT"].'assets/vat.txt');
$rate = $rates->getRateForCountry('NL'); // 21
return $rate;
Goodbye jsonvat.com š
The jsonvat.com service has now been discontinued. Please find an alternative source for your EU VAT rates.
The work required to keep such a database up to date is too much for me to handle solo. It should be up to the European Union to provide this service rather than an individual like me.
So what we do now.
I tried to use
$rates = new Ibericode\Rates\Rates('/path-for-storing-cached-file');
but got the error message:
file_put_contents(ā¦): failed to open stream: Is a directory
Now I changed it to: new Ibericode\Rates\Rates('/path-for-storing-cached-file/rates.txt');`
and it worked.
So firstly, I just noticed that the standard geoip-service, ip2c.org, doesn't support IPv6. That, combined with the fact that the ip2country.info service is only for open source projects, might create some issues.
Secondly, the provider for ip2country.info uses urlencode()
on the ip-addresses. While that doesn't cause issues for Ipv4 addresses (a period .
is encoded to a period .
), it does cause issues for IPv6 addresses, which uses colons instead of periods. Colons :
are translated to %3A
, while the ip2country.info API expects a :
.
I'm going to be submitting a pull request which fixes this issue in a few minutes, by removing the urlencode
. But it might be wise to consider a ip2country service which allows closed-source projects to use it with IPv6, so closed-source projects can use this library with IPv6.
I might end up submitting a pull request with a new service, if I can find a IPv6-ready, GDPR-compliant IP2Country service.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.