Adding variants causes 500 internal server error

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
11 years 4 months ago #84828

Hi,

From the documentation of ec.europa.eu/taxation_customs/vies/checkVatService.wsdl

MS_UNAVAILABLE: The Member State service is unavailable, try again later or with another Member State;

The thing which is strange is that the SoapClient is called into a try catch so, it should be catch by HikaShop and not trigger the PHP error message.

You could use this code for the helper vat
	function onlineCheck($vat){
		//no online check for php4
		if (extension_loaded('soap')) {
			try{
				$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
				$vat = strtoupper(str_replace(array(' ','.'),array('',''),$vat));
				$result = $client->checkVat(array('countryCode' => substr($vat, 0, 2), 'vatNumber' => substr($vat, 2)));
				if(empty($result) || !$result->valid) {
					$this->message = JText::_('VAT_NUMBER_NOT_VALID');
				}
			}catch(SoapFault $e) {
				$this->message = $e->__toString();
				$result = false;
			}catch (Exception $e) {
				$this->message = $e->__toString();
				$result = false;
			}
			if ($result === false || empty($result) || !$result->valid ) {
				$app =& JFactory::getApplication();
				if($_REQUEST['tmpl']=='component'){
					hikashop_display($this->message,'error');
				}else{
					$app->enqueueMessage($this->message);
				}
				return false;
			}
		}else{
			$app =& JFactory::getApplication();
			$this->message = JText::_('SOAP_EXTENSION_NOT_FOUND');
			if($_REQUEST['tmpl']=='component'){
				hikashop_display($this->message,'error');
			}else{
				$app->enqueueMessage($this->message);
			}
			return false;
		}
		return true;
	}
But you got an error because the Member State service is unavailable, so that's not an bug in HikaShop.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: jen168

Please Log in or Create an account to join the conversation.

Time to create page: 0.044 seconds
Powered by Kunena Forum