From 938e0e1a7e68960c9fb4e6b7f354c80c8474b46a Mon Sep 17 00:00:00 2001 From: wallee-deployment-user Date: Wed, 14 Aug 2024 10:16:19 +0200 Subject: [PATCH] Release 4.5.0 --- composer.json | 2 +- lib/ApiClient.php | 4 ++-- lib/Configuration.php | 6 +++--- lib/Http/CurlHttpClient.php | 7 ++++++- lib/Service/ChargeFlowService.php | 2 +- lib/Service/HumanUserService.php | 2 +- lib/Service/TransactionIframeService.php | 2 +- lib/Service/TransactionLightboxService.php | 2 +- lib/Service/TransactionMobileSdkService.php | 2 +- lib/Service/TransactionPaymentPageService.php | 2 +- lib/Service/TransactionService.php | 2 +- test/ApiClientTest.php | 2 +- 12 files changed, 20 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 4b001fc..7c64f5b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "postfinancecheckout/sdk", - "version": "4.4.0", + "version": "4.5.0", "description": "PostFinance Checkout SDK for PHP", "keywords": [ "postfinancecheckout", diff --git a/lib/ApiClient.php b/lib/ApiClient.php index 5a66192..9d91bc7 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.4.0", + 'x-meta-sdk-version' => "4.5.0", '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.4.0/php'; + private $userAgent = 'PHP-Client/4.5.0/php'; /** * The path to the certificate authority file. diff --git a/lib/Configuration.php b/lib/Configuration.php index e4d3823..68a2f94 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -80,7 +80,7 @@ class Configuration * * @var string */ - protected $userAgent = 'PostFinanceCheckout\Sdk/4.4.0/php'; + protected $userAgent = 'PostFinanceCheckout\Sdk/4.5.0/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.4.0' . PHP_EOL; - $report .= ' SDK Package Version: 4.4.0' . PHP_EOL; + $report .= ' OpenAPI Spec Version: 4.5.0' . PHP_EOL; + $report .= ' SDK Package Version: 4.5.0' . 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 5c8ec92..4cc8bb1 100644 --- a/lib/Http/CurlHttpClient.php +++ b/lib/Http/CurlHttpClient.php @@ -183,7 +183,12 @@ public function send(ApiClient $apiClient, HttpRequest $request): HttpResponse { * @return HttpResponse * @throws ConnectionException */ - private function handleResponse(ApiClient $apiClient, HttpRequest $request, \CurlHandle $curl, string|bool $curlResponse, string $url): HttpResponse { + private function handleResponse(ApiClient $apiClient, HttpRequest $request, $curl, $curlResponse, string $url): HttpResponse { + // Remove this check once PHP 7.4 is not supported anymore and this can be set in the arguments: + if (!is_string($curlResponse) && !is_bool($curlResponse)) { + throw new ConnectionException($url, $request->getLogToken(), "API call response was not bool or string."); + } + $httpHeaderSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); // Handle the case where $curlResponse is false (indicating an error) diff --git a/lib/Service/ChargeFlowService.php b/lib/Service/ChargeFlowService.php index a2179c7..9351233 100644 --- a/lib/Service/ChargeFlowService.php +++ b/lib/Service/ChargeFlowService.php @@ -443,7 +443,7 @@ public function fetchChargeFlowPaymentPageUrlWithHttpInfo($space_id, $id) { } // header params $headerParams = []; - $headerAccept = $this->apiClient->selectHeaderAccept(['text/plain;charset=utf-8', 'application/json']); + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json', 'text/plain;charset=utf-8']); if (!is_null($headerAccept)) { $headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept; } diff --git a/lib/Service/HumanUserService.php b/lib/Service/HumanUserService.php index f337312..f0f0f6b 100644 --- a/lib/Service/HumanUserService.php +++ b/lib/Service/HumanUserService.php @@ -414,7 +414,7 @@ public function exportWithHttpInfo($request) { } // header params $headerParams = []; - $headerAccept = $this->apiClient->selectHeaderAccept(['text/csv', 'application/json;charset=utf-8']); + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json;charset=utf-8', 'text/csv']); if (!is_null($headerAccept)) { $headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept; } diff --git a/lib/Service/TransactionIframeService.php b/lib/Service/TransactionIframeService.php index 0d993ef..eeac1c0 100644 --- a/lib/Service/TransactionIframeService.php +++ b/lib/Service/TransactionIframeService.php @@ -106,7 +106,7 @@ public function javascriptUrlWithHttpInfo($space_id, $id) { } // header params $headerParams = []; - $headerAccept = $this->apiClient->selectHeaderAccept(['text/plain;charset=utf-8', 'application/json']); + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json', 'text/plain;charset=utf-8']); if (!is_null($headerAccept)) { $headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept; } diff --git a/lib/Service/TransactionLightboxService.php b/lib/Service/TransactionLightboxService.php index 80bc5f4..38a2806 100644 --- a/lib/Service/TransactionLightboxService.php +++ b/lib/Service/TransactionLightboxService.php @@ -106,7 +106,7 @@ public function javascriptUrlWithHttpInfo($space_id, $id) { } // header params $headerParams = []; - $headerAccept = $this->apiClient->selectHeaderAccept(['text/plain;charset=utf-8', 'application/json']); + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json', 'text/plain;charset=utf-8']); if (!is_null($headerAccept)) { $headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept; } diff --git a/lib/Service/TransactionMobileSdkService.php b/lib/Service/TransactionMobileSdkService.php index e60e355..f7dd2e5 100644 --- a/lib/Service/TransactionMobileSdkService.php +++ b/lib/Service/TransactionMobileSdkService.php @@ -100,7 +100,7 @@ public function paymentFormUrlWithHttpInfo($credentials) { } // header params $headerParams = []; - $headerAccept = $this->apiClient->selectHeaderAccept(['text/plain;charset=utf-8', 'application/json']); + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json', 'text/plain;charset=utf-8']); if (!is_null($headerAccept)) { $headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept; } diff --git a/lib/Service/TransactionPaymentPageService.php b/lib/Service/TransactionPaymentPageService.php index 3654a22..dcdac7d 100644 --- a/lib/Service/TransactionPaymentPageService.php +++ b/lib/Service/TransactionPaymentPageService.php @@ -106,7 +106,7 @@ public function paymentPageUrlWithHttpInfo($space_id, $id) { } // header params $headerParams = []; - $headerAccept = $this->apiClient->selectHeaderAccept(['text/plain;charset=utf-8', 'application/json']); + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json', 'text/plain;charset=utf-8']); if (!is_null($headerAccept)) { $headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept; } diff --git a/lib/Service/TransactionService.php b/lib/Service/TransactionService.php index 087f54c..b98b4c1 100644 --- a/lib/Service/TransactionService.php +++ b/lib/Service/TransactionService.php @@ -673,7 +673,7 @@ public function exportWithHttpInfo($space_id, $request) { } // header params $headerParams = []; - $headerAccept = $this->apiClient->selectHeaderAccept(['text/csv', 'application/json;charset=utf-8']); + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json;charset=utf-8', 'text/csv']); if (!is_null($headerAccept)) { $headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept; } diff --git a/test/ApiClientTest.php b/test/ApiClientTest.php index 7e32a44..184ba75 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.4.0"); + $this->assertEquals($headers['x-meta-sdk-version'], "4.5.0"); $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());