Comments (4)
Thank you @johanwilfer for mentioning this. We have noticed the difference in the VAT prefix and the international country code, but as all things from the European Commission, exceptions on the rule must exist.
I agree that this exception should be documented in the code to make it clear for developers and integrators why this exception exists, maybe even add this as a separate remark in the README.md
to emphasise the difference that it's not a bug, but a feature 😸 So, just updated the README.
Just for my understanding: this VIES library processes the Greece VAT IDN's correctly, right? It's just that the prefix EL is different from the international ISO code for Greece, being GR. Correct?
Just to verify, I've added the Greece railway company Train OSE SA in my example, returning valid information after validation:
Valid
Identifier: WAPIAAAAWcNVzowR
Date and time: 13/11/2018 01:00
Company name: ΤΡΑΙΝΟΣΕ ΜΕΤΑΦΟΡΕΣ ΜΕΤΑΦΟΡΙΚΕΣ ΥΠΗΡΕΣΙΕΣ ΕΠΙΒΑΤΩΝ ΚΑΙ ΦΟΡΤΙΟΥ ΑΝΩΝΥΜΗ ΣΙΔΗΡΟΔΡΟΜΙΚΗ ΕΤΑΙΡΕΙΑ ||ΤΡΑΙΝΟΣΕ ΑΕ
Company address: ΚΑΡΟΛΟΥ 1-3 10437 - ΑΘΗΝΑ
from vies.
Yes, the validation works great. I just tested this also.
The problem for us was that we use the list in the mentioned method to show/hide the VAT inputs, so we didn't even ask for it for Greek customers as there was no country "EL" selected...
Thanks for updating the README about this. :-)
from vies.
@johanwilfer You're very welcome. Only with this kind of feedback I can make the information more meaningful for users, especially when you're not engaging with VAT related things on a regular basis. The more I receive this type of not expected behaviour, the better use cases I can come up with and more accurate we can make our pre-validation before we fire things of to the EC VIES service.
from vies.
Old but still
GR <-> EL
As i read: GR is a country iso,
and EL is a VAT prefix.
VIES_EU_COUNTRY_LIST
contains country iso as keys.
So 'EL' => ['name' => 'Greece', 'validator' => Validator\ValidatorEL::class],
is actually a bad choice.
We may should change that in next major release to GR
(may add additional row with GR inthe current lastest version),
to keep the keys as country iso only,
and add an additional value 'vat_prefix' => 'EL'
(optionally).
Every method should look up the vat prefix in the array instead using the country iso.
Example:
https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L491
$requestParams = [
'countryCode' => $countryCode,
'vatNumber' => $testVatNumber,
];
Should then look like
$requestParams = [
'countryCode' => $this->getVatPrefix($countryIso),
'vatNumber' => $testVatNumber,
];
// ...
public function getVatPrefix($countryIso)
{
if (!isset(self::VIES_EU_COUNTRY_LIST[$countryIso])) {
// todo throw exception "invalid ..."
}
if (!isset(self::VIES_EU_COUNTRY_LIST[$countryIso]['var_prefix'])) {
// VAT has a vat prefix that is NOT the same as the country iso.
return self::VIES_EU_COUNTRY_LIST[$countryIso]['var_prefix'];
}
// VAT has a vat prefix that is the same as the country iso.
return $countryIso;
}
TODO: does VIES expect the VAT prefix, or the real country iso?
Should we name it "vat prefix" or "country code"? Perhaps country code since this is already the case in lots of code already.
from vies.
Related Issues (20)
- Validation of Irish VAT ID failed for valid VAT ID HOT 7
- Making VIES package more inclusive
- Missing BG checksum validation for foreign natual persons
- VIES_EU_COUNTRY_LIST Visibility HOT 1
- Package upgrade to composer 2.0
- Ensure this package can be installed with Composer 2.0
- Implementing a Symfony constraint based on this library HOT 2
- Remove support for the United Kingdom ("GB") HOT 16
- Add support for United Kingdom (Northern Ireland) ("GB-NIR") HOT 7
- Support php8
- Validation failed for valid VAT numbers HOT 8
- 32 Bit Support HOT 1
- The service moved to SSL endpoint. HOT 1
- use of ::VIES_EXCLUDED_COUNTRY_CODES
- ValidatorLV results inconsistent with official EU validation
- heartbeat is not working anymore HOT 12
- Cannot populate CheckVatResponse after using `toArray`
- Optional Argument Validation Fails for ® HOT 2
- Heathbeat check always false HOT 1
- GetAddress non getting separated city, zip
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 vies.