Skip to content

Commit

Permalink
Release 4.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wallee-deployment-user committed Jun 14, 2024
1 parent 6e3ee63 commit ec16152
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 27 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postfinancecheckout/sdk",
"version": "4.2.1",
"version": "4.2.2",
"description": "PostFinance Checkout SDK for PHP",
"keywords": [
"postfinancecheckout",
Expand Down
4 changes: 2 additions & 2 deletions lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
];
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
22 changes: 2 additions & 20 deletions lib/Http/CurlHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/ApiClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit ec16152

Please sign in to comment.