From 29c1dff1cddaa401327af2726e26a765424f803b Mon Sep 17 00:00:00 2001 From: wallee-deployment-user Date: Wed, 29 Nov 2023 11:43:07 +0100 Subject: [PATCH] Release 4.0.1 --- composer.json | 2 +- lib/ApiClient.php | 28 +- lib/Configuration.php | 6 +- lib/Http/HttpRequest.php | 4 +- lib/Model/AbstractPaymentLinkUpdate.php | 2 +- lib/Model/CardAuthenticationResponse.php | 12 +- lib/Model/ChargeAttempt.php | 26 +- lib/Model/PaymentConnector.php | 32 ++ lib/Model/PaymentContract.php | 32 ++ lib/Model/PaymentLink.php | 2 +- lib/Model/PaymentLinkUpdate.php | 2 +- lib/Model/RestCountry.php | 72 ++-- lib/Model/WalletType.php | 336 +++++++++++++++++- lib/Model/WebAppConfirmationRequest.php | 310 ++++++++++++++++ lib/Model/WebAppConfirmationResponse.php | 430 +++++++++++++++++++++++ lib/Model/WebhookEncryptionPublicKey.php | 334 ++++++++++++++++++ lib/Service/TokenService.php | 113 ++++++ lib/Service/WebAppService.php | 375 ++++++++++++++++++++ lib/Service/WebhookEncryptionService.php | 173 +++++++++ test/ApiClientTest.php | 2 +- 20 files changed, 2213 insertions(+), 80 deletions(-) create mode 100644 lib/Model/WebAppConfirmationRequest.php create mode 100644 lib/Model/WebAppConfirmationResponse.php create mode 100644 lib/Model/WebhookEncryptionPublicKey.php create mode 100644 lib/Service/WebAppService.php create mode 100644 lib/Service/WebhookEncryptionService.php diff --git a/composer.json b/composer.json index 91ee4b1..24a3121 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "postfinancecheckout/sdk", - "version": "4.0.0", + "version": "4.0.1", "description": "PostFinance Checkout SDK for PHP", "keywords": [ "postfinancecheckout", diff --git a/lib/ApiClient.php b/lib/ApiClient.php index 5c5c300..b014a85 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.0.0", + 'x-meta-sdk-version' => "4.0.1", '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.0.0/php'; + private $userAgent = 'PHP-Client/4.0.1/php'; /** * The path to the certificate authority file. @@ -1461,6 +1461,30 @@ public function getUserSpaceRoleService() { return $this->userSpaceRoleService; } + protected $webAppService; + + /** + * @return \PostFinanceCheckout\Sdk\Service\WebAppService + */ + public function getWebAppService() { + if(is_null($this->webAppService)){ + $this->webAppService = new \PostFinanceCheckout\Sdk\Service\WebAppService($this); + } + return $this->webAppService; + } + + protected $webhookEncryptionService; + + /** + * @return \PostFinanceCheckout\Sdk\Service\WebhookEncryptionService + */ + public function getWebhookEncryptionService() { + if(is_null($this->webhookEncryptionService)){ + $this->webhookEncryptionService = new \PostFinanceCheckout\Sdk\Service\WebhookEncryptionService($this); + } + return $this->webhookEncryptionService; + } + protected $webhookListenerService; /** diff --git a/lib/Configuration.php b/lib/Configuration.php index bf74a82..a8820a2 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -80,7 +80,7 @@ class Configuration * * @var string */ - protected $userAgent = 'PostFinanceCheckout\Sdk/4.0.0/php'; + protected $userAgent = 'PostFinanceCheckout\Sdk/4.0.1/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.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 4.0.0' . PHP_EOL; + $report .= ' OpenAPI Spec Version: 4.0.1' . PHP_EOL; + $report .= ' SDK Package Version: 4.0.1' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Http/HttpRequest.php b/lib/Http/HttpRequest.php index 508b481..1538767 100644 --- a/lib/Http/HttpRequest.php +++ b/lib/Http/HttpRequest.php @@ -76,11 +76,11 @@ final class HttpRequest { const HEADER_KEY_ACCEPT = 'accept'; /** - * The key of the 'x-wallee-logtoken' header. + * The key of the 'x-postfinancecheckout-logtoken' header. * * @var string */ - const HEADER_LOG_TOKEN = 'x-wallee-logtoken'; + const HEADER_LOG_TOKEN = 'x-postfinancecheckout-logtoken'; /** * The object serializer. diff --git a/lib/Model/AbstractPaymentLinkUpdate.php b/lib/Model/AbstractPaymentLinkUpdate.php index e3feab9..76d2e87 100644 --- a/lib/Model/AbstractPaymentLinkUpdate.php +++ b/lib/Model/AbstractPaymentLinkUpdate.php @@ -461,7 +461,7 @@ public function getLineItems() /** * Sets line_items * - * @param \PostFinanceCheckout\Sdk\Model\LineItemCreate[] $line_items The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + * @param \PostFinanceCheckout\Sdk\Model\LineItemCreate[] $line_items The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. * * @return $this */ diff --git a/lib/Model/CardAuthenticationResponse.php b/lib/Model/CardAuthenticationResponse.php index 519e610..574b669 100644 --- a/lib/Model/CardAuthenticationResponse.php +++ b/lib/Model/CardAuthenticationResponse.php @@ -35,11 +35,11 @@ class CardAuthenticationResponse /** * Possible values of this enum */ - const ENROLLMENT_VERIFICATION_ERROR = 'ENROLLMENT_VERIFICATION_ERROR'; + const FULLY_AUTHENTICATED = 'FULLY_AUTHENTICATED'; + const AUTHENTICATION_NOT_REQUIRED = 'AUTHENTICATION_NOT_REQUIRED'; const NOT_ENROLLED = 'NOT_ENROLLED'; + const ENROLLMENT_ERROR = 'ENROLLMENT_ERROR'; const AUTHENTICATION_ERROR = 'AUTHENTICATION_ERROR'; - const AUTHENTICATION_NOT_REQUIRED = 'AUTHENTICATION_NOT_REQUIRED'; - const FULLY_AUTHENTICATED = 'FULLY_AUTHENTICATED'; /** * Gets allowable values of the enum @@ -48,11 +48,11 @@ class CardAuthenticationResponse public static function getAllowableEnumValues() { return [ - self::ENROLLMENT_VERIFICATION_ERROR, + self::FULLY_AUTHENTICATED, + self::AUTHENTICATION_NOT_REQUIRED, self::NOT_ENROLLED, + self::ENROLLMENT_ERROR, self::AUTHENTICATION_ERROR, - self::AUTHENTICATION_NOT_REQUIRED, - self::FULLY_AUTHENTICATED, ]; } } diff --git a/lib/Model/ChargeAttempt.php b/lib/Model/ChargeAttempt.php index da90e13..9d6074e 100644 --- a/lib/Model/ChargeAttempt.php +++ b/lib/Model/ChargeAttempt.php @@ -72,7 +72,7 @@ class ChargeAttempt extends TransactionAwareEntity 'token_version' => '\PostFinanceCheckout\Sdk\Model\TokenVersion', 'user_failure_message' => 'string', 'version' => 'int', - 'wallet_type' => '\PostFinanceCheckout\Sdk\Model\WalletType' + 'wallet' => '\PostFinanceCheckout\Sdk\Model\WalletType' ]; /** @@ -106,7 +106,7 @@ class ChargeAttempt extends TransactionAwareEntity 'token_version' => null, 'user_failure_message' => null, 'version' => 'int32', - 'wallet_type' => null + 'wallet' => null ]; /** @@ -141,7 +141,7 @@ class ChargeAttempt extends TransactionAwareEntity 'token_version' => 'tokenVersion', 'user_failure_message' => 'userFailureMessage', 'version' => 'version', - 'wallet_type' => 'walletType' + 'wallet' => 'wallet' ]; /** @@ -175,7 +175,7 @@ class ChargeAttempt extends TransactionAwareEntity 'token_version' => 'setTokenVersion', 'user_failure_message' => 'setUserFailureMessage', 'version' => 'setVersion', - 'wallet_type' => 'setWalletType' + 'wallet' => 'setWallet' ]; /** @@ -209,7 +209,7 @@ class ChargeAttempt extends TransactionAwareEntity 'token_version' => 'getTokenVersion', 'user_failure_message' => 'getUserFailureMessage', 'version' => 'getVersion', - 'wallet_type' => 'getWalletType' + 'wallet' => 'getWallet' ]; @@ -276,7 +276,7 @@ public function __construct(array $data = null) $this->container['version'] = isset($data['version']) ? $data['version'] : null; - $this->container['wallet_type'] = isset($data['wallet_type']) ? $data['wallet_type'] : null; + $this->container['wallet'] = isset($data['wallet']) ? $data['wallet'] : null; } @@ -1003,25 +1003,25 @@ public function setVersion($version) /** - * Gets wallet_type + * Gets wallet * * @return \PostFinanceCheckout\Sdk\Model\WalletType */ - public function getWalletType() + public function getWallet() { - return $this->container['wallet_type']; + return $this->container['wallet']; } /** - * Sets wallet_type + * Sets wallet * - * @param \PostFinanceCheckout\Sdk\Model\WalletType $wallet_type + * @param \PostFinanceCheckout\Sdk\Model\WalletType $wallet * * @return $this */ - public function setWalletType($wallet_type) + public function setWallet($wallet) { - $this->container['wallet_type'] = $wallet_type; + $this->container['wallet'] = $wallet; return $this; } diff --git a/lib/Model/PaymentConnector.php b/lib/Model/PaymentConnector.php index a9a0372..0141503 100644 --- a/lib/Model/PaymentConnector.php +++ b/lib/Model/PaymentConnector.php @@ -60,6 +60,7 @@ class PaymentConnector implements ModelInterface, ArrayAccess 'payment_method_brand' => '\PostFinanceCheckout\Sdk\Model\PaymentMethodBrand', 'primary_risk_taker' => '\PostFinanceCheckout\Sdk\Model\PaymentPrimaryRiskTaker', 'processor' => 'int', + 'supported_currencies' => 'string[]', 'supported_customers_presences' => '\PostFinanceCheckout\Sdk\Model\CustomersPresence[]', 'supported_features' => 'int[]' ]; @@ -81,6 +82,7 @@ class PaymentConnector implements ModelInterface, ArrayAccess 'payment_method_brand' => null, 'primary_risk_taker' => null, 'processor' => 'int64', + 'supported_currencies' => null, 'supported_customers_presences' => null, 'supported_features' => 'int64' ]; @@ -103,6 +105,7 @@ class PaymentConnector implements ModelInterface, ArrayAccess 'payment_method_brand' => 'paymentMethodBrand', 'primary_risk_taker' => 'primaryRiskTaker', 'processor' => 'processor', + 'supported_currencies' => 'supportedCurrencies', 'supported_customers_presences' => 'supportedCustomersPresences', 'supported_features' => 'supportedFeatures' ]; @@ -124,6 +127,7 @@ class PaymentConnector implements ModelInterface, ArrayAccess 'payment_method_brand' => 'setPaymentMethodBrand', 'primary_risk_taker' => 'setPrimaryRiskTaker', 'processor' => 'setProcessor', + 'supported_currencies' => 'setSupportedCurrencies', 'supported_customers_presences' => 'setSupportedCustomersPresences', 'supported_features' => 'setSupportedFeatures' ]; @@ -145,6 +149,7 @@ class PaymentConnector implements ModelInterface, ArrayAccess 'payment_method_brand' => 'getPaymentMethodBrand', 'primary_risk_taker' => 'getPrimaryRiskTaker', 'processor' => 'getProcessor', + 'supported_currencies' => 'getSupportedCurrencies', 'supported_customers_presences' => 'getSupportedCustomersPresences', 'supported_features' => 'getSupportedFeatures' ]; @@ -189,6 +194,8 @@ public function __construct(array $data = null) $this->container['processor'] = isset($data['processor']) ? $data['processor'] : null; + $this->container['supported_currencies'] = isset($data['supported_currencies']) ? $data['supported_currencies'] : null; + $this->container['supported_customers_presences'] = isset($data['supported_customers_presences']) ? $data['supported_customers_presences'] : null; $this->container['supported_features'] = isset($data['supported_features']) ? $data['supported_features'] : null; @@ -559,6 +566,31 @@ public function setProcessor($processor) } + /** + * Gets supported_currencies + * + * @return string[] + */ + public function getSupportedCurrencies() + { + return $this->container['supported_currencies']; + } + + /** + * Sets supported_currencies + * + * @param string[] $supported_currencies + * + * @return $this + */ + public function setSupportedCurrencies($supported_currencies) + { + $this->container['supported_currencies'] = $supported_currencies; + + return $this; + } + + /** * Gets supported_customers_presences * diff --git a/lib/Model/PaymentContract.php b/lib/Model/PaymentContract.php index 2193f52..da27e52 100644 --- a/lib/Model/PaymentContract.php +++ b/lib/Model/PaymentContract.php @@ -57,6 +57,7 @@ class PaymentContract implements ModelInterface, ArrayAccess 'created_on' => '\DateTime', 'external_id' => 'string', 'id' => 'int', + 'last_modified_date' => '\DateTime', 'rejected_on' => '\DateTime', 'rejection_reason' => '\PostFinanceCheckout\Sdk\Model\FailureReason', 'start_terminating_on' => '\DateTime', @@ -80,6 +81,7 @@ class PaymentContract implements ModelInterface, ArrayAccess 'created_on' => 'date-time', 'external_id' => null, 'id' => 'int64', + 'last_modified_date' => 'date-time', 'rejected_on' => 'date-time', 'rejection_reason' => null, 'start_terminating_on' => 'date-time', @@ -104,6 +106,7 @@ class PaymentContract implements ModelInterface, ArrayAccess 'created_on' => 'createdOn', 'external_id' => 'externalId', 'id' => 'id', + 'last_modified_date' => 'lastModifiedDate', 'rejected_on' => 'rejectedOn', 'rejection_reason' => 'rejectionReason', 'start_terminating_on' => 'startTerminatingOn', @@ -127,6 +130,7 @@ class PaymentContract implements ModelInterface, ArrayAccess 'created_on' => 'setCreatedOn', 'external_id' => 'setExternalId', 'id' => 'setId', + 'last_modified_date' => 'setLastModifiedDate', 'rejected_on' => 'setRejectedOn', 'rejection_reason' => 'setRejectionReason', 'start_terminating_on' => 'setStartTerminatingOn', @@ -150,6 +154,7 @@ class PaymentContract implements ModelInterface, ArrayAccess 'created_on' => 'getCreatedOn', 'external_id' => 'getExternalId', 'id' => 'getId', + 'last_modified_date' => 'getLastModifiedDate', 'rejected_on' => 'getRejectedOn', 'rejection_reason' => 'getRejectionReason', 'start_terminating_on' => 'getStartTerminatingOn', @@ -193,6 +198,8 @@ public function __construct(array $data = null) $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['last_modified_date'] = isset($data['last_modified_date']) ? $data['last_modified_date'] : null; + $this->container['rejected_on'] = isset($data['rejected_on']) ? $data['rejected_on'] : null; $this->container['rejection_reason'] = isset($data['rejection_reason']) ? $data['rejection_reason'] : null; @@ -498,6 +505,31 @@ public function setId($id) } + /** + * Gets last_modified_date + * + * @return \DateTime + */ + public function getLastModifiedDate() + { + return $this->container['last_modified_date']; + } + + /** + * Sets last_modified_date + * + * @param \DateTime $last_modified_date The date and time when the object was last modified. + * + * @return $this + */ + public function setLastModifiedDate($last_modified_date) + { + $this->container['last_modified_date'] = $last_modified_date; + + return $this; + } + + /** * Gets rejected_on * diff --git a/lib/Model/PaymentLink.php b/lib/Model/PaymentLink.php index 1da358e..3d745aa 100644 --- a/lib/Model/PaymentLink.php +++ b/lib/Model/PaymentLink.php @@ -568,7 +568,7 @@ public function getLineItems() /** * Sets line_items * - * @param \PostFinanceCheckout\Sdk\Model\LineItem[] $line_items The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + * @param \PostFinanceCheckout\Sdk\Model\LineItem[] $line_items The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. * * @return $this */ diff --git a/lib/Model/PaymentLinkUpdate.php b/lib/Model/PaymentLinkUpdate.php index 8c02793..d60df71 100644 --- a/lib/Model/PaymentLinkUpdate.php +++ b/lib/Model/PaymentLinkUpdate.php @@ -532,7 +532,7 @@ public function getLineItems() /** * Sets line_items * - * @param \PostFinanceCheckout\Sdk\Model\LineItemCreate[] $line_items The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. + * @param \PostFinanceCheckout\Sdk\Model\LineItemCreate[] $line_items The line items allows to define the line items for this payment link. When the line items are defined they cannot be overridden through the request parameters. If no amount for the payment link is defined, the additional checkout page to enter the amount is shown to the consumer. * * @return $this */ diff --git a/lib/Model/RestCountry.php b/lib/Model/RestCountry.php index 368aee5..857f584 100644 --- a/lib/Model/RestCountry.php +++ b/lib/Model/RestCountry.php @@ -49,9 +49,9 @@ class RestCountry implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'iso_code2_letter' => 'string', - 'iso_code3_letter' => 'string', 'address_format' => '\PostFinanceCheckout\Sdk\Model\RestAddressFormat', + 'iso_code2' => 'string', + 'iso_code3' => 'string', 'name' => 'string', 'numeric_code' => 'string', 'state_codes' => 'string[]' @@ -63,9 +63,9 @@ class RestCountry implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - 'iso_code2_letter' => null, - 'iso_code3_letter' => null, 'address_format' => null, + 'iso_code2' => null, + 'iso_code3' => null, 'name' => null, 'numeric_code' => null, 'state_codes' => null @@ -78,9 +78,9 @@ class RestCountry implements ModelInterface, ArrayAccess * @var string[] */ protected static $attributeMap = [ - 'iso_code2_letter' => 'ISOCode2Letter', - 'iso_code3_letter' => 'ISOCode3Letter', 'address_format' => 'addressFormat', + 'iso_code2' => 'isoCode2', + 'iso_code3' => 'isoCode3', 'name' => 'name', 'numeric_code' => 'numericCode', 'state_codes' => 'stateCodes' @@ -92,9 +92,9 @@ class RestCountry implements ModelInterface, ArrayAccess * @var string[] */ protected static $setters = [ - 'iso_code2_letter' => 'setIsoCode2Letter', - 'iso_code3_letter' => 'setIsoCode3Letter', 'address_format' => 'setAddressFormat', + 'iso_code2' => 'setIsoCode2', + 'iso_code3' => 'setIsoCode3', 'name' => 'setName', 'numeric_code' => 'setNumericCode', 'state_codes' => 'setStateCodes' @@ -106,9 +106,9 @@ class RestCountry implements ModelInterface, ArrayAccess * @var string[] */ protected static $getters = [ - 'iso_code2_letter' => 'getIsoCode2Letter', - 'iso_code3_letter' => 'getIsoCode3Letter', 'address_format' => 'getAddressFormat', + 'iso_code2' => 'getIsoCode2', + 'iso_code3' => 'getIsoCode3', 'name' => 'getName', 'numeric_code' => 'getNumericCode', 'state_codes' => 'getStateCodes' @@ -132,11 +132,11 @@ class RestCountry implements ModelInterface, ArrayAccess public function __construct(array $data = null) { - $this->container['iso_code2_letter'] = isset($data['iso_code2_letter']) ? $data['iso_code2_letter'] : null; + $this->container['address_format'] = isset($data['address_format']) ? $data['address_format'] : null; - $this->container['iso_code3_letter'] = isset($data['iso_code3_letter']) ? $data['iso_code3_letter'] : null; + $this->container['iso_code2'] = isset($data['iso_code2']) ? $data['iso_code2'] : null; - $this->container['address_format'] = isset($data['address_format']) ? $data['address_format'] : null; + $this->container['iso_code3'] = isset($data['iso_code3']) ? $data['iso_code3'] : null; $this->container['name'] = isset($data['name']) ? $data['name'] : null; @@ -236,75 +236,75 @@ public function valid() /** - * Gets iso_code2_letter + * Gets address_format * - * @return string + * @return \PostFinanceCheckout\Sdk\Model\RestAddressFormat */ - public function getIsoCode2Letter() + public function getAddressFormat() { - return $this->container['iso_code2_letter']; + return $this->container['address_format']; } /** - * Sets iso_code2_letter + * Sets address_format * - * @param string $iso_code2_letter The country's two-letter code (ISO 3166-1 alpha-2 format). + * @param \PostFinanceCheckout\Sdk\Model\RestAddressFormat $address_format Specifies the country's way of formatting addresses. * * @return $this */ - public function setIsoCode2Letter($iso_code2_letter) + public function setAddressFormat($address_format) { - $this->container['iso_code2_letter'] = $iso_code2_letter; + $this->container['address_format'] = $address_format; return $this; } /** - * Gets iso_code3_letter + * Gets iso_code2 * * @return string */ - public function getIsoCode3Letter() + public function getIsoCode2() { - return $this->container['iso_code3_letter']; + return $this->container['iso_code2']; } /** - * Sets iso_code3_letter + * Sets iso_code2 * - * @param string $iso_code3_letter The country's three-letter code (ISO 3166-1 alpha-3 format). + * @param string $iso_code2 The country's two-letter code (ISO 3166-1 alpha-2 format). * * @return $this */ - public function setIsoCode3Letter($iso_code3_letter) + public function setIsoCode2($iso_code2) { - $this->container['iso_code3_letter'] = $iso_code3_letter; + $this->container['iso_code2'] = $iso_code2; return $this; } /** - * Gets address_format + * Gets iso_code3 * - * @return \PostFinanceCheckout\Sdk\Model\RestAddressFormat + * @return string */ - public function getAddressFormat() + public function getIsoCode3() { - return $this->container['address_format']; + return $this->container['iso_code3']; } /** - * Sets address_format + * Sets iso_code3 * - * @param \PostFinanceCheckout\Sdk\Model\RestAddressFormat $address_format Specifies the country's way of formatting addresses. + * @param string $iso_code3 The country's three-letter code (ISO 3166-1 alpha-3 format). * * @return $this */ - public function setAddressFormat($address_format) + public function setIsoCode3($iso_code3) { - $this->container['address_format'] = $address_format; + $this->container['iso_code3'] = $iso_code3; return $this; } diff --git a/lib/Model/WalletType.php b/lib/Model/WalletType.php index 7199c13..ccd6b55 100644 --- a/lib/Model/WalletType.php +++ b/lib/Model/WalletType.php @@ -19,6 +19,8 @@ namespace PostFinanceCheckout\Sdk\Model; + +use \ArrayAccess; use \PostFinanceCheckout\Sdk\ObjectSerializer; /** @@ -30,26 +32,334 @@ * @author customweb GmbH * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2 */ -class WalletType +class WalletType implements ModelInterface, ArrayAccess { + const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $swaggerModelName = 'WalletType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerTypes = [ + 'description' => 'map[string,string]', + 'id' => 'int', + 'name' => 'map[string,string]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'description' => null, + 'id' => 'int64', + 'name' => null + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'description' => 'description', + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'description' => 'setDescription', + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'description' => 'getDescription', + 'id' => 'getId', + 'name' => 'getName' + ]; + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + + $this->container['description'] = isset($data['description']) ? $data['description'] : null; + + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + + /** + * Gets description + * + * @return map[string,string] + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param map[string,string] $description The localized description of the object. + * + * @return $this + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + /** - * Possible values of this enum + * Sets id + * + * @param int $id A unique identifier for the object. + * + * @return $this */ - const APPLE_PAY = 'APPLE_PAY'; - const CLICK_TO_PAY = 'CLICK_TO_PAY'; - const NONE = 'NONE'; + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + /** - * Gets allowable values of the enum - * @return string[] + * Gets name + * + * @return map[string,string] */ - public static function getAllowableEnumValues() + public function getName() { - return [ - self::APPLE_PAY, - self::CLICK_TO_PAY, - self::NONE, - ]; + return $this->container['name']; + } + + /** + * Sets name + * + * @param map[string,string] $name The localized name of the object. + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/WebAppConfirmationRequest.php b/lib/Model/WebAppConfirmationRequest.php new file mode 100644 index 0000000..7b1c00f --- /dev/null +++ b/lib/Model/WebAppConfirmationRequest.php @@ -0,0 +1,310 @@ + 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'code' => null + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode' + ]; + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['code']) && (mb_strlen($this->container['code']) > 100)) { + $invalidProperties[] = "invalid value for 'code', the character length must be smaller than or equal to 100."; + } + + return $invalidProperties; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + + /** + * Gets code + * + * @return string + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code The user returns to the web app after granting the permission. The HTTP request contains the code. Provide it here to confirm the web app installation. + * + * @return $this + */ + public function setCode($code) + { + if (!is_null($code) && (mb_strlen($code) > 100)) { + throw new \InvalidArgumentException('invalid length for $code when calling WebAppConfirmationRequest., must be smaller than or equal to 100.'); + } + + $this->container['code'] = $code; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WebAppConfirmationResponse.php b/lib/Model/WebAppConfirmationResponse.php new file mode 100644 index 0000000..8b07a05 --- /dev/null +++ b/lib/Model/WebAppConfirmationResponse.php @@ -0,0 +1,430 @@ + 'string', + 'scope' => 'string', + 'space' => '\PostFinanceCheckout\Sdk\Model\Space', + 'state' => 'string', + 'token_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'access_token' => null, + 'scope' => null, + 'space' => null, + 'state' => null, + 'token_type' => null + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_token' => 'access_token', + 'scope' => 'scope', + 'space' => 'space', + 'state' => 'state', + 'token_type' => 'token_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_token' => 'setAccessToken', + 'scope' => 'setScope', + 'space' => 'setSpace', + 'state' => 'setState', + 'token_type' => 'setTokenType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_token' => 'getAccessToken', + 'scope' => 'getScope', + 'space' => 'getSpace', + 'state' => 'getState', + 'token_type' => 'getTokenType' + ]; + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + + $this->container['access_token'] = isset($data['access_token']) ? $data['access_token'] : null; + + $this->container['scope'] = isset($data['scope']) ? $data['scope'] : null; + + $this->container['space'] = isset($data['space']) ? $data['space'] : null; + + $this->container['state'] = isset($data['state']) ? $data['state'] : null; + + $this->container['token_type'] = isset($data['token_type']) ? $data['token_type'] : null; + + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + + /** + * Gets access_token + * + * @return string + */ + public function getAccessToken() + { + return $this->container['access_token']; + } + + /** + * Sets access_token + * + * @param string $access_token The access code grants permissions to the web service API according to the OAuth standard. + * + * @return $this + */ + public function setAccessToken($access_token) + { + $this->container['access_token'] = $access_token; + + return $this; + } + + + /** + * Gets scope + * + * @return string + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param string $scope The scope contains the permissions granted to the web app within the space. + * + * @return $this + */ + public function setScope($scope) + { + $this->container['scope'] = $scope; + + return $this; + } + + + /** + * Gets space + * + * @return \PostFinanceCheckout\Sdk\Model\Space + */ + public function getSpace() + { + return $this->container['space']; + } + + /** + * Sets space + * + * @param \PostFinanceCheckout\Sdk\Model\Space $space This is the space into which the web app is installed into. + * + * @return $this + */ + public function setSpace($space) + { + $this->container['space'] = $space; + + return $this; + } + + + /** + * Gets state + * + * @return string + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state The state contains the state parameter content provided when initiating the app installation. + * + * @return $this + */ + public function setState($state) + { + $this->container['state'] = $state; + + return $this; + } + + + /** + * Gets token_type + * + * @return string + */ + public function getTokenType() + { + return $this->container['token_type']; + } + + /** + * Sets token_type + * + * @param string $token_type The token type indicates the type of the access token. The type determines the authentication mechanism to use for accessing the web service API. + * + * @return $this + */ + public function setTokenType($token_type) + { + $this->container['token_type'] = $token_type; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WebhookEncryptionPublicKey.php b/lib/Model/WebhookEncryptionPublicKey.php new file mode 100644 index 0000000..097e765 --- /dev/null +++ b/lib/Model/WebhookEncryptionPublicKey.php @@ -0,0 +1,334 @@ + 'string', + 'public_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'public_key' => null + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'public_key' => 'publicKey' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'public_key' => 'setPublicKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'public_key' => 'getPublicKey' + ]; + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + + $this->container['public_key'] = isset($data['public_key']) ? $data['public_key'] : null; + + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The ID of encryption key + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + + /** + * Gets public_key + * + * @return string + */ + public function getPublicKey() + { + return $this->container['public_key']; + } + + /** + * Sets public_key + * + * @param string $public_key The BASE64 encoded public key + * + * @return $this + */ + public function setPublicKey($public_key) + { + $this->container['public_key'] = $public_key; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Service/TokenService.php b/lib/Service/TokenService.php index f28fd20..af25901 100644 --- a/lib/Service/TokenService.php +++ b/lib/Service/TokenService.php @@ -405,6 +405,119 @@ public function createWithHttpInfo($space_id, $entity) { } } + /** + * Operation createToken + * + * Create Token + * + * @param int $space_id (required) + * @param int $transaction_id The id of the transaction for which we want to create the token. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return \PostFinanceCheckout\Sdk\Model\Token + */ + public function createToken($space_id, $transaction_id) { + return $this->createTokenWithHttpInfo($space_id, $transaction_id)->getData(); + } + + /** + * Operation createTokenWithHttpInfo + * + * Create Token + + * + * @param int $space_id (required) + * @param int $transaction_id The id of the transaction for which we want to create the token. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return ApiResponse + */ + public function createTokenWithHttpInfo($space_id, $transaction_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 createToken'); + } + // verify the required parameter 'transaction_id' is set + if (is_null($transaction_id)) { + throw new \InvalidArgumentException('Missing the required parameter $transaction_id when calling createToken'); + } + // header params + $headerParams = []; + $headerAccept = $this->apiClient->selectHeaderAccept([]); + 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($transaction_id)) { + $queryParams['transactionId'] = $this->apiClient->getSerializer()->toQueryValue($transaction_id); + } + + // path params + $resourcePath = '/token/create-token'; + // 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, + 'POST', + $queryParams, + $httpBody, + $headerParams, + '\PostFinanceCheckout\Sdk\Model\Token', + '/token/create-token' + ); + return new ApiResponse($response->getStatusCode(), $response->getHeaders(), $this->apiClient->getSerializer()->deserialize($response->getData(), '\PostFinanceCheckout\Sdk\Model\Token', $response->getHeaders())); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PostFinanceCheckout\Sdk\Model\Token', + $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; + } + } + /** * Operation createTokenBasedOnTransaction * diff --git a/lib/Service/WebAppService.php b/lib/Service/WebAppService.php new file mode 100644 index 0000000..420765e --- /dev/null +++ b/lib/Service/WebAppService.php @@ -0,0 +1,375 @@ +apiClient = $apiClient; + } + + /** + * Returns the API client instance. + * + * @return ApiClient + */ + public function getApiClient() { + return $this->apiClient; + } + + + /** + * Operation checkInstallation + * + * Check Installation + * + * @param int $space_id This parameter identifies the space which should be checked if the web app is installed. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return bool + */ + public function checkInstallation($space_id) { + return $this->checkInstallationWithHttpInfo($space_id)->getData(); + } + + /** + * Operation checkInstallationWithHttpInfo + * + * Check Installation + + * + * @param int $space_id This parameter identifies the space which should be checked if the web app is installed. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return ApiResponse + */ + public function checkInstallationWithHttpInfo($space_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 checkInstallation'); + } + // header params + $headerParams = []; + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json;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); + } + + // path params + $resourcePath = '/web-app/check-installation'; + // 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, + 'bool', + '/web-app/check-installation' + ); + return new ApiResponse($response->getStatusCode(), $response->getHeaders(), $this->apiClient->getSerializer()->deserialize($response->getData(), 'bool', $response->getHeaders())); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'bool', + $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; + } + } + + /** + * Operation confirm + * + * Confirm + * + * @param \PostFinanceCheckout\Sdk\Model\WebAppConfirmationRequest $request (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return \PostFinanceCheckout\Sdk\Model\WebAppConfirmationResponse + */ + public function confirm($request) { + return $this->confirmWithHttpInfo($request)->getData(); + } + + /** + * Operation confirmWithHttpInfo + * + * Confirm + + * + * @param \PostFinanceCheckout\Sdk\Model\WebAppConfirmationRequest $request (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return ApiResponse + */ + public function confirmWithHttpInfo($request) { + // verify the required parameter 'request' is set + if (is_null($request)) { + throw new \InvalidArgumentException('Missing the required parameter $request when calling confirm'); + } + // header params + $headerParams = []; + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json;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 = []; + + // path params + $resourcePath = '/web-app/confirm'; + // default format to json + $resourcePath = str_replace('{format}', 'json', $resourcePath); + + // form params + $formParams = []; + // body params + $tempBody = null; + if (isset($request)) { + $tempBody = $request; + } + + // 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, + 'POST', + $queryParams, + $httpBody, + $headerParams, + '\PostFinanceCheckout\Sdk\Model\WebAppConfirmationResponse', + '/web-app/confirm' + ); + return new ApiResponse($response->getStatusCode(), $response->getHeaders(), $this->apiClient->getSerializer()->deserialize($response->getData(), '\PostFinanceCheckout\Sdk\Model\WebAppConfirmationResponse', $response->getHeaders())); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PostFinanceCheckout\Sdk\Model\WebAppConfirmationResponse', + $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; + } + } + + /** + * Operation uninstall + * + * Uninstall + * + * @param int $space_id This parameter identifies the space within which the web app should be uninstalled. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return void + */ + public function uninstall($space_id) { + return $this->uninstallWithHttpInfo($space_id)->getData(); + } + + /** + * Operation uninstallWithHttpInfo + * + * Uninstall + + * + * @param int $space_id This parameter identifies the space within which the web app should be uninstalled. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return ApiResponse + */ + public function uninstallWithHttpInfo($space_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 uninstall'); + } + // header params + $headerParams = []; + $headerAccept = $this->apiClient->selectHeaderAccept([]); + 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); + } + + // path params + $resourcePath = '/web-app/uninstall'; + // 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, + 'POST', + $queryParams, + $httpBody, + $headerParams, + null, + '/web-app/uninstall' + ); + return new ApiResponse($response->getStatusCode(), $response->getHeaders()); + } catch (ApiException $e) { + switch ($e->getCode()) { + 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/lib/Service/WebhookEncryptionService.php b/lib/Service/WebhookEncryptionService.php new file mode 100644 index 0000000..a56d069 --- /dev/null +++ b/lib/Service/WebhookEncryptionService.php @@ -0,0 +1,173 @@ +apiClient = $apiClient; + } + + /** + * Returns the API client instance. + * + * @return ApiClient + */ + public function getApiClient() { + return $this->apiClient; + } + + + /** + * Operation read + * + * Read + * + * @param string $id The ID of the key version. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return \PostFinanceCheckout\Sdk\Model\WebhookEncryptionPublicKey + */ + public function read($id) { + return $this->readWithHttpInfo($id)->getData(); + } + + /** + * Operation readWithHttpInfo + * + * Read + + * + * @param string $id The ID of the key version. (required) + * @throws \PostFinanceCheckout\Sdk\ApiException + * @throws \PostFinanceCheckout\Sdk\VersioningException + * @throws \PostFinanceCheckout\Sdk\Http\ConnectionException + * @return ApiResponse + */ + public function readWithHttpInfo($id) { + // verify the required parameter 'id' is set + if (is_null($id)) { + throw new \InvalidArgumentException('Missing the required parameter $id when calling read'); + } + // header params + $headerParams = []; + $headerAccept = $this->apiClient->selectHeaderAccept(['application/json;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($id)) { + $queryParams['id'] = $this->apiClient->getSerializer()->toQueryValue($id); + } + + // path params + $resourcePath = '/webhook-encryption/read'; + // 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, + '\PostFinanceCheckout\Sdk\Model\WebhookEncryptionPublicKey', + '/webhook-encryption/read' + ); + return new ApiResponse($response->getStatusCode(), $response->getHeaders(), $this->apiClient->getSerializer()->deserialize($response->getData(), '\PostFinanceCheckout\Sdk\Model\WebhookEncryptionPublicKey', $response->getHeaders())); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\PostFinanceCheckout\Sdk\Model\WebhookEncryptionPublicKey', + $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/ApiClientTest.php b/test/ApiClientTest.php index 93a89e9..bb924dd 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.0.0"); + $this->assertEquals($headers['x-meta-sdk-version'], "4.0.1"); $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());