Prestashop: Incorrect verification of the VAT number for a customer who does not have an EU VAT number

Created on 29 Nov 2020  Â·  14Comments  Â·  Source: PrestaShop/PrestaShop

Describe the bug

After installing the European VAT number add-on, and enabling the automatic checking of registration in the VIES database, the module works correctly only for taxpayers registered in this database - i.e. deducts the tax due in the country of purchase from the total of purchases.
If you enter a VAT number that is not registered in the EU VIES VAT database - the system displays the error "VAT number not found".
This is a correct message only if we assume that the field in the form is used to enter the VAT number of registered taxpayers in the VIES database.
If the taxpayer has the correct number but is not registered in the VIES database, the module prevents him from processing the order.
The data form cannot contain two different fields for entering the VAT number (in a given country) and EU VAT - and this is the only solution at the moment (wrong in assumption).

Expected behavior

Enabling the module should for registered VAT VIES taxpayers for tax deduction upon purchase, for taxpayers not registered in the VIES database, the system should validate the EU VAT field in terms of entering the VAT number, and prevent the deduction of due tax, informing that the taxpayer is not entitled to a tax deduction.

Steps to Reproduce

Steps to reproduce the behavior:

Module version 2.1.0
configure the module like this:

Customers' country: eg. Poland
Enable checking of the VAT number with the web service: Enable

Go through the purchase process in the store
register customer (company) data
enter EU VAT eg. PL5862283151
Saving the form causes the error "VAT number not found"

Screenshots

If applicable, add screenshots or screen recordings to help explain your problem.

Additional information

  • PrestaShop version: 1.7.6.8
  • PHP version: 7.2
1.7.6.8 Addresses Bug FO TBS Vatnumber waiting for PM

Most helpful comment

@m4dh Important issue. I think he should not enter the VAT at all, if he is not a VAT payer.

That is a problem, because when you disable VIES check, all VAT numbers are taken as VAT payers and VAT is deducted. (VIES is not available from time to time and I had to disable it, because our customers could not make orders, when the module could not connect to VIES.)

I think what should be done is.

VIES check enabled

  • If he enters invalid (locally checked) VAT number, "VAT number invalid", VAT not deducted
  • If he enters VAT number and it's VIES validated, "VAT number is valid", VAT deducted
  • If he enters VAT number and it's not VIES validated, "Not a VAT payer", VAT not deducted
  • If he enters VAT number and VIES validation fails, display checkbox: "I am a VAT payer".

VIES check disabled

  • If he enters invalid (locally checked) VAT number, "VAT number invalid", VAT not deducted
  • If he enters (locally checked) valid VAT number, display checkbox below the field: "I am a VAT payer". Only then the VAT would be deducted.

All 14 comments

Uploading Zrzut ekranu 2020-11-29 o 00.02.15.png…

@m4dh Important issue. I think he should not enter the VAT at all, if he is not a VAT payer.

That is a problem, because when you disable VIES check, all VAT numbers are taken as VAT payers and VAT is deducted. (VIES is not available from time to time and I had to disable it, because our customers could not make orders, when the module could not connect to VIES.)

I think what should be done is.

VIES check enabled

  • If he enters invalid (locally checked) VAT number, "VAT number invalid", VAT not deducted
  • If he enters VAT number and it's VIES validated, "VAT number is valid", VAT deducted
  • If he enters VAT number and it's not VIES validated, "Not a VAT payer", VAT not deducted
  • If he enters VAT number and VIES validation fails, display checkbox: "I am a VAT payer".

VIES check disabled

  • If he enters invalid (locally checked) VAT number, "VAT number invalid", VAT not deducted
  • If he enters (locally checked) valid VAT number, display checkbox below the field: "I am a VAT payer". Only then the VAT would be deducted.

Hello @m4dh

I managed to reproduce your issue with PS1.7.6.9 and PS1.7.7.0-rc.1, I attached a screen reocrd below:

https://drive.google.com/file/d/1mbPZaDYY-l-SCPWIkn0aH3VEQqztpatn/view

But like @Hlavtox mentioned above, this issue need to be reviewed.
Ping @PrestaShop/product-team wdyt of @Hlavtox suggestion?

PS: My question for @PrestaShop/prestashop-core-developers is "is it normal to have HTTP ERROR 500 when the debug mode is enabled, while reproducing this issue?"

Thanks!

Hi,

I wish we had the same state of knowledge;

A VAT payer may or may not be registered in VIES - registration determines
foreign transactions, if he sells abroad he must register with VIES.
The module for persons registered in VIES works correctly, but if I am a
VAT payer and I am not registered in VIES, the system should allow me to
enter a VAT number that is not registered in VIES, therefore, to enable a
domestic transaction, there may be a situation where a customer from abroad
is not registered with VIES, in this case he should be treated as a VAT
taxpayer who is not entitled to tax deduction.

the module should allow for the following procedures:

purchased by a VIES registered taxpayer allowing for withholding tax
deduction

purchase by a taxpayer not registered in VIES - informing that the taxpayer
is not registered in VIES - (at the moment the module blocks the purchase
of these taxpayers)
This situation is specific to those buyers who are VAT payers but are not
registered with VIES

In addition, I would add functionality - if validation in VIES was not
available during the purchase - the system would inform about the lack of
validation and inform that on this basis it is not possible to determine
whether there is a right to deduct the tax charged by the seller.

Validation in VIES should be recorded in the order form, e.g. in the
billing address field.

Best Regards,
Grzeg @m4dh

pon., 30 lis 2020 o 10:50 Hibatallah Aouadni notifications@github.com
napisał(a):

Hello @m4dh https://github.com/m4dh

I managed to reproduce your issue with PS1.7.6.9 and PS1.7.7.0-rc.1, I
attached a screen reocrd below:

https://drive.google.com/file/d/1mbPZaDYY-l-SCPWIkn0aH3VEQqztpatn/view

But like @Hlavtox https://github.com/Hlavtox mentioned above, this
issue need to be reviewed with @PrestaShop/product-team
https://github.com/orgs/PrestaShop/teams/product-team
Ping @PrestaShop/product-team
https://github.com/orgs/PrestaShop/teams/product-team wdyt of @Hlavtox
https://github.com/Hlavtox suggestion?

PS: My question for @PrestaShop/prestashop-core-developers
https://github.com/orgs/PrestaShop/teams/prestashop-core-developers is
"is it normal to have HTTP ERROR 500 when the debug mode is enabled,
while reproducing this issue?"

Thanks!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/PrestaShop/PrestaShop/issues/22153#issuecomment-735677771,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABVVEL5Q2D2LKITBA4TRD7LSSNTGPANCNFSM4UGC2ZVA
.

@m4dh VIES does not have any central database. It checks the VAT number agains databases of the member states.

Hi @Hlavtox https://github.com/Hlavtox

It doesn't matter how many databases are they, module should allow for
transactions to be made by any VAT payer, regardless of whether he has a
reported VAT Vies number or not.

Regards,
Greg

pon., 30 lis 2020 o 13:43 Daniel Hlavacek notifications@github.com
napisał(a):

@m4dh https://github.com/m4dh VIES does not have any central database.
It checks the VAT number agains databases of the member states.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/PrestaShop/PrestaShop/issues/22153#issuecomment-735763458,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABVVEL4A4MW6IVHA42KRN4LSSOHORANCNFSM4UGC2ZVA
.

@m4dh Of course, but I think we disagree on this - "but if I am a VAT payer and I am not registered in VIES, the system should allow me to enter a VAT number that is not registered in VIES" - Every VAT payer should be validated successfully by VIES.

And I don't know about laws in your country, but if a buyer is not a VAT payer, he should not enter the VAT to the order at all, because he is confusing the other side of the bussiness by this. Last week a woman from Slovakia made order on our store, entered VAT number, paid XX EUR less because Prestashop deducted the tax. Now we found out she is not a VAT payer and she does not want to pay the rest of it.

Hi @Hlavtox https://github.com/Hlavtox

Either we don't understand each other or you misunderstand how the VIES
base works.

You wrote:
Every VAT payer should be validated successfully by VIES.

This is not true - because only those who are payers registered to the EU
VAT system are validated in the VIES database, the rest will not be
validated

Example
this is my EU VAT number PL5861474009 which passes validation because it is
registered to EU VAT database, and this is my second company that is a VAT
payer but is not registered to VAT EU PL5862283151 and will not pass
validation in the VIES database.

I can make a purchase abroad using both numbers, but the purchase using the
number PL5861474009 - should allow for the deduction of VAT, and the
purchase using the number PL5862283151 should not allow the deduction of
VAT.

When using the module for validating payers from the same country - the
module should charge both my VAT numbers from the same country as the
seller.

The module should distinguish between both payers and prevent VAT deduction
if my shop is registered e.g. in Poland, and the customer is also from
Poland (but has VAT EU registration). This exception probably took place in
your store, I received a report from the customer about this irregularity,
so I disabled this module and reported an error, I additionally analyzed
the incorrect operation of this module due to the lack of handling of the
exceptions described above.

PS: The rules for charging VAT in the entire EU are the same.

Regards,
Greg

pon., 30 lis 2020 o 14:24 Daniel Hlavacek notifications@github.com
napisał(a):

@m4dh https://github.com/m4dh Of course, but I think we disagree on
this - "but if I am a VAT payer and I am not registered in VIES, the
system should allow me to enter a VAT number that is not registered in
VIES"

Every VAT payer should be validated successfully by VIES.

And I don't know about laws in your country, but if a buyer is not a VAT
payer, he should not enter the VAT to the order at all, because he is
confusing the other side of the bussiness by this. Last week a woman from
Slovakia made order on our store, entered VAT number, paid XX EUR less
because Prestashop deducted the tax. Now we fould out she is not a VAT
payer and she does not want to pay the rest of it.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/PrestaShop/PrestaShop/issues/22153#issuecomment-735783173,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABVVEL7Q2HYXVZEA4RRP3E3SSOMIZANCNFSM4UGC2ZVA
.

@m4dh So, you have a company, you have a VAT PL5862283151, you add 21% VAT to your products, but you are not VIES validated? Right?

Correct. (23% in Poland)

pon., 30 lis 2020 o 15:41 Daniel Hlavacek notifications@github.com
napisał(a):

@m4dh https://github.com/m4dh So, you have a company, you have a VAT
PL5862283151, you add 21% VAT to your products, but you are not VIES
validated? Right?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/PrestaShop/PrestaShop/issues/22153#issuecomment-735826676,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABVVEL54R3GL5KWMFXMH2A3SSOVKRANCNFSM4UGC2ZVA
.

@m4dh Hmmm, lack of knowledge on my side, sorry. If I'm not wrong, in Czech republic, all VAT payers are automatically registered to "EU VAT system".

BUT, I think it's not a problem. The module should do VIES-checking only when customer selects other country than your 'home' one.

Hi @Hlavtox https://github.com/Hlavtox

Sure, in this particular case of course, keep in mind that this is not the
only case in which we validate this field. We still validate them for the
purposes of:
1.entering the correct VAT number (for domestic transactions)
2.entering the correct VAT-EU number (for cross-border transactions)

I am writing this so that developers who will fix this error know that the
EU VAT field should be validated in a multi-variant way.

Daniel, I do not want to prove anything to anyone, forgive me, but
registration in VAT-EU in many countries is an additional activity (like
Poland, GB, Cyprus, NL)
It would seem obligatory, but when registering the company to the tax
office, the VAT-EU registration is addictionally completed.
If for a certain period of time (in Poland it is 3 months) no cross-border
transactions are made, the registration is suspended.

Regards,
Greg

wt., 1 gru 2020 o 09:46 Daniel Hlavacek notifications@github.com
napisał(a):

@m4dh https://github.com/m4dh Hmmm, lack of knowledge on my side,
sorry. If I'm not wrong, in Czech republic, all VAT payers are
automatically registered to "EU VAT system".

BUT, I think it's not a problem. The module should do VIES-checking only
when customer selects other country than your 'home' one.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/PrestaShop/PrestaShop/issues/22153#issuecomment-736317784,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABVVEL3GCN5O6IUWY2YLDUTSSSUPPANCNFSM4UGC2ZVA
.

@eternoendless Hi Pablo, if we put together a proper specs with @m4dh, would there be a time in PS dev team, to tweak this module a bit, so we have it working properly? It's quite important topic...

I reported some bugs here also - https://github.com/PrestaShop/PrestaShop/issues/19634

is the same in Italy:

To be brief, if the seller is European and sells to a European customer, the VAT number of the customer must be registered with VIES only if the customer has a billing address outside the country of the Seller.
VIES VAT registration is needed only for import/export not for national selling.

I did a minor fast Fix to the mechanic here: https://github.com/PrestaShop/vatnumber/pull/16
but i still working on a new version with more control over the VAT syntax.

My fix not resolve anyway the error 500 of the original module if debug is enabled.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PrestaShark picture PrestaShark  Â·  3Comments

itisco picture itisco  Â·  3Comments

marionf picture marionf  Â·  3Comments

centoasa picture centoasa  Â·  3Comments

nrcjea001 picture nrcjea001  Â·  3Comments