Skip to content

VAT Id Number validators for all EU countries #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 177 commits into
base: master
Choose a base branch
from

Conversation

homebeaver
Copy link
Contributor

Hi @garydgregory ,

here is EUgen from Europe.
With this PR I provide validation and check digit calculation for VAT Id Numbers VATIN for all countries in the EU. This number is neccessary in the intra comunity trades to apply a zero VAT rate.
You can find a documentation of the different VATINs structures in my VATIN wiki (de)

The validator for all is VATINValidator - it implements the jira issue 494

Pls review and merge.
Regards EUGen

Error:  Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.24.0:check (default-cli) on project commons-validator: PMD 7.4.0 has found 1 violation. For more details see: /home/runner/work/commons-validator/commons-validator/target/pmd.xml -> [Help 1]
minor changes in VATidATCheckDigit
Check Digit calculation/validation
It is a subclass from Modulus97CheckDigit, which is also used to
validate the LEI and German Leitweg, see
apache#61

This implemets parts of
https://issues.apache.org/jira/projects/VALIDATOR/issues/VALIDATOR-494
@sebbASF
Copy link
Contributor

sebbASF commented Jan 30, 2025

I agree that testing the checksums and structure of VAT numbers will allow the removal of incorrect numbers, however it won't prove that they were ever valid, only that they could have been.

@raboof
Copy link
Member

raboof commented Jan 30, 2025

I looked around a bit but didn't find anything ...

@raboof - I found this BMF_UID_Konstruktionsregeln-Nov-2020.pdf bmf.gv.at

Nice find! I checked and can confirm that both my own btw-id and the one I won't disclose are accepted by the updated implementation.

To justify the additional maintenance burden it'd still be good to find one or two other parties that can confirm they'd use this component in production and help keep it up-to-date before merging it into the main library.

@sebbASF
Copy link
Contributor

sebbASF commented Jan 31, 2025

I think it is vital to include links to the official documentation of the validation requirements in each national class.
The Wikipedia pages are useful, but they are not normative, and as we have seen with NL, the page does not include the full story.

Furthermore, most of the Wikipedia entries give no validation details.

Copy link
Contributor

@sebbASF sebbASF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like bugs

I change in `VATidLUCheckDigit` from `MIN_LEN` which is 4 to the
stronger `CHECKDIGIT_LEN` which is 2

tkx to https://github.com/sebbASF
@homebeaver
Copy link
Contributor Author

These look like bugs

No. Imprecise comments + inconsistent code. Both resolved. Tkx

@sebbASF
Copy link
Contributor

sebbASF commented Feb 1, 2025

There are some classes with logging, but not all. What determines whether logging is used?
Is it really needed?

@garydgregory
Copy link
Member

I wouldn't except any logging from this component.

apache#271 (comment)

There are some classes with logging, but not all. ...
Is it really needed?

VATidCZCheckDigit : LOG was used only when DebugEnabled
VATidBGCheckDigit : dto
VATidESCheckDigit : dto
VATidFRCheckDigit : dto
VATidGBCheckDigit : dto
VATidLVCheckDigit : dto + to explain why calculation fails
@homebeaver
Copy link
Contributor Author

I've removed logging.

There is one class with logging left : TidDECheckDigit. The reason is the specification - the link to it is in the class header. The spec is in german. In some cases valid tids should not be used - and I warn with the message recomended in the spec. See page 6+7 of the spec or screenshot:
grafik

I wouldn't except any logging from this component.

@garydgregory
To satisfy you I can remove the class from this PR

@sebbASF
Copy link
Contributor

sebbASF commented Feb 2, 2025

Logging can be completely disabled, so should not be essential to the functioning of a class.

In this case, the log messages are directly associated with an exception (apart from an unnecessary debug log), so I don't see the point of them; they don't provide any extra information.

I think they should be removed as well please.

Copy link
Contributor

@sebbASF sebbASF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per comments

@homebeaver homebeaver requested a review from sebbASF February 26, 2025 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants