-- HikaShop version -- : 6.5.2
Hello,
I am working on a solution to verify gb vat numbers, documentation here:
https://developer.service.hmrc.gov.uk/api-documentation/docs/api/service/vat-registered-companies-api/2.0
I got that working but the integration with Hikashop is not so smooth. Checking the vat code, here:
\administrator\components\com_hikashop\helpers\vat.php
I see there is integration with the online check using the trigger onBeforeVATOnlineCheck.
I have 2 issues using this approach:
1. Entering a vat number starting with the letters GB.. causes an error, specifically the error:
Your VAT number can not be used with the country you selected. Please select the right country ( CODE: GB) or make sure your VAT starts with XI
To stop that error, I commented out the line 41 in vat.php
if($zone_code=='GB') $zone_code = 'XI';
2. The vat trigger does not return the right value causing it always be true. The vat trigger reruns an array, while the code is expecting a boolean. Around line 204, I changed this:
$rc = $app->triggerEvent( 'onBeforeVATOnlineCheck', array( &$obj, &$processed, &$vat) );
if( $processed) {
return $rc;
}
To this:
$rc = $app->triggerEvent( 'onBeforeVATOnlineCheck', array( &$obj, &$processed, &$vat) );
if( $processed) {
if ( in_array( false, $rc, true ) ) {
return false;
}
elseif ( in_array( true, $rc, true ) ) {
return true;
}
}
Those 2 core updates allowed the checks to run smoothly. Is it possible to update the vat code? Or am I taking the wrong approach with this?
Thanks