Jump to content

EU VAT validation doesn't work anymore


Go to solution Solved by opentype,

Recommended Posts

Hi team,

The Nexus VAT validation for EU business addresses seems to not work any longer.

In \Tax::validateVAT at line 382:

		if ( $xml->read() )
		{
			if ( $xml->name === 'soap:Envelope' and $xml->read() )
			{
				if ( $xml->name === 'soap:Body' and $xml->read() )
				{
					if ( $xml->name === 'checkVatResponse' )
					{
						$xml->read();
						do
						{
							$responseArray[ $xml->name ] = $xml->readString();
						}
						while ( $xml->next() and $xml->nodeType !== $xml::END_ELEMENT );
					}
				}
			}
		}

 

The response from the EU service seems to have changed; the XML looks something like that:

<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>XX</ns2:countryCode>
      <ns2:vatNumber>XXXXXX</ns2:vatNumber>
      <ns2:requestDate>2022-09-28+02:00</ns2:requestDate>
      <ns2:valid>true</ns2:valid>
      <ns2:name>XXXXXX</ns2:name>
      <ns2:address>XXXXXX</ns2:address>
    </ns2:checkVatResponse>
  </env:Body>
</env:Envelope>

➡️ The namespace is "env", and a <env:Header> tag seems to have appeared before the Body; so the $xml->read() can't find the Body element any longer.

 

Thank you!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...