From 53bf91796e15828bbae3b6fb5ce947802d3920f9 Mon Sep 17 00:00:00 2001 From: juankamilo Date: Mon, 19 Dec 2016 12:03:45 -0500 Subject: [PATCH 1/8] Worldpay CSE payment option included Validates if the payment type coming is CSE and defines the fields required for this option. --- lib/Order.php | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/Order.php b/lib/Order.php index 82610a8..e93e631 100644 --- a/lib/Order.php +++ b/lib/Order.php @@ -82,20 +82,27 @@ private static function extractPaymentMethodFromData($data) $paymentMethod = array(); if (isset($data['paymentMethod'])) { $_orderPM = $data['paymentMethod']; - $_name = isset($_orderPM['name']) ? $_orderPM['name'] : ""; - $_expiryMonth = isset($_orderPM['expiryMonth']) ? $_orderPM['expiryMonth'] : ""; - $_expiryYear = isset($_orderPM['expiryYear']) ? $_orderPM['expiryYear'] : ""; - $_cardNumber = isset($_orderPM['cardNumber']) ? $_orderPM['cardNumber'] : ""; - $_cvc = isset($_orderPM['cvc']) ? $_orderPM['cvc'] : ""; + if($_orderPM['type'] === "CSE"){ + $paymentMethod = array( + 'type' =>$_orderPM['type'], + 'encryptedData' =>$_orderPM['encryptedData'] + ); + } else { + $_name = isset($_orderPM['name']) ? $_orderPM['name'] : ""; + $_expiryMonth = isset($_orderPM['expiryMonth']) ? $_orderPM['expiryMonth'] : ""; + $_expiryYear = isset($_orderPM['expiryYear']) ? $_orderPM['expiryYear'] : ""; + $_cardNumber = isset($_orderPM['cardNumber']) ? $_orderPM['cardNumber'] : ""; + $_cvc = isset($_orderPM['cvc']) ? $_orderPM['cvc'] : ""; - $paymentMethod = array( - "type" => "Card", - "name" => $_name, - "expiryMonth" => $_expiryMonth, - "expiryYear" => $_expiryYear, - "cardNumber"=> $_cardNumber, - "cvc"=> $_cvc, - ); + $paymentMethod = array( + "type" => "Card", + "name" => $_name, + "expiryMonth" => $_expiryMonth, + "expiryYear" => $_expiryYear, + "cardNumber" => $_cardNumber, + "cvc" => $_cvc, + ); + } } return $paymentMethod; } From 2f7ec8ff64f58d800bc6e7c4b44b924f7459c471 Mon Sep 17 00:00:00 2001 From: Juank Date: Tue, 11 Jul 2017 10:18:25 -0500 Subject: [PATCH 2/8] Worldpay CSE payment option included and Hotfixes - put error messages in file --- lib/APMOrder.php | 0 lib/AbstractAddress.php | 0 lib/AbstractOrder.php | 10 ++++++++-- lib/BillingAddress.php | 0 lib/Connection.php | 33 +++++++++++++++++++++++++++++++-- lib/DeliveryAddress.php | 0 lib/Error.php | 0 lib/Order.php | 2 +- lib/OrderService.php | 4 ++-- lib/TokenService.php | 0 lib/Utils.php | 0 lib/Worldpay.php | 6 ++++-- lib/WorldpayException.php | 0 13 files changed, 46 insertions(+), 9 deletions(-) mode change 100644 => 100755 lib/APMOrder.php mode change 100644 => 100755 lib/AbstractAddress.php mode change 100644 => 100755 lib/AbstractOrder.php mode change 100644 => 100755 lib/BillingAddress.php mode change 100644 => 100755 lib/Connection.php mode change 100644 => 100755 lib/DeliveryAddress.php mode change 100644 => 100755 lib/Error.php mode change 100644 => 100755 lib/Order.php mode change 100644 => 100755 lib/OrderService.php mode change 100644 => 100755 lib/TokenService.php mode change 100644 => 100755 lib/Utils.php mode change 100644 => 100755 lib/Worldpay.php mode change 100644 => 100755 lib/WorldpayException.php diff --git a/lib/APMOrder.php b/lib/APMOrder.php old mode 100644 new mode 100755 diff --git a/lib/AbstractAddress.php b/lib/AbstractAddress.php old mode 100644 new mode 100755 diff --git a/lib/AbstractOrder.php b/lib/AbstractOrder.php old mode 100644 new mode 100755 index 9a2dc9f..03384f3 --- a/lib/AbstractOrder.php +++ b/lib/AbstractOrder.php @@ -49,8 +49,14 @@ protected static function validateInputData($data) if (!isset($data['currencyCode'])) { $errors[] = Error::$errors['orderInput']['currencyCode']; } - if (!isset($data['name'])) { - $errors[] = Error::$errors['orderInput']['name']; + if($data['paymentMethod']['type'] === "CSE"){ + if(!isset($data['paymentMethod']['encryptedData'])) { + $errors[] = Error::$errors['orderInput']['encryptedData']; + } + }else{ + if(!isset($data['name'])) { + $errors[] = Error::$errors['orderInput']['name']; + } } if (isset($data['billingAddress']) && !is_array($data['billingAddress'])) { $errors[] = Error::$errors['orderInput']['billingAddress']; diff --git a/lib/BillingAddress.php b/lib/BillingAddress.php old mode 100644 new mode 100755 diff --git a/lib/Connection.php b/lib/Connection.php old mode 100644 new mode 100755 index c2e6012..e2f2f91 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -1,6 +1,8 @@ endpoint.$action); @@ -110,13 +112,24 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me } $result = curl_exec($ch); - $info = curl_getinfo($ch); + $info = curl_getinfo($ch);; $err = curl_error($ch); $errno = curl_errno($ch); curl_close($ch); + if($debug){ + $file = (\Yii::$app->basePath . '/archivos/'); + $random = rand(0, 100); + file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($result, true)); + } + // Curl error if ($result === false) { + $file = (\Yii::$app->basePath . '/archivos/'); + $random = rand(0, 100); + file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($err, true)); if ($errno === 60) { Error::throwError('sslerror', false, $errno, null, $err); } elseif ($errno === 28) { @@ -135,6 +148,10 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me // Check JSON has decoded correctly if ($expectResponse && ($response === null || $response === false )) { + $file = (\Yii::$app->basePath . '/archivos/'); + $random = rand(0, 100); + file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($err, true)); Error::throwError('uanv', Error::$errors['json'], 503); } @@ -142,6 +159,10 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me if (isset($response["httpStatusCode"])) { if ($response["httpStatusCode"] != 200) { + $file = (\Yii::$app->basePath . '/archivos/'); + $random = rand(0, 100); + file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($response, true)); Error::throwError( false, $response["message"], @@ -154,12 +175,20 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me } } elseif ($expectResponse && $info['http_code'] != 200) { + $file = (\Yii::$app->basePath . '/archivos/'); + $random = rand(0, 100); + file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($info, true)); // If we expect a result and we have an error Error::throwError('uanv', Error::$errors['json'], 503); } elseif (!$expectResponse) { if ($info['http_code'] != 200) { + $file = (\Yii::$app->basePath . '/archivos/'); + $random = rand(0, 100); + file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($result, true)); Error::throwError('apierror', $result, $info['http_code']); } else { $response = true; diff --git a/lib/DeliveryAddress.php b/lib/DeliveryAddress.php old mode 100644 new mode 100755 diff --git a/lib/Error.php b/lib/Error.php old mode 100644 new mode 100755 diff --git a/lib/Order.php b/lib/Order.php old mode 100644 new mode 100755 index e93e631..89362e0 --- a/lib/Order.php +++ b/lib/Order.php @@ -87,7 +87,7 @@ private static function extractPaymentMethodFromData($data) 'type' =>$_orderPM['type'], 'encryptedData' =>$_orderPM['encryptedData'] ); - } else { + }else { $_name = isset($_orderPM['name']) ? $_orderPM['name'] : ""; $_expiryMonth = isset($_orderPM['expiryMonth']) ? $_orderPM['expiryMonth'] : ""; $_expiryYear = isset($_orderPM['expiryYear']) ? $_orderPM['expiryYear'] : ""; diff --git a/lib/OrderService.php b/lib/OrderService.php old mode 100644 new mode 100755 index 0251f79..784626b --- a/lib/OrderService.php +++ b/lib/OrderService.php @@ -3,9 +3,9 @@ class OrderService { - public static function createOrder($order) + public static function createOrder($order, $debug=false) { - return Connection::getInstance()->sendRequest('orders', json_encode($order->toArray()), true); + return Connection::getInstance()->sendRequest('orders', json_encode($order->toArray()), true, 'POST', $debug); } public static function authorize3DSOrder($orderCode, $responseCode) diff --git a/lib/TokenService.php b/lib/TokenService.php old mode 100644 new mode 100755 diff --git a/lib/Utils.php b/lib/Utils.php old mode 100644 new mode 100755 diff --git a/lib/Worldpay.php b/lib/Worldpay.php old mode 100644 new mode 100755 index 5625099..1baa837 --- a/lib/Worldpay.php +++ b/lib/Worldpay.php @@ -102,12 +102,14 @@ public function createApmOrder($order = array()) /** * Create Worldpay order * @param array $order + * @param boolean $debug * @return array Worldpay order response * */ - public function createOrder($order = array()) + public function createOrder($order = array(), $debug=false) { + $myOrder = new Order($order); - $response = OrderService::createOrder($myOrder); + $response = OrderService::createOrder($myOrder, $debug); if (isset($response["orderCode"])) { //success diff --git a/lib/WorldpayException.php b/lib/WorldpayException.php old mode 100644 new mode 100755 From 83ab600fce500346f5ca287da4c738f74e23be60 Mon Sep 17 00:00:00 2001 From: juancarlos_agentcars Date: Wed, 19 Jul 2017 16:57:48 -0500 Subject: [PATCH 3/8] change file name and create files when transaction status not equals UCCESS --- lib/Connection.php | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/Connection.php b/lib/Connection.php index e2f2f91..fba461e 100755 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -16,7 +16,7 @@ private function __construct() } - /** + /** * Call this method to get singleton * * @return Connection @@ -59,7 +59,7 @@ private function getBaseClientUserAgent() { $arch = (bool)((1<<32)-1) ? 'x64' : 'x86'; $clientUA = 'os.name=' . php_uname('s') . ';os.version=' . php_uname('r') . ';os.arch=' . - $arch . ';lang.version='. phpversion() . ';lib.version=2.1.0;' . 'api.version=v1;lang=php;owner=worldpay'; + $arch . ';lang.version='. phpversion() . ';lib.version=2.1.0;' . 'api.version=v1;lang=php;owner=worldpay'; return $clientUA; } @@ -67,14 +67,14 @@ public function setClientUserAgentWithPluginData($pluginName, $pluginVersion) { $this->client_user_agent = $this->getBaseClientUserAgent(); if ($pluginName) { - $this->client_user_agent .= ';plugin.name=' . $pluginName; + $this->client_user_agent .= ';plugin.name=' . $pluginName; } if ($pluginVersion) { - $this->client_user_agent .= ';plugin.version=' . $pluginVersion; + $this->client_user_agent .= ';plugin.version=' . $pluginVersion; } } - /** + /** * Sends request to Worldpay API * @param string $action * @param string $json @@ -143,15 +143,16 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $result = substr($result, 0, -1); } + $transactionId = self::handleResponse($json); + $transactionId = $transactionId['customerOrderCode']; + // Decode JSON $response = self::handleResponse($result); - // Check JSON has decoded correctly if ($expectResponse && ($response === null || $response === false )) { $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($err, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($err, true)); Error::throwError('uanv', Error::$errors['json'], 503); } @@ -160,9 +161,8 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me if ($response["httpStatusCode"] != 200) { $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($response, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($response, true)); Error::throwError( false, $response["message"], @@ -171,14 +171,12 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $response['description'], $response['customCode'] ); - } } elseif ($expectResponse && $info['http_code'] != 200) { $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($info, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($info, true)); // If we expect a result and we have an error Error::throwError('uanv', Error::$errors['json'], 503); @@ -186,14 +184,18 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me if ($info['http_code'] != 200) { $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($result, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); Error::throwError('apierror', $result, $info['http_code']); } else { $response = true; } } + if ($response['paymentStatus'] != 'SUCCESS' || $response['paymentStatus'] != 'AUTHORIZED') { + $file = (\Yii::$app->basePath . '/archivos/'); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); + } return $response; } From 7e6efea87b7c1ac79a8375fbd6a6339ce345c870 Mon Sep 17 00:00:00 2001 From: juancarlos_agentcars Date: Fri, 21 Jul 2017 12:38:46 -0500 Subject: [PATCH 4/8] fixes save files --- lib/Connection.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/Connection.php b/lib/Connection.php index fba461e..32a7787 100755 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -117,19 +117,20 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $errno = curl_errno($ch); curl_close($ch); + + $transactionId = self::handleResponse($json); + $transactionId = $transactionId['customerOrderCode']; + $file = (\Yii::$app->basePath . '/archivos/'); + if($debug){ - $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($result, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); } // Curl error if ($result === false) { - $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($err, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($err, true)); if ($errno === 60) { Error::throwError('sslerror', false, $errno, null, $err); } elseif ($errno === 28) { @@ -143,14 +144,10 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $result = substr($result, 0, -1); } - $transactionId = self::handleResponse($json); - $transactionId = $transactionId['customerOrderCode']; - // Decode JSON $response = self::handleResponse($result); // Check JSON has decoded correctly if ($expectResponse && ($response === null || $response === false )) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($err, true)); Error::throwError('uanv', Error::$errors['json'], 503); @@ -158,9 +155,7 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me // Check the status code exists if (isset($response["httpStatusCode"])) { - if ($response["httpStatusCode"] != 200) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($response, true)); Error::throwError( @@ -174,16 +169,13 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me } } elseif ($expectResponse && $info['http_code'] != 200) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($info, true)); // If we expect a result and we have an error Error::throwError('uanv', Error::$errors['json'], 503); } elseif (!$expectResponse) { - if ($info['http_code'] != 200) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); Error::throwError('apierror', $result, $info['http_code']); @@ -191,7 +183,7 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $response = true; } } - if ($response['paymentStatus'] != 'SUCCESS' || $response['paymentStatus'] != 'AUTHORIZED') { + if ($response['paymentStatus'] != 'SUCCESS' && $response['paymentStatus'] != 'AUTHORIZED') { $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); From a716f65a53be03b925afb435699aea88ec7e794d Mon Sep 17 00:00:00 2001 From: juancarlos_agentcars Date: Fri, 21 Jul 2017 12:39:37 -0500 Subject: [PATCH 5/8] fix validation paymentStatus when save files --- lib/Connection.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/Connection.php b/lib/Connection.php index fba461e..32a7787 100755 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -117,19 +117,20 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $errno = curl_errno($ch); curl_close($ch); + + $transactionId = self::handleResponse($json); + $transactionId = $transactionId['customerOrderCode']; + $file = (\Yii::$app->basePath . '/archivos/'); + if($debug){ - $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($result, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); } // Curl error if ($result === false) { - $file = (\Yii::$app->basePath . '/archivos/'); - $random = rand(0, 100); - file_put_contents($file . "Request-$random-'worldpay.json", print_r($json, true)); - file_put_contents($file . "ResponseH-$random-worlpay.json", print_r($err, true)); + file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); + file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($err, true)); if ($errno === 60) { Error::throwError('sslerror', false, $errno, null, $err); } elseif ($errno === 28) { @@ -143,14 +144,10 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $result = substr($result, 0, -1); } - $transactionId = self::handleResponse($json); - $transactionId = $transactionId['customerOrderCode']; - // Decode JSON $response = self::handleResponse($result); // Check JSON has decoded correctly if ($expectResponse && ($response === null || $response === false )) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($err, true)); Error::throwError('uanv', Error::$errors['json'], 503); @@ -158,9 +155,7 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me // Check the status code exists if (isset($response["httpStatusCode"])) { - if ($response["httpStatusCode"] != 200) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($response, true)); Error::throwError( @@ -174,16 +169,13 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me } } elseif ($expectResponse && $info['http_code'] != 200) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($info, true)); // If we expect a result and we have an error Error::throwError('uanv', Error::$errors['json'], 503); } elseif (!$expectResponse) { - if ($info['http_code'] != 200) { - $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); Error::throwError('apierror', $result, $info['http_code']); @@ -191,7 +183,7 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $response = true; } } - if ($response['paymentStatus'] != 'SUCCESS' || $response['paymentStatus'] != 'AUTHORIZED') { + if ($response['paymentStatus'] != 'SUCCESS' && $response['paymentStatus'] != 'AUTHORIZED') { $file = (\Yii::$app->basePath . '/archivos/'); file_put_contents($file . "Request-$transactionId-'worldpay.json", print_r($json, true)); file_put_contents($file . "ResponseH-$transactionId-worlpay.json", print_r($result, true)); From f83ad4b39ed292f2f39b338d8dd870b061454420 Mon Sep 17 00:00:00 2001 From: juancarlos_agentcars Date: Fri, 21 Jul 2017 15:58:36 -0500 Subject: [PATCH 6/8] fix customerOrdercode validation --- lib/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Connection.php b/lib/Connection.php index 32a7787..0687d27 100755 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -119,7 +119,7 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me $transactionId = self::handleResponse($json); - $transactionId = $transactionId['customerOrderCode']; + $transactionId = isset($transactionId['customerOrderCode']) ? $transactionId['customerOrderCode'] : '00'; $file = (\Yii::$app->basePath . '/archivos/'); if($debug){ From 219b4006e4831a34691b9dbea10e14a0fd8afa9f Mon Sep 17 00:00:00 2001 From: juancarlos_agentcars Date: Fri, 13 Apr 2018 15:34:18 -0500 Subject: [PATCH 7/8] Change CURLOPT_SSLVERSION to TLS v1.2 --- lib/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Connection.php b/lib/Connection.php index 0687d27..e92d410 100755 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -90,7 +90,7 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); - curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); //curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); curl_setopt( From df5d284f405d26ec278411aeabd6a5ff37bc7fba Mon Sep 17 00:00:00 2001 From: juancarlos_agentcars Date: Fri, 27 Apr 2018 10:01:24 -0500 Subject: [PATCH 8/8] Change CURLOPT_SSLVERSION to TLS v1.2 --- lib/Connection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Connection.php b/lib/Connection.php index e92d410..9e77e76 100755 --- a/lib/Connection.php +++ b/lib/Connection.php @@ -90,8 +90,9 @@ public function sendRequest($action, $json = false, $expectResponse = false, $me curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); - curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); //curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); + curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); curl_setopt( $ch,