digitalfondue / vatchecker

java library for calling the eu vat checker web service
Apache License 2.0
20 stars 3 forks source link

Tin Database Support #4

Closed daniilidisK closed 3 years ago

daniilidisK commented 3 years ago

Hallo,

How we can change the code to support search in Tin Database? My code is here https://github.com/KostasDaniil/vatchecker-GR, but it does not work. Can anyone help me?

Thanks in advance

syjer commented 3 years ago

hi @KostasDaniil , I'll have a look in how to implement it.

Can you confirm that https://ec.europa.eu/taxation_customs/tin/checkTinService.wsdl is the correct web service to call?

daniilidisK commented 3 years ago

Dear Mr. Syjer,

Thank you very much for the fast reply. As you can see in the GRVatChecker.java, I declare the variable ENDPOINT to the address https://ec.europa.eu/taxation_customs/tin/services/checkTinService. Is this a wrong url for the Tin Database?

Also, I tryied to change the xml format of the variable soapCallTemplate at the same file, in order to fetch data from the right API interface. After all changes, I went to src/test/java/EUVatCheckerTest.java and I created the checkGreekVAT() function and as a argument I insert only my VAT number, without the "EL" in front, because i set it to be fixed the the GRVatChecker.java.

When I insert my Vat number and run this function, there is an error in the console, that says:

Expected: true
Real: false

But the Tin web page, says that my Vat number is valid.

I'm a little confused by this whole process. Do you know what went wrong? Has the variable soapCallTemplate the right xml data?

I confirm that the https://ec.europa.eu/taxation_customs/tin/checkTinService.wsdl is a collect page to collect data, as well as the https://ec.europa.eu/taxation_customs/tin/services/checkTinService page.

I am looking forward for your kind reply. Many thanks again!

syjer commented 3 years ago

hi @KostasDaniil , looking at your code and from the wsdl, I see that https://github.com/KostasDaniil/vatchecker-GR/blob/master/src/main/java/ch/digitalfondue/vatchecker/GRVatChecker.java#L95 <vatNumber></vatNumber> should be <tinNumber></tinNumber> and in https://github.com/KostasDaniil/vatchecker-GR/blob/master/src/main/java/ch/digitalfondue/vatchecker/GRVatChecker.java#L110 it should be tinNumber.

Also the response will be different too. Anyway, I'll try to implement it on my side.

daniilidisK commented 3 years ago

I make the changes at the lines 95 and 110 at GRVatChecker.java. Thank you very much for your willingness to implement my request!

syjer commented 3 years ago

hi @KostasDaniil , I've pushed a new version (1.5.0) of the library, which is available on maven central.

You can see how to use it here: https://github.com/digitalfondue/vatchecker/blob/master/src/test/java/ch/digitalfondue/vatchecker/EUTinCheckerTest.java#L25

daniilidisK commented 3 years ago

Thank you very much Mr. Sylvain Jermini! You are very helpful!

syjer commented 3 years ago

@KostasDaniil you're welcome :)