dennish Posted June 12, 2013 Share Posted June 12, 2013 Hello, Is anyone succesfully using the E.U. VAT Intracom Number add-on (http://addons.oscommerce.com/info/1848) on osC 2.3.3 (or any other version of osC)? I get this error message when testing (adding new customer in create_account.php): Warning: file_get_contents(http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=NL&iso=NL&vat=008888012B0) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable The url http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=NL&iso=NL&vat=008888012B0 opens fine in my browser, so the service itself is running normally ... My validations.php file (in catalog/includes/functions) contains the following code: function tep_verif_tva($num_tva){ $prefix = substr($num_tva, 0, 2); if (array_search($prefix, tep_get_tva_intracom_array() ) === false) { return 'false'; } $tva = substr($num_tva, 2); $monfd = file_get_contents('http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . $prefix . '&iso='.$prefix.'&vat=' . $tva, r); if ( preg_match("/invalid VAT number/i", $monfd) ) { return 'false'; } elseif ( preg_match("/valid VAT number/i", $monfd) ){ return 'true'; } else { $myVerif = 'no_verif'; } return $myVerif; } Any help is much appreciated. Kind regards, Dennis Quote Link to comment Share on other sites More sharing options...
Mort-lemur Posted June 12, 2013 Share Posted June 12, 2013 Hi, For what it is worth I never managed to get this working correctly on a 2.2 Rc2a site - so had to remove it. Quote Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members. Link to comment Share on other sites More sharing options...
dennish Posted June 18, 2013 Author Share Posted June 18, 2013 Hello Heather, The server my osC runs on has trouble to process the file_get_contents request (which might be due to the API of the VIES service not being fully functional with IPv6. Same holds for the SOAP version). My hosting provider suggested a workaround with curl (which I tested and works perfectly): function tep_verif_tva($num_tva){ $prefix = substr($num_tva, 0, 2); if (array_search($prefix, tep_get_tva_intracom_array() ) === false) { return 'false'; } $tva = substr($num_tva, 2); // $monfd = file_get_contents('http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . $prefix . '&iso='.$prefix.'&vat=' . $tva, r); $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . $prefix . '&iso='.$prefix.'&vat=' . $tva; $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_IPRESOLVE,CURL_IPRESOLVE_V4); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $monfd = curl_exec($ch); // PHP 5.3+ compliance - Start // if ( eregi("invalid VAT number", $monfd) ) { // return 'false'; // } elseif ( eregi("valid VAT number", $monfd) ){ if ( preg_match("/invalid VAT number/i", $monfd) ) { return 'false'; } elseif ( preg_match("/valid VAT number/i", $monfd) ){ // PHP 5.3+ compliance - End return 'true'; } else { $myVerif = 'no_verif'; } return $myVerif; curl_close($ch); } Hope this helps you too. Kind regards, Dennis Quote Link to comment Share on other sites More sharing options...
Fyod Posted June 21, 2013 Share Posted June 21, 2013 Has anyone been able to implement this into Onepage (Ajax) Checkout? Quote Link to comment Share on other sites More sharing options...
tarmogr Posted November 11, 2014 Share Posted November 11, 2014 I would like to install this addon but I have one theoretical question If somebody inserts a VAT number that is valid but not owned by the customers company, then he automattically gets tax free prices. So how do I know he is not just camming me but really can order in behalf of this company? Quote Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted November 11, 2014 Share Posted November 11, 2014 (edited) our accounting department always adds the printout that proofs the VAT number was valid at the time of purchase. when inspected, it is up to us to proof that we could invoice tax free, so we do keep that proof with the invoice. Personally, I think the validation is to catch typing errors upon input. Edited November 11, 2014 by bruyndoncx Quote KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
Guest Posted June 5, 2015 Share Posted June 5, 2015 Did anyone get this working in the end? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.