reducktion / socrates

PHP package to Validate and Extract information from National Identification Numbers.
MIT License
47 stars 4 forks source link

Add german TIN validator #97

Closed bofalke closed 3 years ago

bofalke commented 3 years ago

This PR will implements the Validor for German Tax Identification Number (TIN) mentioned in #47

bofalke commented 3 years ago

For the source of the algorithm should i link the original repo that i found? Other documentation is mostly in German, so i do not know if that's of any help?

AlexOlival commented 3 years ago

For the source of the algorithm should i link the original repo that i found? Other documentation is mostly in German, so i do not know if that's of any help?

It's fine if the documentation is in another language. Any (correct) source will do :pray: If the documentation is enough, then we don't need to link to any other implementations imo

bofalke commented 3 years ago

There is an official document by ELSTER (that is the german institute to make your tax declarations online). They have a downloadable pdf where the details are explained in Chapter 2.2.

https://download.elster.de/download/schnittstellen/Pruefung_der_Steuer_und_Steueridentifikatsnummer.pdf

Should I use the download URL to this PDF or this a problem since download urls tend to disappear sooner or later?

AlexOlival commented 3 years ago

There is an official document by ELSTER (that is the german institute to make your tax declarations online). They have a downloadable pdf where the details are explained in Chapter 2.2.

https://download.elster.de/download/schnittstellen/Pruefung_der_Steuer_und_Steueridentifikatsnummer.pdf

Should I use the download URL to this PDF or this a problem since download urls tend to disappear sooner or later?

It's fine to link to the PDF That's a risk we're taking with all links - but at least one can derive some information from the URL itself and try to find another source :+1:

bofalke commented 3 years ago

It's fine to link to the PDF That's a risk we're taking with all links - but at least one can derive some information from the URL itself and try to find another source :+1:

Allright, i will link it.

I just saw that they have some example values as well for the TIN in the documentation, maybe i should use those in our tests as well? There is a disclaimer below saying something like: "The ID was taken from the concept of the Federal Information Technology Center and serves solely for the purpose of illustrating the implementation. Under no circumstances may the ID be used for test or real transfers!"

I do not want to get you guys in trouble after all. The documentation said that for testing purposes an ID with a leading 0 should be used. I could disable the leading 0 check if the APP_ENV is set to TEST if you like. Alternatively i could at least use my TIN for the German Test if you like.

AlexOlival commented 3 years ago

I do not want to get you guys in trouble after all. The documentation said that for testing purposes an ID with a leading 0 should be used. I could disable the leading 0 check if the APP_ENV is set to TEST if you like. Alternatively i could at least use my TIN for the German Test if you like.

We'll trust the algorithm and we'll trust you :smile: In that case you can go ahead and use test IDs which they allow - no need for edge cases

bofalke commented 3 years ago

So i can leave everything like it is? :D Sorry for the confusion

AlexOlival commented 3 years ago

So i can leave everything like it is? :D Sorry for the confusion

Use invalid IDs that the German authorities allow - whatever is legal

bofalke commented 3 years ago

So i will use testing IDs with a leading 0. That would then cause the test to fail because valid TIN's must not start with a 0. If you like i can at least use my own TIN to have one valid ID in the test.

AlexOlival commented 3 years ago

So i will use testing IDs with a leading 0. That would then cause the test to fail because valid TIN's must not start with a 0. If you like i can at least use my own TIN to have one valid ID in the test.

Ahhhh I finally understood what you meant... Well I'm not a fan of environment variables and workarounds for testing in packages. I also find it weird that we're not allowed to use IDs when these don't actually encode any information (especially if you used a generator for them)

I say we keep it as it is. If someone asks us to remove them, we will :man_shrugging:

bofalke commented 3 years ago

Ok perfect :+1: So this is all good now? :D

AlexOlival commented 3 years ago

All good from my end! @JoaoFSCruz como take a looksie

AlexOlival commented 3 years ago

@all-contributors please add @bofalke for documentation

allcontributors[bot] commented 3 years ago

@AlexOlival

I've put up a pull request to add @bofalke! :tada: