lekoala / tin

Provide validation tools for Taxpayer Identification Number
MIT License
5 stars 5 forks source link

invalid Czech validator #1

Open Tetragramat opened 4 years ago

Tetragramat commented 4 years ago

There is very high chance of false negatives from validator. Czech TIN is DIČ and it is not date but sometimes made from date.

I know how to validate czech national identification number and company registration number, but I have no knowledge of VČP and another edge cases of DIČ/TIN

lekoala commented 4 years ago

@Tetragramat oh thank you for this valuable feedback. I see that it is indeed more complicated than expected for the specifications I've read.

do you mind if I take some inspiration for your validator in order to fix the one provided here?

lekoala commented 4 years ago

i've already did some adjustements to avoid false negative. it's great to see that you implemented modulus check in your implementation :)

Tetragramat commented 4 years ago

I think you misunderstood. Even if you copy my two validators you'll NOT have correct implementation of Czech TIN validator. Sure it will work for Natural person like me and sometimes for Legal person when they have TIN same as IČO, but it will fail for everything else.

Tetragramat commented 4 years ago

Now I'm quite confused. Official document from European Commision says that Czech TIN is actually Czech national identification number. I thought that TIN (tax identification number) is Czech DIČ (taxpayer identification number).

Tetragramat commented 4 years ago

https://ec.europa.eu/taxation_customs/tin/ Says:

Please note that the Tax Identification Number Validation Module can validate only Tax Identification Numbers referred to a natural persons. Member States may use other formats as Tax Identification Numbers for legal entities, which cannot be validated by TIN on Europa.

Which means they just ignored TIN for legal entities. So I think I was correct that TIN = Czech DIČ.

lekoala commented 4 years ago

yes I think you are right this is a bit of a misnomer. My goal is to validate individuals, not legal entities so probably i need to update the readme to reflect that. as long as it works for the example you linked from the european commision, i'm happy :-)

drupol commented 4 years ago

Hi @Tetragramat,

In collaboration with @lekoala , we started a new project here: https://github.com/loophp/tin

This project includes the algorithm you made in your package. I didn't used the PHP dependency system because I don't want this package to depends of any other for obvious security reasons.

I took care to give you the prop for code in the class documentation header: https://github.com/loophp/tin/blob/master/src/CountryHandler/CzeckRepublic.php

Let us know if it's ok and if we can close this issue now.

Take care guys!

Tetragramat commented 4 years ago

I'm ok with that. My project is MIT licensed so I suppose if I did not misunderstood you don't have to ask me.

Whyle copying you made few mistakes: You have wrong class name. It should be CzechRepublic or Czechia not CzeckRepublic. Also you have wrong COUNTRYCODE constant which should be CZ not CY which is Cyprus.

drupol commented 4 years ago

Thanks!

Are you willing to submit the PR yourself or I can do it tonight ?

Tetragramat commented 3 years ago

You can do it. I don't have much free time. Sorry for year late response.