From 1aa9b0231c405d16a70b8a365f8d44c10fad017a Mon Sep 17 00:00:00 2001 From: Sheetal Date: Sat, 18 Jun 2016 16:26:15 +0530 Subject: [PATCH] Samadhan - Authorize net connection error issue solved --- .../lib/shared/AuthorizeNetRequest.php | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/authorizenet/authorizenet/lib/shared/AuthorizeNetRequest.php b/authorizenet/authorizenet/lib/shared/AuthorizeNetRequest.php index e2f671a..ae25c8c 100755 --- a/authorizenet/authorizenet/lib/shared/AuthorizeNetRequest.php +++ b/authorizenet/authorizenet/lib/shared/AuthorizeNetRequest.php @@ -8,30 +8,30 @@ */ abstract class AuthorizeNetRequest { - + protected $_api_login; protected $_transaction_key; - protected $_post_string; - public $VERIFY_PEER = true; // Set to false if getting connection errors. + protected $_post_string; + public $VERIFY_PEER = false; // Set to false if getting connection errors. protected $_sandbox = true; protected $_log_file = false; - + /** * Set the _post_string */ abstract protected function _setPostString(); - + /** * Handle the response string */ abstract protected function _handleResponse($string); - + /** * Get the post url. We need this because until 5.3 you * you could not access child constants in a parent class. */ abstract protected function _getPostUrl(); - + /** * Constructor. * @@ -45,7 +45,7 @@ public function __construct($api_login_id = false, $transaction_key = false) $this->_sandbox = (defined('AUTHORIZENET_SANDBOX') ? AUTHORIZENET_SANDBOX : true); $this->_log_file = (defined('AUTHORIZENET_LOG_FILE') ? AUTHORIZENET_LOG_FILE : false); } - + /** * Alter the gateway url. * @@ -55,7 +55,7 @@ public function setSandbox($bool) { $this->_sandbox = $bool; } - + /** * Set a log file. * @@ -65,7 +65,7 @@ public function setLogFile($filepath) { $this->_log_file = $filepath; } - + /** * Return the post string. * @@ -75,7 +75,7 @@ public function getPostString() { return $this->_post_string; } - + /** * Posts the request to AuthorizeNet & returns response. * @@ -96,25 +96,25 @@ protected function _sendRequest() } else { curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); } - + if (preg_match('/xml/',$post_url)) { curl_setopt($curl_request, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); } - + $response = curl_exec($curl_request); - + if ($this->_log_file) { - + if ($curl_error = curl_error($curl_request)) { file_put_contents($this->_log_file, "----CURL ERROR----\n$curl_error\n\n", FILE_APPEND); } // Do not log requests that could contain CC info. // file_put_contents($this->_log_file, "----Request----\n{$this->_post_string}\n", FILE_APPEND); - + file_put_contents($this->_log_file, "----Response----\n$response\n\n", FILE_APPEND); } curl_close($curl_request); - + return $this->_handleResponse($response); }