diff --git a/composer.json b/composer.json index 7820b1d..835bee8 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "postfinancecheckout/sdk", - "version": "4.2.1", + "version": "4.2.2", "description": "PostFinance Checkout SDK for PHP", "keywords": [ "postfinancecheckout", diff --git a/lib/ApiClient.php b/lib/ApiClient.php index 6a801b4..c96d3b3 100644 --- a/lib/ApiClient.php +++ b/lib/ApiClient.php @@ -48,7 +48,7 @@ final class ApiClient { * @var array */ private $defaultHeaders = [ - 'x-meta-sdk-version' => "4.2.1", + 'x-meta-sdk-version' => "4.2.2", 'x-meta-sdk-language' => 'php', 'x-meta-sdk-provider' => "PostFinance Checkout", ]; @@ -58,7 +58,7 @@ final class ApiClient { * * @var string */ - private $userAgent = 'PHP-Client/4.2.1/php'; + private $userAgent = 'PHP-Client/4.2.2/php'; /** * The path to the certificate authority file. diff --git a/lib/Configuration.php b/lib/Configuration.php index bd99765..e1c07fc 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -80,7 +80,7 @@ class Configuration * * @var string */ - protected $userAgent = 'PostFinanceCheckout\Sdk/4.2.1/php'; + protected $userAgent = 'PostFinanceCheckout\Sdk/4.2.2/php'; /** * Debug switch (default set to false) @@ -388,8 +388,8 @@ public static function toDebugReport() $report = 'PHP SDK (PostFinanceCheckout\Sdk) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' OpenAPI Spec Version: 4.2.1' . PHP_EOL; - $report .= ' SDK Package Version: 4.2.1' . PHP_EOL; + $report .= ' OpenAPI Spec Version: 4.2.2' . PHP_EOL; + $report .= ' SDK Package Version: 4.2.2' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Http/CurlHttpClient.php b/lib/Http/CurlHttpClient.php index dc575e5..dc8aba7 100644 --- a/lib/Http/CurlHttpClient.php +++ b/lib/Http/CurlHttpClient.php @@ -40,8 +40,6 @@ public function isSupported() { public function send(ApiClient $apiClient, HttpRequest $request) { $curl = curl_init(); - $tempCAFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "PostFinance Checkout-ca-bundle.crt"; - // set timeout, if needed if ($request->getTimeOut() !== 0) { curl_setopt($curl, CURLOPT_TIMEOUT, $request->getTimeOut()); @@ -61,11 +59,6 @@ public function send(ApiClient $apiClient, HttpRequest $request) { } else { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); - if (file_exists($tempCAFile)) { - // use the temporal CA Bundle if it was set, which indicates a previous error. - $apiClient->setCertificateAuthority($tempCAFile); - curl_setopt($curl, CURLOPT_CAINFO, $apiClient->getCertificateAuthority()); - } } if ($request->getMethod() === HttpRequest::POST) { @@ -109,19 +102,8 @@ public function send(ApiClient $apiClient, HttpRequest $request) { // Make the request $response = curl_exec($curl); - if ($response) { - $response = $this->handleResponse($apiClient, $request, $curl, $response, $request->getUrl()); - } else { - // if there was an error, try again with the CA bundle provided by this SDK. - $caContent = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "ca-bundle.crt"); - file_put_contents($tempCAFile, $caContent); - - // Try again the request, this time with the CA bundle provided by this SDK. - $apiClient->setCertificateAuthority($tempCAFile); - curl_setopt($curl, CURLOPT_CAINFO, $apiClient->getCertificateAuthority()); - $response = curl_exec($curl); - $response = $this->handleResponse($apiClient, $request, $curl, $response, $request->getUrl()); - } + + $response = $this->handleResponse($apiClient, $request, $curl, $response, $request->getUrl()); curl_close($curl); fclose($debugFilePointer); diff --git a/test/ApiClientTest.php b/test/ApiClientTest.php index c450861..6346fcb 100644 --- a/test/ApiClientTest.php +++ b/test/ApiClientTest.php @@ -144,7 +144,7 @@ public function testSdkHeaders() $this->assertGreaterThanOrEqual(4, count($headers)); // Check SDK default header values. - $this->assertEquals($headers['x-meta-sdk-version'], "4.2.1"); + $this->assertEquals($headers['x-meta-sdk-version'], "4.2.2"); $this->assertEquals($headers['x-meta-sdk-language'], 'php'); $this->assertEquals($headers['x-meta-sdk-provider'], "PostFinance Checkout"); $this->assertEquals($headers['x-meta-sdk-language-version'], phpversion());