From f5fdf039f26fba98410a01964a8f308ee7326170 Mon Sep 17 00:00:00 2001 From: Vincent Pietri Date: Mon, 23 Jan 2023 16:18:18 +0100 Subject: [PATCH] upgrade 4.73 --- CHANGELOG.md | 7 ++++++ src/Payline/PaylineSDK.php | 13 ++++++++--- src/Payline/WebserviceClient.php | 30 +++++++++++++++++++++++++- src/Payline/wsdl/DirectPaymentAPI.wsdl | 25 +++++++++++++++++++++ src/Payline/wsdl/ExtendedAPI.wsdl | 25 +++++++++++++++++++++ src/Payline/wsdl/WebPaymentAPI.wsdl | 25 +++++++++++++++++++++ 6 files changed, 121 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d9ca34..68256c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ---------------------------------------- +* 4.73 (2023-01-20) + * Update WSDL from 4.72 to 4.73 + * Fix proxy usage + * Fix exception log + +---------------------------------------- + * 4.72.1 (2023-01-09) * fix missing namespace on address for buyer and wallet diff --git a/src/Payline/PaylineSDK.php b/src/Payline/PaylineSDK.php index c1c699c..69fccc1 100644 --- a/src/Payline/PaylineSDK.php +++ b/src/Payline/PaylineSDK.php @@ -46,7 +46,7 @@ class PaylineSDK * Payline release corresponding to this version of the package * @see https://docs.payline.com/display/DT/API+version+history */ - const SDK_RELEASE = 'PHP SDK 4.72.1'; + const SDK_RELEASE = 'PHP SDK 4.73'; /** * development environment flag @@ -1104,6 +1104,9 @@ protected function webServiceRequest(array $array, array $WSRequest, $PaylineAPI $WSRequest = $this->completeWSRequest($array, $WSRequest, $PaylineAPI, $Method); + $client = false; + $logRequest = array(); + try { if(!$this->webServicesEndpoint){ throw new \Exception('Endpoint error (check `environment` parameter of PaylineSDK constructor)'); @@ -1178,7 +1181,9 @@ protected function webServiceRequest(array $array, array $WSRequest, $PaylineAPI } return $response; } catch (\Exception $e) { - $this->logger->info($Method . 'Request', $logRequest); + if($logRequest) { + $this->logger->info($Method . 'Request', $logRequest); + } $this->logger->error('Exception occured at ' . $Method . ' call', array( 'code' => $e->getCode(), 'message' => $e->getMessage(), @@ -1193,7 +1198,9 @@ protected function webServiceRequest(array $array, array $WSRequest, $PaylineAPI return $ERROR; } finally { - $this->lastSoapCallData = $client->retrieveSoapLastContent(); + if($client) { + $this->lastSoapCallData = $client->retrieveSoapLastContent(); + } } } diff --git a/src/Payline/WebserviceClient.php b/src/Payline/WebserviceClient.php index 9854fb5..8daa775 100644 --- a/src/Payline/WebserviceClient.php +++ b/src/Payline/WebserviceClient.php @@ -341,6 +341,11 @@ protected function buildClientSdk($location, $extraOptions = array()) $defaultOptions['trace'] = false; $options = array_merge($defaultOptions, $this->soapOptions); + if(empty($options['proxy_login'])) { + unset($options['proxy_login']); + unset($options['proxy_password']); + } + if(!empty($extraOptions)) { $options = $this->array_merge_recursive_distinct($options, $extraOptions); } @@ -368,6 +373,9 @@ protected function buildClientSdk($location, $extraOptions = array()) $sdkClient->__setLocation($location); + unset($options['proxy_login']); + unset($options['proxy_password']); + return $sdkClient; } @@ -440,6 +448,18 @@ protected function getAllFailoverServicesEndpoint() $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->endpointsDirectoryLocation); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + // Use proxy parameters (from soap options in webclient) + if (!empty($this->soapOptions['proxy_host'])) { + $proxy = $this->soapOptions['proxy_host'].':'.$this->soapOptions['proxy_port']; + curl_setopt($ch, CURLOPT_PROXY, $proxy); + + if(!empty($this->soapOptions['proxy_login']) && !empty($this->soapOptions['proxy_password'])) { + $proxyAuth = $this->soapOptions['proxy_login'] . ':' . $this->soapOptions['proxy_password']; + curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth); + } + } + $jsonContent = curl_exec($ch); curl_close($ch); break; @@ -449,6 +469,15 @@ protected function getAllFailoverServicesEndpoint() 'method'=>"GET" ) ); + // Use proxy parameters (from soap options in webclient) + if (!empty($this->soapOptions['proxy_host'])) { + $opts['http']['proxy'] = $this->soapOptions['proxy_host'].':'.$this->soapOptions['proxy_port']; + $opts['http']['request_fulluri'] = true; + if(!empty($this->soapOptions['proxy_login']) && !empty($this->soapOptions['proxy_password'])) { + $proxyAuth = base64_encode($this->soapOptions['proxy_login'] . ':' . $this->soapOptions['proxy_password']); + $opts['http']['header'] = "Proxy-Authorization: Basic " . $proxyAuth; + } + } $context = stream_context_create($opts); $jsonContent = file_get_contents($this->endpointsDirectoryLocation, false, $context); break; @@ -456,7 +485,6 @@ protected function getAllFailoverServicesEndpoint() break; } - if(!empty($jsonContent)) { $endpointData = json_decode($jsonContent, true); if (!empty($endpointData['urls']) && is_array($endpointData['urls'])) { diff --git a/src/Payline/wsdl/DirectPaymentAPI.wsdl b/src/Payline/wsdl/DirectPaymentAPI.wsdl index 0a60e6b..8b1840d 100644 --- a/src/Payline/wsdl/DirectPaymentAPI.wsdl +++ b/src/Payline/wsdl/DirectPaymentAPI.wsdl @@ -1109,6 +1109,7 @@ + @@ -1192,6 +1193,7 @@ + @@ -1643,6 +1645,7 @@ + @@ -2892,6 +2895,28 @@ + + + + This element contains information about SDK 3DS Challenge. + + + + + + + + + + + + + + + + + + diff --git a/src/Payline/wsdl/ExtendedAPI.wsdl b/src/Payline/wsdl/ExtendedAPI.wsdl index 9f79c04..427a933 100644 --- a/src/Payline/wsdl/ExtendedAPI.wsdl +++ b/src/Payline/wsdl/ExtendedAPI.wsdl @@ -1109,6 +1109,7 @@ + @@ -1192,6 +1193,7 @@ + @@ -1643,6 +1645,7 @@ + @@ -2892,6 +2895,28 @@ + + + + This element contains information about SDK 3DS Challenge. + + + + + + + + + + + + + + + + + + diff --git a/src/Payline/wsdl/WebPaymentAPI.wsdl b/src/Payline/wsdl/WebPaymentAPI.wsdl index 527ed78..d135d1a 100644 --- a/src/Payline/wsdl/WebPaymentAPI.wsdl +++ b/src/Payline/wsdl/WebPaymentAPI.wsdl @@ -1109,6 +1109,7 @@ + @@ -1192,6 +1193,7 @@ + @@ -1643,6 +1645,7 @@ + @@ -2892,6 +2895,28 @@ + + + + This element contains information about SDK 3DS Challenge. + + + + + + + + + + + + + + + + + +