digitalfondue / vatchecker

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

NL VAT Number returning different result than VIES on Web #7

Closed jlannoy closed 5 months ago

jlannoy commented 5 months ago

Hello.

Any idea why we have an empty result for VAT number 85187947B01 (NL one), while we have a result on the VIES website?

image
syjer commented 5 months ago

hi @jlannoy , you are entering in the following case (as covered in the test): https://github.com/digitalfondue/vatchecker/blob/master/src/test/java/ch/digitalfondue/vatchecker/EUVatCheckerTest.java#L35

    @Test
    public void testCorrectCountryCodeButInvalidVAT() {
        EUVatCheckResponse resp = EUVatChecker.doCheck("NL", "85187947B01");
        Assert.assertEquals(false, resp.isValid());
        Assert.assertEquals("---", resp.getName());
        Assert.assertEquals("---", resp.getAddress());
        Assert.assertEquals(false, resp.isError());
        Assert.assertNull(resp.getFault());
    }

Basically, you pass a valid country (NL) but the VAT number is invalid. Thus you will receive like the web frontend:

jlannoy commented 5 months ago

Yup, that was already clear. Sorry, the purpose of my question was not so technical but more about the fault itself, the "cross border" red message. Shouldn't that message be available as a fault? Thank you.

syjer commented 5 months ago

hi, @jlannoy , this is what I receive from the soap web service, so the specific message is not propagated as a fault:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<env:Envelope
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header/>
    <env:Body>
        <ns2:checkVatResponse
            xmlns:ns2="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
            <ns2:countryCode>NL</ns2:countryCode>
            <ns2:vatNumber>85187947B01</ns2:vatNumber>
            <ns2:requestDate>2024-04-09+02:00</ns2:requestDate>
            <ns2:valid>false</ns2:valid>
            <ns2:name>---</ns2:name>
            <ns2:address>---</ns2:address>
        </ns2:checkVatResponse>
    </env:Body>
</env:Envelope>

I would not be surprised if that specific message is hardcoded or only available on the web interface.

jlannoy commented 5 months ago

I would not be surprised if that specific message is hardcoded or only available on the web interface.

It seems. Thank you for checking!