Skip to content

Commit

Permalink
Release 2.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
vttn committed Apr 2, 2020
1 parent d580d84 commit 726a1e1
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 18 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": "2.0.13",
"version": "2.0.14",
"description": "PostFinance Checkout SDK for PHP",
"keywords": [
"postfinancecheckout",
Expand Down
2 changes: 1 addition & 1 deletion lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class ApiClient {
*
* @var string
*/
private $userAgent = 'PHP-Client/2.0.13/php';
private $userAgent = 'PHP-Client/2.0.14/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/2.0.13/php';
protected $userAgent = 'PostFinanceCheckout\Sdk/2.0.14/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: 2.0.13' . PHP_EOL;
$report .= ' SDK Package Version: 2.0.13' . PHP_EOL;
$report .= ' OpenAPI Spec Version: 2.0.14' . PHP_EOL;
$report .= ' SDK Package Version: 2.0.14' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;

return $report;
Expand Down
189 changes: 189 additions & 0 deletions lib/Service/TransactionLightboxService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?php
/**
* SDK
*
* This library allows to interact with the payment service.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


namespace PostFinanceCheckout\Sdk\Service;

use PostFinanceCheckout\Sdk\ApiClient;
use PostFinanceCheckout\Sdk\ApiException;
use PostFinanceCheckout\Sdk\ApiResponse;
use PostFinanceCheckout\Sdk\Http\HttpRequest;
use PostFinanceCheckout\Sdk\ObjectSerializer;

/**
* TransactionLightboxService service
*
* @category Class
* @package PostFinanceCheckout\Sdk
* @author customweb GmbH
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
*/
class TransactionLightboxService {

/**
* The API client instance.
*
* @var ApiClient
*/
private $apiClient;

/**
* Constructor.
*
* @param ApiClient $apiClient the api client
*/
public function __construct(ApiClient $apiClient) {
if (is_null($apiClient)) {
throw new \InvalidArgumentException('The api client is required.');
}

$this->apiClient = $apiClient;
}

/**
* Returns the API client instance.
*
* @return ApiClient
*/
public function getApiClient() {
return $this->apiClient;
}


/**
* Operation javascriptUrl
*
* Build JavaScript URL
*
* @param int $space_id (required)
* @param int $id The id of the transaction which should be returned. (required)
* @throws \PostFinanceCheckout\Sdk\ApiException
* @throws \PostFinanceCheckout\Sdk\VersioningException
* @throws \PostFinanceCheckout\Sdk\Http\ConnectionException
* @return string
*/
public function javascriptUrl($space_id, $id) {
return $this->javascriptUrlWithHttpInfo($space_id, $id)->getData();
}

/**
* Operation javascriptUrlWithHttpInfo
*
* Build JavaScript URL
*
* @param int $space_id (required)
* @param int $id The id of the transaction which should be returned. (required)
* @throws \PostFinanceCheckout\Sdk\ApiException
* @throws \PostFinanceCheckout\Sdk\VersioningException
* @throws \PostFinanceCheckout\Sdk\Http\ConnectionException
* @return ApiResponse
*/
public function javascriptUrlWithHttpInfo($space_id, $id) {
// verify the required parameter 'space_id' is set
if (is_null($space_id)) {
throw new \InvalidArgumentException('Missing the required parameter $space_id when calling javascriptUrl');
}
// verify the required parameter 'id' is set
if (is_null($id)) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling javascriptUrl');
}
// header params
$headerParams = [];
$headerAccept = $this->apiClient->selectHeaderAccept(['application/json', 'text/plain;charset=utf-8']);
if (!is_null($headerAccept)) {
$headerParams[HttpRequest::HEADER_KEY_ACCEPT] = $headerAccept;
}
$headerParams[HttpRequest::HEADER_KEY_CONTENT_TYPE] = $this->apiClient->selectHeaderContentType([]);

// query params
$queryParams = [];
if (!is_null($space_id)) {
$queryParams['spaceId'] = $this->apiClient->getSerializer()->toQueryValue($space_id);
}
if (!is_null($id)) {
$queryParams['id'] = $this->apiClient->getSerializer()->toQueryValue($id);
}

// path params
$resourcePath = '/transaction-lightbox/javascript-url';
// default format to json
$resourcePath = str_replace('{format}', 'json', $resourcePath);

// form params
$formParams = [];

// for model (json/xml)
$httpBody = '';
if (isset($tempBody)) {
$httpBody = $tempBody; // $tempBody is the method argument, if present
} elseif (!empty($formParams)) {
$httpBody = $formParams; // for HTTP post (form)
}
// make the API Call
try {
$response = $this->apiClient->callApi(
$resourcePath,
'GET',
$queryParams,
$httpBody,
$headerParams,
'string',
'/transaction-lightbox/javascript-url'
);
return new ApiResponse($response->getStatusCode(), $response->getHeaders(), $this->apiClient->getSerializer()->deserialize($response->getData(), 'string', $response->getHeaders()));
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 409:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\PostFinanceCheckout\Sdk\Model\ClientError',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 442:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\PostFinanceCheckout\Sdk\Model\ClientError',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 542:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\PostFinanceCheckout\Sdk\Model\ServerError',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}

}
26 changes: 13 additions & 13 deletions test/TransactionPaymentPageServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,36 @@
*/


namespace Wallee\Sdk\Test;
namespace PostFinanceCheckout\Sdk\Test;

use PHPUnit\Framework\TestCase;
use Wallee\Sdk\ApiClient;
use Wallee\Sdk\Http\HttpClientFactory;
use Wallee\Sdk\Model\AddressCreate;
use Wallee\Sdk\Model\LineItemCreate;
use Wallee\Sdk\Model\LineItemType;
use Wallee\Sdk\Model\TransactionCreate;
use Wallee\Sdk\Service\TransactionPaymentPageService;
use Wallee\Sdk\Service\TransactionService;
use PostFinanceCheckout\Sdk\ApiClient;
use PostFinanceCheckout\Sdk\Http\HttpClientFactory;
use PostFinanceCheckout\Sdk\Model\AddressCreate;
use PostFinanceCheckout\Sdk\Model\LineItemCreate;
use PostFinanceCheckout\Sdk\Model\LineItemType;
use PostFinanceCheckout\Sdk\Model\TransactionCreate;
use PostFinanceCheckout\Sdk\Service\TransactionPaymentPageService;
use PostFinanceCheckout\Sdk\Service\TransactionService;

/**
* This class tests the basic functionality of the SDK.
*
* @category Class
* @package Wallee\Sdk
* @package PostFinanceCheckout\Sdk
* @author customweb GmbH
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
*/
class TransactionPaymentPageServiceTest extends TestCase
{

/**
* @var Wallee\Sdk\ApiClient
* @var PostFinanceCheckout\Sdk\ApiClient
*/
private $apiClient;

/**
* @var Wallee\Sdk\Model\TransactionCreate
* @var PostFinanceCheckout\Sdk\Model\TransactionCreate
*/
private $transactionBag;

Expand Down Expand Up @@ -88,7 +88,7 @@ public function setUp()
}

/**
* @return Wallee\Sdk\ApiClient
* @return PostFinanceCheckout\Sdk\ApiClient
*/
private function getApiClient()
{
Expand Down

0 comments on commit 726a1e1

Please sign in to comment.