diff --git a/composer.json b/composer.json index 1ed2d84..17bb018 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "postfinancecheckout/sdk", - "version": "2.0.13", + "version": "2.0.14", "description": "PostFinance Checkout SDK for PHP", "keywords": [ "postfinancecheckout", diff --git a/lib/ApiClient.php b/lib/ApiClient.php index 8dfcd0d..d2c6eeb 100644 --- a/lib/ApiClient.php +++ b/lib/ApiClient.php @@ -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. diff --git a/lib/Configuration.php b/lib/Configuration.php index eeaf37f..a1e72da 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -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) @@ -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; diff --git a/lib/Service/TransactionLightboxService.php b/lib/Service/TransactionLightboxService.php new file mode 100644 index 0000000..1c288e3 --- /dev/null +++ b/lib/Service/TransactionLightboxService.php @@ -0,0 +1,189 @@ +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; + } + } + +} diff --git a/test/TransactionPaymentPageServiceTest.php b/test/TransactionPaymentPageServiceTest.php index a9cf396..89d32a2 100644 --- a/test/TransactionPaymentPageServiceTest.php +++ b/test/TransactionPaymentPageServiceTest.php @@ -18,23 +18,23 @@ */ -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 */ @@ -42,12 +42,12 @@ 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; @@ -88,7 +88,7 @@ public function setUp() } /** - * @return Wallee\Sdk\ApiClient + * @return PostFinanceCheckout\Sdk\ApiClient */ private function getApiClient() {