From ffda648af41b0dc1bb3d3ecc8bfe9b794975f57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Tue, 29 Apr 2025 17:20:25 +0200 Subject: [PATCH 01/16] triv: fix composer validation errors --- .github/workflows/php.yml | 4 ++-- composer.json | 1 + composer.lock | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a65635c..5ee3dc5 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,9 +2,9 @@ name: PHP Composer on: push: - branches: [ "main" ] + branches: [ "main", "dev_tests" ] pull_request: - branches: [ "main" ] + branches: [ "main", "dev_tests" ] permissions: contents: read diff --git a/composer.json b/composer.json index a691db6..cee6524 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "tatrapayplus/tatrapayplus_api_client", "type": "library", + "description": "PHP SDK for Tatrapay+ payment gateway API", "license": "OSL-3.0", "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index c4a0a54..f2306c4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f6ed1174f112aa93925ffde741bbc2ab", + "content-hash": "80334d3ccc143b6306c0a2e9a86f4e74", "packages": [], "packages-dev": [], "aliases": [], @@ -14,5 +14,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.2.0" } From 7e7b8066e478b588e09946a9008887d9aa49f704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Wed, 30 Apr 2025 11:00:39 +0200 Subject: [PATCH 02/16] triv: fix composer validation errors --- composer.json | 3 +++ tests/tests.php | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/tests.php diff --git a/composer.json b/composer.json index cee6524..de6fb30 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,9 @@ "type": "library", "description": "PHP SDK for Tatrapay+ payment gateway API", "license": "OSL-3.0", + "scripts": { + "test": "phpunit tests/tests.php" + }, "autoload": { "psr-4": { "Tatrapayplus\\TatrapayplusApiClient\\" : "lib/" diff --git a/tests/tests.php b/tests/tests.php new file mode 100644 index 0000000..3f341d4 --- /dev/null +++ b/tests/tests.php @@ -0,0 +1,10 @@ + Date: Wed, 30 Apr 2025 11:58:44 +0200 Subject: [PATCH 03/16] triv: add basic api test --- .gitignore | 1 + composer.json | 2 +- lib/MagentoCurlClient.php | 2 +- tests/tests.php | 21 +++++++++++++++++++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0aa94fe..9186c28 100755 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ composer.phar # PHPUnit cache .phpunit.result.cache /logs/ +.idea \ No newline at end of file diff --git a/composer.json b/composer.json index de6fb30..13b3d5a 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "PHP SDK for Tatrapay+ payment gateway API", "license": "OSL-3.0", "scripts": { - "test": "phpunit tests/tests.php" + "test": "phpunit --bootstrap vendor/autoload.php tests/tests.php" }, "autoload": { "psr-4": { diff --git a/lib/MagentoCurlClient.php b/lib/MagentoCurlClient.php index 9c35a53..a63bbab 100644 --- a/lib/MagentoCurlClient.php +++ b/lib/MagentoCurlClient.php @@ -6,7 +6,7 @@ class MagentoCurlClient { public $logger; public function __construct( $logger, $scopeConfig ) { - if ( $scopeConfig->getValue('payment/tatrapayplus/enable_debug_log') == "1" ) { + if ( !is_null($scopeConfig) && $scopeConfig->getValue('payment/tatrapayplus/enable_debug_log') == "1" ) { $this->logger = $logger; } else { $this->logger = null; diff --git a/tests/tests.php b/tests/tests.php index 3f341d4..d130558 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -1,10 +1,27 @@ assertTrue(is_string($access_token)); + } + + public function testLimitLength(): void { - print('testing my custom test'); + $result = TatraPayPlusService::limit_length('asdqwe', 3); + $this->assertSame($result, 'asd'); } } \ No newline at end of file From bd13a02d1b07a8b28cb863e42a8a40f1c971bf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Wed, 30 Apr 2025 12:00:12 +0200 Subject: [PATCH 04/16] triv: refactor --- tests/tests.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tests.php b/tests/tests.php index d130558..77cde27 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -12,8 +12,8 @@ public function testRetrieveAccessToken(): void $client = new MagentoCurlClient(null, null); $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( $client, - 'l7ba7ffa0bf66b49b88d17dfe144955f54', - 'b88957109f344ab685a275a5fc9ab39e', + 'client_id', + 'client_secret', ); $this->assertTrue(is_string($access_token)); From 1eb93c45362a1c853c6a2885c1979093d5c2eaa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Wed, 30 Apr 2025 13:06:19 +0200 Subject: [PATCH 05/16] triv: use credentials from github secrets --- .github/workflows/php.yml | 4 ++++ tests/tests.php | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 5ee3dc5..24d5dc4 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,6 +14,10 @@ jobs: runs-on: ubuntu-latest + env: + TATRAPAY_CLIENT_ID: ${{ secrets.TATRAPAY_CLIENT_ID }} + TATRAPAY_CLIENT_SECRET: ${{ secrets.TATRAPAY_CLIENT_SECRET }} + steps: - uses: actions/checkout@v4 diff --git a/tests/tests.php b/tests/tests.php index 77cde27..3090447 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -7,13 +7,23 @@ final class Tests extends TestCase { + private function getApiCredentials() + { + $client_id = getenv('TATRAPAY_CLIENT_ID'); + $client_secret = getenv('TATRAPAY_CLIENT_SECRET'); + + return [$client_id, $client_secret]; + } + public function testRetrieveAccessToken(): void { + [$client_id, $client_secret] = $this->getApiCredentials(); + $client = new MagentoCurlClient(null, null); $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( $client, - 'client_id', - 'client_secret', + $client_id, + $client_secret, ); $this->assertTrue(is_string($access_token)); @@ -21,7 +31,7 @@ public function testRetrieveAccessToken(): void public function testLimitLength(): void { - $result = TatraPayPlusService::limit_length('asdqwe', 3); - $this->assertSame($result, 'asd'); + $result = TatraPayPlusService::limit_length('test123', 4); + $this->assertSame($result, 'test'); } } \ No newline at end of file From bdfe7b2a041a7e301aa7854e297f9cc4e4ab28fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Wed, 30 Apr 2025 14:56:33 +0200 Subject: [PATCH 06/16] triv: add tests for payment creation and status fetch --- tests/tests.php | 194 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 184 insertions(+), 10 deletions(-) diff --git a/tests/tests.php b/tests/tests.php index 3090447..5666b23 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -1,37 +1,211 @@ client_id = getenv('TATRAPAY_CLIENT_ID'); + $this->client_secret = getenv('TATRAPAY_CLIENT_SECRET'); + + } - return [$client_id, $client_secret]; + public function testLimitLength(): void + { + $result = TatraPayPlusService::limit_length('test123', 4); + $this->assertSame($result, 'test'); } public function testRetrieveAccessToken(): void { - [$client_id, $client_secret] = $this->getApiCredentials(); + $client = new MagentoCurlClient(null, null); + $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( + $client, + $this->client_id, + $this->client_secret, + ); + + $this->assertTrue(is_string($access_token)); + } + public function testGetAvailablePaymentMethods(): void + { $client = new MagentoCurlClient(null, null); $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( $client, - $client_id, - $client_secret, + $this->client_id, + $this->client_secret, ); + $this->assertTrue(is_string($access_token)); + + $available_methods = TatraPayPlusService::get_available_payment_methods( + $client, + $access_token, + TatraPayPlusService::SANDBOX, + ); + + $this->assertTrue(is_array($available_methods)); + $this->assertSame($available_methods['CARD_PAY']['supported_currencies'], ['EUR', 'USD']); + } + public function testIsCurrencySupportedForSpecificMethod(): void + { + $client = new MagentoCurlClient(null, null); + $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( + $client, + $this->client_id, + $this->client_secret, + ); $this->assertTrue(is_string($access_token)); + + $available_methods = TatraPayPlusService::get_available_payment_methods( + $client, + $access_token, + TatraPayPlusService::SANDBOX, + ); + $this->assertTrue(is_array($available_methods)); + + $test_cases = array( + // amount, currency, requested_methods, expected_result + array(10000, 'EUR', ['CARD_PAY'], true), + array(10, 'USD', ['QR_PAY'], false), + ); + + foreach ($test_cases as [$amount, $currency, $requested_methods, $expected_result]) { + $is_available = TatraPayPlusService::is_currency_supported_for_specific_methods( + $amount, + $currency, + $available_methods, + $requested_methods + ); + $this->assertSame($is_available, $expected_result); + } } + + private function getPaymentPayload($total, $currency) + { + $order_id = uniqid(); - public function testLimitLength(): void + $basePayment = new BasePayment( [ + 'instructed_amount' => new Amount( [ + 'amount_value' => $total, + 'currency' => $currency, + ] ), + 'end_to_end' => new E2e( [ + 'variable_symbol' => '123', + ] ), + ] ); + + $userData = new UserData( [ + 'first_name' => 'Janko', + 'last_name' => 'Hrasko', + 'email' => 'janko.hrasko@test.sk', + ] ); + + $bankTransfer = new BankTransfer(); + $billingAddress = new Address( [ + 'street_name' => 'TestStreet', + 'building_number' => '12', + 'town_name' => 'Town', + 'post_code' => '97405', + 'country' => 'SK', + ] ); + $shippingAddress = new Address( [ + 'street_name' => 'TestStreet', + 'building_number' => '12', + 'town_name' => 'Town', + 'post_code' => '97405', + 'country' => 'SK', + ] ); + $card_holder = 'Janko Hrasko'; + + $payLater = new PayLater( [ + 'order' => new Order( [ + 'order_no' => $order_id, + 'order_items' => array( + new OrderItem([ + 'quantity' => 1.0, + 'total_item_price' => $total, + 'item_detail' => new ItemDetail([ + 'item_detail_sk' => new ItemDetailLangUnit([ + 'item_name' => 'test product1', + ]), + ]), + ]) + ) + ] ), + ] ); + $cardDetail = new CardDetail( [ + 'card_holder' => $card_holder, + 'billing_address' => $billingAddress, + 'shipping_address' => $shippingAddress, + ] ); + + return new InitiatePaymentRequest( [ + 'base_payment' => $basePayment, + 'bank_transfer' => $bankTransfer, + 'user_data' => $userData, + 'card_detail' => $cardDetail, + 'pay_later' => $payLater, + ] ); + } + + public function testInitiatePaymentCheckPaymentStatus(): void { - $result = TatraPayPlusService::limit_length('test123', 4); - $this->assertSame($result, 'test'); + $client = new MagentoCurlClient(null, null); + $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( + $client, + $this->client_id, + $this->client_secret, + ); + $config = Configuration::getDefaultConfiguration( TatraPayPlusService::SANDBOX )->setAccessToken( $access_token ); + $apiInstance = new TatraPayPlusAPIApi( $config, $client ); + $accept_language = 'sk'; + $preferred_method = null; + + $initiate_payment_request = $this->getPaymentPayload(10, 'EUR'); + + $response = $apiInstance->initiatePayment( 'http://localhost', $initiate_payment_request, $preferred_method, $accept_language ); + + $this->assertFalse(is_null($response['object'])); + $this->assertFalse(is_null($response['response'])); + + $payment_id = $response['object']->getPaymentId(); + $this->assertFalse(is_null($payment_id)); + + $status = TatraPayPlusService::check_payment_status( + $client, + (string)$access_token, + $payment_id, + TatraPayPlusService::SANDBOX + ); + + $this->assertFalse(is_null($status['object'])); + $this->assertSame($status['response']->getStatusCode(), 200); + $this->assertSame($status['object']->getAuthorizationStatus(), PaymentIntentStatusResponse::AUTHORIZATION_STATUS__NEW); } } \ No newline at end of file From c9572ee1fb7e6a7d63670ac02921931d3213f6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Fri, 2 May 2025 17:24:53 +0200 Subject: [PATCH 07/16] feat: simplify using payment operations from outside --- lib/AccessToken.php | 31 ++++ lib/Api/TatraPayPlusAPIApi.php | 151 ++++++++++++++---- lib/CurlClient.php | 88 +++++++++++ lib/Model/CardDetail.php | 8 +- lib/Model/PaymentIntentStatusResponse.php | 70 +++++++- lib/Model/PaymentMethodRules.php | 31 ++++ lib/TatraPayPlusService.php | 69 -------- tests/tests.php | 184 ++++++++++++++-------- 8 files changed, 466 insertions(+), 166 deletions(-) create mode 100644 lib/AccessToken.php create mode 100644 lib/CurlClient.php diff --git a/lib/AccessToken.php b/lib/AccessToken.php new file mode 100644 index 0000000..e55dca9 --- /dev/null +++ b/lib/AccessToken.php @@ -0,0 +1,31 @@ +access_token = $access_token; + $this->expires_in = $expires_in + time(); + } + + public function getAccessToken(): string + { + return $this->access_token; + } + + public function isExpired(): bool + { + return $this->expires_in < time(); + } +} diff --git a/lib/Api/TatraPayPlusAPIApi.php b/lib/Api/TatraPayPlusAPIApi.php index b0da443..16ee1c4 100755 --- a/lib/Api/TatraPayPlusAPIApi.php +++ b/lib/Api/TatraPayPlusAPIApi.php @@ -2,6 +2,7 @@ namespace Tatrapayplus\TatrapayplusApiClient\Api; +use Tatrapayplus\TatrapayplusApiClient\AccessToken; use Tatrapayplus\TatrapayplusApiClient\ApiException; use Tatrapayplus\TatrapayplusApiClient\Configuration; use Tatrapayplus\TatrapayplusApiClient\HeaderSelector; @@ -12,6 +13,10 @@ class TatraPayPlusAPIApi { + public const PRODUCTION = 0; + public const SANDBOX = 1; + public const GRANT_TYPE = 'client_credentials'; + /** @var string[] * */ public const contentTypes = [ 'cancelPaymentIntent' => [ @@ -57,18 +62,49 @@ class TatraPayPlusAPIApi protected $hostIndex; /** - * @param object $client - * @param Configuration $config - * @param HeaderSelector $selector + * @var string + */ + private string $client_id; + + /** + * @var string + */ + private string $client_secret; + + /** + * @var string + */ + private string $scope; + + /** + * @var AccessToken */ + private ?AccessToken $access_token; + public function __construct( - Configuration $config, - ?object $client = null, - ?HeaderSelector $selector = null + string $client_id, + string $client_secret, + $client = null, + $mode = self::SANDBOX, + $scope = 'TATRAPAYPLUS' ) { - $this->config = $config; - $this->client = $client; - $this->headerSelector = $selector ?: new HeaderSelector(); + $this->client_id = $client_id; + $this->client_secret = $client_secret; + $this->scope = $scope; + $this->access_token = null; + + $this->headerSelector = new HeaderSelector(); + + // TODO toto este vymysliet ci sa posiela iba logger alebo cely klient + if (is_null($client)) { + $this->client = new \Tatrapayplus\TatrapayplusApiClient\CurlClient( + null, + false + ); + } else { + $this->client = $client; + } + $this->config = \Tatrapayplus\TatrapayplusApiClient\Configuration::getDefaultConfiguration($mode); } /** @@ -79,6 +115,24 @@ public function getConfig() return $this->config; } + public function addAuthHeader(array $headers): array + { + if (is_null($this->access_token) || $this->access_token->isExpired()) { + try { + $response = $this->token('client_credentials', $this->client_id, $this->client_secret, $this->scope); + $responseObj = $response['object']; + $this->access_token = new AccessToken($responseObj->getAccessToken(), (int) $responseObj->getExpiresIn()); + } catch (Exception $e) { + error_log($e->getMessage()); + // TODO daky error handling lepsi + return $headers; + } + } + + $headers['Authorization'] = 'Bearer ' . $this->access_token->getAccessToken(); + return $headers; + } + /** * Operation cancelPaymentIntent * @@ -127,9 +181,7 @@ public function cancelPaymentIntentRequest($payment_id) ); // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } + $headers = $this->addAuthHeader($headers); $defaultHeaders = $this->getDefaultHeaders(); @@ -213,6 +265,7 @@ public function processRequest($request, $target_structure, $error_structure) $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { + print_r($response->getBody()); throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri(), (string) $response->getBody()), $statusCode, $response->getHeaders(), (string) $response->getBody(), (string) $request); } @@ -260,6 +313,56 @@ public static function json_decode(...$args) return json_decode(...$args); } + public function getAvailableMethods( + $total_amount = null, + $currency = null, + $country = null + ) + { + $result = $this->getMethods(); + $available_methods = $result['object']; + + $available_methods_currencies = []; + foreach ($available_methods->getPaymentMethods() as $available_method) { + if ($available_method->getAmountRangeRule()) { + $amount_range_rule = [ + 'min_amount' => $available_method->getAmountRangeRule()->getMinAmount(), + 'max_amount' => $available_method->getAmountRangeRule()->getMaxAmount(), + ]; + } else { + $amount_range_rule = null; + } + + if ($total_amount && $amount_range_rule) { + if ($total_amount < $amount_range_rule['min_amount'] || $total_amount > $amount_range_rule['max_amount']) { + continue; + } + } + + $supported_currencies = $available_method->getSupportedCurrency(); + if ($currency && $supported_currencies) { + if (is_array($supported_currencies) && !in_array($currency, $supported_currencies)) { + continue; + } + } + + $supported_countries = $available_method->getSupportedCountry(); + if ($country && $supported_countries) { + if (is_array($supported_countries) && !in_array($country, $supported_countries)) { + continue; + } + } + + $available_methods_currencies[$available_method->getPaymentMethod()] = [ + 'supported_currencies' => $supported_currencies, + 'amount_range_rule' => $amount_range_rule, + 'supported_countries' => $supported_countries, + ]; + } + + return $available_methods_currencies; + } + /** * Operation getMethods * @@ -293,9 +396,7 @@ public function getMethodsRequest() false ); // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } + $headers = $this->addAuthHeader($headers); $defaultHeaders = $this->getDefaultHeaders(); @@ -368,9 +469,7 @@ public function getPaymentIntentStatusRequest($payment_id) ); // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } + $headers = $this->addAuthHeader($headers); $defaultHeaders = $this->getDefaultHeaders(); @@ -462,9 +561,7 @@ public function initiatePaymentRequest($redirect_uri, $initiate_payment_request, $httpBody = static::json_encode(ObjectSerializer::sanitizeForSerialization($initiate_payment_request)); $httpBody = str_replace('\\\\n', '\\n', $httpBody); // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } + $headers = $this->addAuthHeader($headers); $defaultHeaders = $this->getDefaultHeaders(); @@ -568,9 +665,7 @@ public function updatePaymentIntentRequest($payment_id, $body) $httpBody = static::json_encode(ObjectSerializer::sanitizeForSerialization($body)); // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } + $headers = $this->addAuthHeader($headers); $defaultHeaders = $this->getDefaultHeaders(); @@ -698,9 +793,7 @@ public function setAppearanceRequest($appearance_request) $httpBody = static::json_encode(ObjectSerializer::sanitizeForSerialization($appearance_request)); // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } + $headers = $this->addAuthHeader($headers); $defaultHeaders = $this->getDefaultHeaders(); @@ -763,9 +856,7 @@ public function setLogoRequest($appearance_logo_request) $httpBody = static::json_encode(ObjectSerializer::sanitizeForSerialization($appearance_logo_request)); // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } + $headers = $this->addAuthHeader($headers); $defaultHeaders = $this->getDefaultHeaders(); diff --git a/lib/CurlClient.php b/lib/CurlClient.php new file mode 100644 index 0000000..fd00028 --- /dev/null +++ b/lib/CurlClient.php @@ -0,0 +1,88 @@ +logger = $logger; + } else { + $this->logger = null; + } + } + + public function send( Request $request ) { + $ch = curl_init( $request->url ); + $headers = []; + + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); + curl_setopt( $ch, CURLOPT_HTTPHEADER, $this->convert_headers_to_curl_format( $request->headers ) ); + curl_setopt( + $ch, + CURLOPT_HEADERFUNCTION, + function ( $curl, $header ) use ( &$headers ) { + $len = strlen( $header ); + $header = explode( ':', $header, 2 ); + if ( count( $header ) < 2 ) { // ignore invalid headers + return $len; + } + + $headers[ strtolower( trim( $header[0] ) ) ][] = trim( $header[1] ); + + return $len; + } + ); + if ( $request->method === 'POST' ) { + curl_setopt( $ch, CURLOPT_POST, true ); + curl_setopt( $ch, CURLOPT_POSTFIELDS, $request->httpBody ); + } elseif ( $request->method === 'GET' ) { + curl_setopt( $ch, CURLOPT_HTTPGET, true ); + } elseif ( $request->method === 'DELETE' ) { + curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'DELETE' ); + } elseif ( $request->method === 'PATCH' ) { + curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PATCH' ); + curl_setopt( $ch, CURLOPT_POSTFIELDS, $request->httpBody ); + } else { + exit( 'Unsupported request type' ); + } + if ( $this->logger ) { + $this->logger->debug( 'Request: ' . (string) $request ); + } + + $response = curl_exec( $ch ); + + if ( $response === false ) { + $error = curl_error( $ch ); + curl_close( $ch ); + if ( $this->logger ) { + $this->logger->debug( 'Response error: ' . (string) $error ); + } + + return $error; + } + $http_status = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); + if ( $this->logger ) { + $this->logger->debug( 'Response success(status: ' . $http_status . '): ' . (string) $response ); + } + + curl_close( $ch ); + + return new HttpResponse( + $response, + $headers, + $http_status + ); + } + + public function convert_headers_to_curl_format( $headers ) { + $curlHeaders = []; + + foreach ( $headers as $key => $value ) { + $curlHeaders[] = "{$key}: {$value}"; + } + + return $curlHeaders; + } +} diff --git a/lib/Model/CardDetail.php b/lib/Model/CardDetail.php index 5798c67..aacf2f5 100755 --- a/lib/Model/CardDetail.php +++ b/lib/Model/CardDetail.php @@ -10,6 +10,7 @@ namespace Tatrapayplus\TatrapayplusApiClient\Model; use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusService; class CardDetail implements ModelInterface, \ArrayAccess { @@ -133,6 +134,10 @@ class CardDetail implements ModelInterface, \ArrayAccess */ public function __construct(?array $data = null) { + if ($data['card_holder']) { + $data['card_holder'] = TatraPayPlusService::remove_diacritics($data['card_holder']); + } + $this->setIfExists('card_pay_lang_override', $data ?? [], null); $this->setIfExists('is_pre_authorization', $data ?? [], null); $this->setIfExists('card_holder', $data ?? [], null); @@ -155,7 +160,6 @@ private function setIfExists(string $variableName, array $fields, $defaultValue) if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; } - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } @@ -408,6 +412,8 @@ public function getCardHolder() */ public function setCardHolder($card_holder) { + $card_holder = TatraPayPlusService::remove_diacritics($card_holder); + if (is_null($card_holder)) { throw new SanitizedInvalidArgumentException('non-nullable card_holder cannot be null'); } diff --git a/lib/Model/PaymentIntentStatusResponse.php b/lib/Model/PaymentIntentStatusResponse.php index 7078ce0..54e65ca 100755 --- a/lib/Model/PaymentIntentStatusResponse.php +++ b/lib/Model/PaymentIntentStatusResponse.php @@ -13,6 +13,29 @@ class PaymentIntentStatusResponse implements ModelInterface, \ArrayAccess { + public const SIMPLE_STATUS_ACCEPTED = 'ACCEPTED'; + public const SIMPLE_STATUS_PENDING = 'PENDING'; + public const SIMPLE_STATUS_REJECTED = 'REJECTED'; + + public const SIMPLE_STATUS_MAP = array( + PaymentMethod::PAY_LATER => array( + self::SIMPLE_STATUS_ACCEPTED => [PayLaterStatus::LOAN_APPLICATION_FINISHED, PayLaterStatus::LOAN_DISBURSED], + self::SIMPLE_STATUS_REJECTED => [PayLaterStatus::CANCELED, PayLaterStatus::EXPIRED], + ), + PaymentMethod::CARD_PAY => array( + self::SIMPLE_STATUS_ACCEPTED => [CardPayStatus::OK, CardPayStatus::CB], + self::SIMPLE_STATUS_REJECTED => [CardPayStatus::FAIL], + ), + PaymentMethod::BANK_TRANSFER => array( + self::SIMPLE_STATUS_ACCEPTED => [BankTransferStatus::ACCC, BankTransferStatus::ACSC], + self::SIMPLE_STATUS_REJECTED => [BankTransferStatus::CANC, BankTransferStatus::RJCT], + ), + PaymentMethod::QR_PAY => array( + self::SIMPLE_STATUS_ACCEPTED => [QRStatus::ACCC], + self::SIMPLE_STATUS_REJECTED => [QRStatus::EXPIRED], + ), + ); + public const DISCRIMINATOR = null; public const AUTHORIZATION_STATUS__NEW = 'NEW'; public const AUTHORIZATION_STATUS_PAY_METHOD_SELECTED = 'PAY_METHOD_SELECTED'; @@ -91,6 +114,7 @@ class PaymentIntentStatusResponse implements ModelInterface, \ArrayAccess 'selected_payment_method' => 'getSelectedPaymentMethod', 'authorization_status' => 'getAuthorizationStatus', 'status' => 'getStatus', + 'simple_status' => 'getSimpleStatus', ]; /** * If a nullable field gets set to null, insert it here @@ -364,21 +388,59 @@ public function setStatus($status) if (is_null($status)) { throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); } - if ($this->getSelectedPaymentMethod() == PaymentMethod::CARD_PAY) { + + $selected_method = $this->getSelectedPaymentMethod(); + + if ($selected_method == PaymentMethod::CARD_PAY) { $type = '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructure'; $value = ObjectSerializer::deserialize($status, $type, null); - } elseif ($this->getSelectedPaymentMethod() == PaymentMethod::BANK_TRANSFER) { + } elseif ($selected_method == PaymentMethod::BANK_TRANSFER) { $value = new BankTransferStatus(); $value->setStatus($status); - } elseif ($this->getSelectedPaymentMethod() == PaymentMethod::PAY_LATER) { + } elseif ($selected_method == PaymentMethod::PAY_LATER) { $value = new PayLaterStatus(); $value->setStatus($status); - } elseif ($this->getSelectedPaymentMethod() == PaymentMethod::QR_PAY) { + } elseif ($selected_method == PaymentMethod::QR_PAY) { $value = new QRStatus(); $value->setStatus($status); } $this->container['status'] = $value; + $this ->setSimpleStatus(self::SIMPLE_STATUS_PENDING); + foreach (self::SIMPLE_STATUS_MAP[$selected_method] as $simple_status => $gateway_statuses) { + if (in_array($status, $gateway_statuses)) { + $this->setSimpleStatus($simple_status); + break; + } + } + + return $this; + } + + /** + * Gets simple_status + * + * @return string + */ + public function getSimpleStatus() + { + return $this->container['simple_status'] ?? self::SIMPLE_STATUS_PENDING; + } + + /** + * Sets simple_status + * + * @param string|null $simple_status simple_status + * + * @return self + */ + public function setSimpleStatus($simple_status) + { + if (is_null($simple_status)) { + throw new SanitizedInvalidArgumentException('non-nullable simple_status cannot be null'); + } + $this->container['simple_status'] = $simple_status; + return $this; } diff --git a/lib/Model/PaymentMethodRules.php b/lib/Model/PaymentMethodRules.php index 80c9a96..36343bb 100755 --- a/lib/Model/PaymentMethodRules.php +++ b/lib/Model/PaymentMethodRules.php @@ -29,6 +29,7 @@ class PaymentMethodRules implements ModelInterface, \ArrayAccess 'paymentMethod' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod', 'amount_range_rule' => '\Tatrapayplus\TatrapayplusApiClient\Model\AmountRangeRule', 'supported_currency' => 'string[]', + 'supported_country' => 'string[]', 'allowed_bank_providers' => '\Tatrapayplus\TatrapayplusApiClient\Model\Provider[]', ]; @@ -45,6 +46,7 @@ class PaymentMethodRules implements ModelInterface, \ArrayAccess 'paymentMethod' => null, 'amount_range_rule' => null, 'supported_currency' => null, + 'supported_country' => null, 'allowed_bank_providers' => null, ]; @@ -57,6 +59,7 @@ class PaymentMethodRules implements ModelInterface, \ArrayAccess 'paymentMethod' => false, 'amount_range_rule' => false, 'supported_currency' => false, + 'supported_country' => true, 'allowed_bank_providers' => false, ]; /** @@ -69,6 +72,7 @@ class PaymentMethodRules implements ModelInterface, \ArrayAccess 'paymentMethod' => 'paymentMethod', 'amount_range_rule' => 'amountRangeRule', 'supported_currency' => 'supportedCurrency', + 'supported_country' => 'supportedCountry', 'allowed_bank_providers' => 'allowedBankProviders', ]; /** @@ -80,6 +84,7 @@ class PaymentMethodRules implements ModelInterface, \ArrayAccess 'paymentMethod' => 'setPaymentMethod', 'amount_range_rule' => 'setAmountRangeRule', 'supported_currency' => 'setSupportedCurrency', + 'supported_country' => 'setSupportedCountry', 'allowed_bank_providers' => 'setAllowedBankProviders', ]; /** @@ -91,6 +96,7 @@ class PaymentMethodRules implements ModelInterface, \ArrayAccess 'paymentMethod' => 'getPaymentMethod', 'amount_range_rule' => 'getAmountRangeRule', 'supported_currency' => 'getSupportedCurrency', + 'supported_country' => 'getSupportedCountry', 'allowed_bank_providers' => 'getAllowedBankProviders', ]; /** @@ -117,6 +123,7 @@ public function __construct(?array $data = null) $this->setIfExists('paymentMethod', $data ?? [], null); $this->setIfExists('amount_range_rule', $data ?? [], null); $this->setIfExists('supported_currency', $data ?? [], null); + $this->setIfExists('supported_country', $data ?? [], null); $this->setIfExists('allowed_bank_providers', $data ?? [], null); } @@ -351,6 +358,30 @@ public function setSupportedCurrency($supported_currency) return $this; } + /** + * Gets supported_country + * + * @return string[]|null + */ + public function getSupportedCountry() + { + return $this->container['supported_country']; + } + + /** + * Sets supported_country + * + * @param string[]|null $supported_country supported_country + * + * @return self + */ + public function setSupportedCountry($supported_country) + { + $this->container['supported_country'] = $supported_country; + + return $this; + } + /** * Gets allowed_bank_providers * diff --git a/lib/TatraPayPlusService.php b/lib/TatraPayPlusService.php index 53d219c..f348598 100644 --- a/lib/TatraPayPlusService.php +++ b/lib/TatraPayPlusService.php @@ -4,9 +4,6 @@ class TatraPayPlusService { - public const PRODUCTION = 0; - public const SANDBOX = 1; - public static function remove_diacritics($string) { $pattern = '/[^0-9a-zA-Z.@_ -]/'; @@ -32,72 +29,6 @@ public static function limit_length($string, $limit = 127) return $string === '' ? null : $string; } - public static function retrieve_access_token_with_credentials($client, $client_id, $client_secret, $mode = self::SANDBOX, $scopes = 'TATRAPAYPLUS') - { - $config = Configuration::getDefaultConfiguration($mode); - - $apiInstance = new Api\TatraPayPlusAPIApi($config, $client); - $grant_type = 'client_credentials'; - try { - $response = $apiInstance->token($grant_type, $client_id, $client_secret, $scopes); - $access_token = $response['object']->getAccessToken(); - } catch (Exception $e) { - return null; - } - - return $access_token; - } - - public static function get_available_payment_methods($client, $access_token, $mode) - { - $config = Configuration::getDefaultConfiguration($mode)->setAccessToken($access_token); - - $apiInstance = new Api\TatraPayPlusAPIApi($config, $client); - $result = $apiInstance->getMethods(); - $available_methods = $result['object']; - $available_methods_currencies = []; - foreach ($available_methods->getPaymentMethods() as $available_method) { - if ($available_method->getAmountRangeRule()) { - $amount_range_rule = [ - 'min_amount' => $available_method->getAmountRangeRule()->getMinAmount(), - 'max_amount' => $available_method->getAmountRangeRule()->getMaxAmount(), - ]; - } else { - $amount_range_rule = null; - } - - $available_methods_currencies[$available_method->getPaymentMethod()] = [ - 'supported_currencies' => $available_method->getSupportedCurrency(), - 'amount_range_rule' => $amount_range_rule, - ]; - } - - return $available_methods_currencies; - } - - public static function is_currency_supported_for_specific_methods( - $total_amount, - $currency, - $available_methods_currencies, - $specific_methods - ) { - foreach ($specific_methods as $method) { - if (array_key_exists($method, $available_methods_currencies)) { - $method_currencies = $available_methods_currencies[$method]['supported_currencies'] ?? []; - $amount_range = $available_methods_currencies[$method]['amount_range_rule'] ?? null; - if (in_array($currency, $method_currencies)) { - if ($amount_range == null) { - return true; - } else { - return $amount_range['min_amount'] <= $total_amount and $total_amount <= $amount_range['max_amount']; - } - } - } - } - - return false; - } - public static function get_icons_per_method() { $icons = [ diff --git a/tests/tests.php b/tests/tests.php index 5666b23..080e1f0 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -1,8 +1,13 @@ assertSame($result, 'test'); } - public function testRetrieveAccessToken(): void + public function testRemoveDiacritics(): void { - $client = new MagentoCurlClient(null, null); - $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( - $client, - $this->client_id, - $this->client_secret, - ); + $initiate_payment_request = $this->getPaymentPayload(10, 'EUR'); - $this->assertTrue(is_string($access_token)); + $this->assertSame($initiate_payment_request->getCardDetail()->getCardHolder(), 'Janko Hrasko'); } public function testGetAvailablePaymentMethods(): void { - $client = new MagentoCurlClient(null, null); - $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( - $client, + $api_instance = new TatraPayPlusAPIApi( $this->client_id, $this->client_secret, ); - $this->assertTrue(is_string($access_token)); - $available_methods = TatraPayPlusService::get_available_payment_methods( - $client, - $access_token, - TatraPayPlusService::SANDBOX, - ); + $available_methods = $api_instance->getAvailableMethods(); $this->assertTrue(is_array($available_methods)); $this->assertSame($available_methods['CARD_PAY']['supported_currencies'], ['EUR', 'USD']); } - public function testIsCurrencySupportedForSpecificMethod(): void + public function testGetAvailablePaymentMethodsConditional(): void { - $client = new MagentoCurlClient(null, null); - $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( - $client, - $this->client_id, - $this->client_secret, + $mocked_methods = array( + new PaymentMethodRules( + array( + "supported_currency" => ["EUR"], + "paymentMethod" => "TEST1", + "amount_range_rule" => new AmountRangeRule( + array( + "min_amount" => 1, + "max_amount" => 1000, + ) + ), + ), + ), + new PaymentMethodRules( + array( + "supported_currency" => ["EUR", "USD"], + "paymentMethod" => "TEST2", + ), + ), + new PaymentMethodRules( + array( + "supported_currency" => ["EUR"], + "supported_country" => ["SK", "CZ"], + "paymentMethod" => "TEST3", + ), + ), ); - $this->assertTrue(is_string($access_token)); - - $available_methods = TatraPayPlusService::get_available_payment_methods( - $client, - $access_token, - TatraPayPlusService::SANDBOX, + $mocked_result = new PaymentMethodsListResponse( + array( + 'payment_methods' => $mocked_methods + ) + ); + $parsed_response = array( + 'object' => $mocked_result, + 'response' => null ); - $this->assertTrue(is_array($available_methods)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['getMethods',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); + $api_instance->method('getMethods')->will($this->returnValue($parsed_response)); $test_cases = array( - // amount, currency, requested_methods, expected_result - array(10000, 'EUR', ['CARD_PAY'], true), - array(10, 'USD', ['QR_PAY'], false), + // amount, currency, country, expected_methods + array(100, 'EUR', null, ["TEST1", "TEST2", "TEST3"]), + array(10, 'USD', 'SK', ["TEST2"]), + array(1001, 'EUR', null, ["TEST2", "TEST3"]), + array(10, 'EUR', 'HUN', ["TEST1", "TEST2"]), ); - foreach ($test_cases as [$amount, $currency, $requested_methods, $expected_result]) { - $is_available = TatraPayPlusService::is_currency_supported_for_specific_methods( - $amount, - $currency, - $available_methods, - $requested_methods - ); - $this->assertSame($is_available, $expected_result); + foreach ($test_cases as [$amount, $currency, $country, $expected_methods]) { + $available_methods = $api_instance->getAvailableMethods($amount, $currency, $country); + + foreach ($expected_methods as $expected_method) { + $this->assertTrue(array_key_exists($expected_method, $available_methods)); + } } } - + private function getPaymentPayload($total, $currency) { $order_id = uniqid(); @@ -141,7 +159,7 @@ private function getPaymentPayload($total, $currency) 'post_code' => '97405', 'country' => 'SK', ] ); - $card_holder = 'Janko Hrasko'; + $card_holder = 'Janko Hraško'; $payLater = new PayLater( [ 'order' => new Order( [ @@ -176,20 +194,16 @@ private function getPaymentPayload($total, $currency) public function testInitiatePaymentCheckPaymentStatus(): void { - $client = new MagentoCurlClient(null, null); - $access_token = TatraPayPlusService::retrieve_access_token_with_credentials( - $client, - $this->client_id, - $this->client_secret, - ); - $config = Configuration::getDefaultConfiguration( TatraPayPlusService::SANDBOX )->setAccessToken( $access_token ); - $apiInstance = new TatraPayPlusAPIApi( $config, $client ); $accept_language = 'sk'; $preferred_method = null; - $initiate_payment_request = $this->getPaymentPayload(10, 'EUR'); - $response = $apiInstance->initiatePayment( 'http://localhost', $initiate_payment_request, $preferred_method, $accept_language ); + $api_instance = new TatraPayPlusAPIApi( + $this->client_id, + $this->client_secret, + ); + + $response = $api_instance->initiatePayment( 'http://localhost', $initiate_payment_request, $preferred_method, $accept_language ); $this->assertFalse(is_null($response['object'])); $this->assertFalse(is_null($response['response'])); @@ -197,15 +211,61 @@ public function testInitiatePaymentCheckPaymentStatus(): void $payment_id = $response['object']->getPaymentId(); $this->assertFalse(is_null($payment_id)); - $status = TatraPayPlusService::check_payment_status( - $client, - (string)$access_token, - $payment_id, - TatraPayPlusService::SANDBOX - ); + $status = $api_instance->getPaymentIntentStatus($payment_id); $this->assertFalse(is_null($status['object'])); $this->assertSame($status['response']->getStatusCode(), 200); $this->assertSame($status['object']->getAuthorizationStatus(), PaymentIntentStatusResponse::AUTHORIZATION_STATUS__NEW); + $this->assertSame($status['object']->getSimpleStatus(), PaymentIntentStatusResponse::SIMPLE_STATUS_PENDING); + } + + public function testCancelPaymentIntent(): void + { + $api_instance = new TatraPayPlusAPIApi( + $this->client_id, + $this->client_secret, + ); + $initiate_payment_request = $this->getPaymentPayload(10, 'EUR'); + + $response = $api_instance->initiatePayment('http://localhost', $initiate_payment_request); + + $this->assertFalse(is_null($response['object'])); + $this->assertFalse(is_null($response['response'])); + + $payment_id = $response['object']->getPaymentId(); + $this->assertFalse(is_null($payment_id)); + + $response = $api_instance->cancelPaymentIntent($payment_id); + $this->assertSame($response['response']->getStatusCode(), 200); } -} \ No newline at end of file + + public function testUpdatePaymentIntent(): void + { + $mock_response = new HttpResponse( + array(), + array(), + 201 + ); + + $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->setConstructorArgs([null, false])->getMock(); + $mock_client->method('send')->will($this->returnValue($mock_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret, $mock_client])->getMock(); + $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + + $data = new CardPayUpdateInstruction( [ + 'operation_type' =>CardPayUpdateInstruction::OPERATION_TYPE_CHARGEBACK, + 'amount' => 3.0, + ] ); + $response = $api_instance->updatePaymentIntent( 'TEST123', $data ); + + $this->assertSame($response['response']->getStatusCode(), 201); + } + + +} + +function mock_addAuthHeader($headers) +{ + return $headers; +} From 35cb2b1129517c4736fcd902ba8eb972efc1eaa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Mon, 5 May 2025 18:05:30 +0200 Subject: [PATCH 08/16] feat: finish test cases, add request retries, create new logger --- lib/Api/TatraPayPlusAPIApi.php | 134 +++++----- lib/ApiException.php | 18 +- lib/CurlClient.php | 28 +- lib/HttpResponse.php | 9 +- lib/Model/PaymentIntentStatusResponse.php | 8 +- lib/TatraPayPlusLogger.php | 108 ++++++++ tests/tests.php | 296 ++++++++++++++++------ 7 files changed, 439 insertions(+), 162 deletions(-) create mode 100644 lib/TatraPayPlusLogger.php diff --git a/lib/Api/TatraPayPlusAPIApi.php b/lib/Api/TatraPayPlusAPIApi.php index 16ee1c4..931be26 100755 --- a/lib/Api/TatraPayPlusAPIApi.php +++ b/lib/Api/TatraPayPlusAPIApi.php @@ -6,16 +6,20 @@ use Tatrapayplus\TatrapayplusApiClient\ApiException; use Tatrapayplus\TatrapayplusApiClient\Configuration; use Tatrapayplus\TatrapayplusApiClient\HeaderSelector; +use Tatrapayplus\TatrapayplusApiClient\HttpResponse; use Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod; use Tatrapayplus\TatrapayplusApiClient\Model\SanitizedInvalidArgumentException; use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; use Tatrapayplus\TatrapayplusApiClient\Request; +use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusLogger; class TatraPayPlusAPIApi { public const PRODUCTION = 0; public const SANDBOX = 1; public const GRANT_TYPE = 'client_credentials'; + public const RETRIES = 3; + public const RETRY_STATUSES = [500, 502, 503, 504]; /** @var string[] * */ public const contentTypes = [ @@ -48,6 +52,7 @@ class TatraPayPlusAPIApi * @var object */ protected $client; + protected $logger; /** * @var Configuration */ @@ -56,10 +61,6 @@ class TatraPayPlusAPIApi * @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ - protected $hostIndex; /** * @var string @@ -84,7 +85,7 @@ class TatraPayPlusAPIApi public function __construct( string $client_id, string $client_secret, - $client = null, + $logger = null, $mode = self::SANDBOX, $scope = 'TATRAPAYPLUS' ) { @@ -92,18 +93,10 @@ public function __construct( $this->client_secret = $client_secret; $this->scope = $scope; $this->access_token = null; + $this->logger = $logger; $this->headerSelector = new HeaderSelector(); - - // TODO toto este vymysliet ci sa posiela iba logger alebo cely klient - if (is_null($client)) { - $this->client = new \Tatrapayplus\TatrapayplusApiClient\CurlClient( - null, - false - ); - } else { - $this->client = $client; - } + $this->client = new \Tatrapayplus\TatrapayplusApiClient\CurlClient(); $this->config = \Tatrapayplus\TatrapayplusApiClient\Configuration::getDefaultConfiguration($mode); } @@ -115,6 +108,11 @@ public function getConfig() return $this->config; } + public function setClient($client) + { + $this->client = $client; + } + public function addAuthHeader(array $headers): array { if (is_null($this->access_token) || $this->access_token->isExpired()) { @@ -253,59 +251,72 @@ public static function uuid4() public function processRequest($request, $target_structure, $error_structure) { - try { + $attempts = 1; + do { try { - $response = $this->client->send($request); - } catch (RequestException $e) { - throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null); - } catch (ConnectException $e) { - throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null); + $response = $this->_processRequest($request, $target_structure); + $this->log($response['response']); + return $response; + } catch (ApiException $e) { + if (!$e->isRetry() || $attempts >= self::RETRIES) { + $error_obj = is_null($error_structure) ? null : ObjectSerializer::deserialize($e->getResponseBody(), $error_structure, $e->getResponseHeaders()); + $e->setResponseObject($error_obj); + throw $e; + } } - $statusCode = $response->getStatusCode(); + } while ($attempts++ < self::RETRIES); - if ($statusCode < 200 || $statusCode > 299) { - print_r($response->getBody()); - throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri(), (string) $response->getBody()), $statusCode, $response->getHeaders(), (string) $response->getBody(), (string) $request); - } + return null; + } - if (!is_null($target_structure)) { - $content = (string) $response->getBody(); - try { - $content = static::json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException(sprintf('Error JSON decoding server response (%s)', $request->getUri()), $statusCode, $response->getHeaders(), $content); - } - } + private function _processRequest($request, $target_structure) + { + try { + $response = $this->client->send($request); + } catch (RequestException $e) { + throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null); + } catch (ConnectException $e) { + throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), null, null); + } - switch ($statusCode) { - case 200: - case 201: - return [ - 'object' => is_null($target_structure) ? null : ObjectSerializer::deserialize($content, $target_structure, []), - 'response' => $response, - ]; - } + $statusCode = $response->getStatusCode(); - $content = $response->getBody(); + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf('[%d] Error connecting to the API (%s): %s', $statusCode, $request->getUri(), $response->getBody()), + $statusCode, + $response->getHeaders(), + (string) $response->getBody(), + (string) $request, + retry: in_array($statusCode, self::RETRY_STATUSES) + ); + } - return [ - 'object' => is_null($target_structure) ? null : ObjectSerializer::deserialize($content, $target_structure, []), - 'response' => $response, - ]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - $error_structure, - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; + if (!is_null($target_structure)) { + $content = (string) $response->getBody(); + try { + $content = static::json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException(sprintf('Error JSON decoding server response (%s)', $request->getUri()), $statusCode, $response->getHeaders(), $content); } - throw $e; } + + switch ($statusCode) { + case 200: + case 201: + return [ + 'object' => is_null($target_structure) ? null : ObjectSerializer::deserialize($content, $target_structure, []), + 'response' => $response, + ]; + } + + $content = $response->getBody(); + + return [ + 'object' => is_null($target_structure) ? null : ObjectSerializer::deserialize($content, $target_structure, []), + 'response' => $response, + ]; } public static function json_decode(...$args) @@ -874,4 +885,11 @@ public function setLogoRequest($appearance_logo_request) $httpBody ); } + + public function log(HttpResponse $response, array $additional_data = null): void + { + if (!is_null($this->logger)) { + $this->logger->log($response, $additional_data); + } + } } diff --git a/lib/ApiException.php b/lib/ApiException.php index 3d1c358..ba0c195 100755 --- a/lib/ApiException.php +++ b/lib/ApiException.php @@ -32,6 +32,13 @@ class ApiException extends \Exception protected $responseObject; protected $requestBody; + /** + * Should retry be attempted + * + * @var bool + */ + protected bool $retry; + /** * Constructor * @@ -39,13 +46,15 @@ class ApiException extends \Exception * @param int $code HTTP status code * @param string[]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string + * @param bool $retry Should retry be attempted */ - public function __construct($message = '', $code = 0, $responseHeaders = [], $responseBody = null, $requestBody = null) + public function __construct($message = '', $code = 0, $responseHeaders = [], $responseBody = null, $requestBody = null, $retry = false) { parent::__construct($message, $code); $this->responseHeaders = $responseHeaders; $this->responseBody = $responseBody; $this->requestBody = $requestBody; + $this->retry = $retry; } /** @@ -96,4 +105,11 @@ public function setResponseObject($obj) public function getRequestBody(): mixed { return $this->requestBody; } + + /** + * @return bool + */ + public function isRetry(): bool { + return $this->retry; + } } diff --git a/lib/CurlClient.php b/lib/CurlClient.php index fd00028..00472d3 100644 --- a/lib/CurlClient.php +++ b/lib/CurlClient.php @@ -3,16 +3,6 @@ namespace Tatrapayplus\TatrapayplusApiClient; class CurlClient { - public $logger; - - public function __construct( $logger, bool $enable_log ) { - if ( $enable_log ) { - $this->logger = $logger; - } else { - $this->logger = null; - } - } - public function send( Request $request ) { $ch = curl_init( $request->url ); $headers = []; @@ -47,32 +37,20 @@ function ( $curl, $header ) use ( &$headers ) { } else { exit( 'Unsupported request type' ); } - if ( $this->logger ) { - $this->logger->debug( 'Request: ' . (string) $request ); - } $response = curl_exec( $ch ); if ( $response === false ) { - $error = curl_error( $ch ); - curl_close( $ch ); - if ( $this->logger ) { - $this->logger->debug( 'Response error: ' . (string) $error ); - } - - return $error; + $response = curl_error( $ch ); } $http_status = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); - if ( $this->logger ) { - $this->logger->debug( 'Response success(status: ' . $http_status . '): ' . (string) $response ); - } - curl_close( $ch ); return new HttpResponse( $response, $headers, - $http_status + $http_status, + $request ); } diff --git a/lib/HttpResponse.php b/lib/HttpResponse.php index c0980e8..3584b6c 100644 --- a/lib/HttpResponse.php +++ b/lib/HttpResponse.php @@ -7,12 +7,14 @@ class HttpResponse private $body; private $headers; private $statusCode; + private $request; - public function __construct($body, $headers, $statusCode) + public function __construct($body, $headers, $statusCode, $request = null) { $this->body = $body; $this->headers = $headers; $this->statusCode = $statusCode; + $this->request = $request; } public function getBody() @@ -29,4 +31,9 @@ public function getStatusCode() { return $this->statusCode; } + + public function getRequest() + { + return $this->request; + } } diff --git a/lib/Model/PaymentIntentStatusResponse.php b/lib/Model/PaymentIntentStatusResponse.php index 54e65ca..d7eaa26 100755 --- a/lib/Model/PaymentIntentStatusResponse.php +++ b/lib/Model/PaymentIntentStatusResponse.php @@ -406,9 +406,15 @@ public function setStatus($status) } $this->container['status'] = $value; + if (is_string($status)) { + $status_to_map = $status; + } else { + $status_to_map = $value->getStatus(); + } + $this ->setSimpleStatus(self::SIMPLE_STATUS_PENDING); foreach (self::SIMPLE_STATUS_MAP[$selected_method] as $simple_status => $gateway_statuses) { - if (in_array($status, $gateway_statuses)) { + if (in_array($status_to_map, $gateway_statuses)) { $this->setSimpleStatus($simple_status); break; } diff --git a/lib/TatraPayPlusLogger.php b/lib/TatraPayPlusLogger.php new file mode 100644 index 0000000..fdca823 --- /dev/null +++ b/lib/TatraPayPlusLogger.php @@ -0,0 +1,108 @@ +mask_sensitive_data = $mask_sensitive_data; + } + + private function _mask_value($value, $max_chars = 5): string + { + if (!is_string($value) || strlen($value) < $max_chars * 2) { + return str_repeat("*", strlen($value)); + } + return substr($value, 0, $max_chars) . str_repeat("*", strlen($value) - $max_chars * 2) . substr($value, -$max_chars); + } + + private function _mask_header(array $header) + { + if (!$this->mask_sensitive_data) { + return $header; + } + + $masked_headers = []; + foreach ($header as $key => $value) { + if (in_array($key, $this->mask_header_fields, true)) { + $masked_headers[$key] = $this->_mask_value((string) $value); + } else { + $masked_headers[$key] = $value; + } + } + return $masked_headers; + } + + private function _mask_body($body) + { + if (!$this->mask_sensitive_data) { + return $body; + } + + if (is_string($body)) { + $pairs = []; + parse_str($body, $pairs); + $masked_pairs = []; + + foreach ($pairs as $key => $value) { + if (in_array($key, $this->mask_body_fields, true)) { + $masked_pairs[$key] = $this->_mask_value((string) $value); + } else { + $masked_pairs[$key] = $value; + } + } + return implode("&", $masked_pairs); + } + + if (is_array($body)) { + foreach ($this->mask_body_fields as $key) { + if (in_array($key, $body, true)) { + $body[$key] = $this->_mask_value((string) $body[$key]); + } + } + return $body; + } + + return (string) $body; + } + + public function log(HttpResponse $response, $additional_data): void + { + $date = gmdate('Y-m-d H:i:s'); + + $request = $response->getRequest(); + $request_data = $this->_mask_body($request->getBody()); + $headers = $this->_mask_header($request->getHeaders()); + + $this->writeLine(printf('INFO [%s] [INFO] Request:', $date)); + $this->writeLine(printf('Method: %s', $request->getMethod())); + $this->writeLine(printf('URL: %s', $request->getUrl())); + $this->writeLine('Headers:'); + $this->writeLine(print_r($headers, true)); + if ($request_data) { + $this->writeLine('Body:'); + $this->writeLine((string) $request_data); + } + + $this->writeLine(printf('INFO [%s] [INFO] Response status code: %s):', $date, $response->getStatusCode())); + + $response_body = $response->getBody(); + if (is_array($response_body)) { + $response_body = array_merge($response_body, $additional_data); + } + $response_body_masked = $this->_mask_body($response_body); + + $this->writeLine(print_r($response_body_masked, true)); + } + + public function writeLine(string $line): void + { + print $line; +// throw new Exception('writeLine not implemented'); + } +} diff --git a/tests/tests.php b/tests/tests.php index 080e1f0..16ec3f0 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -1,8 +1,12 @@ client_id = getenv('TATRAPAY_CLIENT_ID'); $this->client_secret = getenv('TATRAPAY_CLIENT_SECRET'); + } + + private function getPaymentPayload($total, $currency, bool $save_card = false): InitiatePaymentRequest + { + $order_id = uniqid(); + + $basePayment = new BasePayment( [ + 'instructed_amount' => new Amount( [ + 'amount_value' => $total, + 'currency' => $currency, + ] ), + 'end_to_end' => new E2e( [ + 'variable_symbol' => '123', + ] ), + ] ); + + $userData = new UserData( [ + 'first_name' => 'Janko', + 'last_name' => 'Hrasko', + 'email' => 'janko.hrasko@test.sk', + ] ); + + $bankTransfer = new BankTransfer(); + $billingAddress = new Address( [ + 'street_name' => 'TestStreet', + 'building_number' => '12', + 'town_name' => 'Town', + 'post_code' => '97405', + 'country' => 'SK', + ] ); + $shippingAddress = new Address( [ + 'street_name' => 'TestStreet', + 'building_number' => '12', + 'town_name' => 'Town', + 'post_code' => '97405', + 'country' => 'SK', + ] ); + $card_holder = 'Janko Hraško'; + + $payLater = new PayLater( [ + 'order' => new Order( [ + 'order_no' => $order_id, + 'order_items' => array( + new OrderItem([ + 'quantity' => 1.0, + 'total_item_price' => $total, + 'item_detail' => new ItemDetail([ + 'item_detail_sk' => new ItemDetailLangUnit([ + 'item_name' => 'test product1', + ]), + ]), + ]) + ) + ] ), + ] ); + $cardDetail = new CardDetail( [ + 'card_holder' => $card_holder, + 'billing_address' => $billingAddress, + 'shipping_address' => $shippingAddress, + ] ); + if ($save_card) { +// $public_key_content = file_get_contents( 'ECID_PUBLIC_KEY_2023.txt' ); +// $signed_card_id = TatraPayPlusService::generate_signed_card_id_from_cid('123', $public_key_content); +// $saved_card_data = new SignedCardIdObj( [ +// 'signed_card_id' => $signed_card_id, +// ] ); + $cardDetail->setComfortPay( new RegisterForComfortPayObj( [ + 'register_for_comfort_pay' => true, + ] )); + } + return new InitiatePaymentRequest( [ + 'base_payment' => $basePayment, + 'bank_transfer' => $bankTransfer, + 'user_data' => $userData, + 'card_detail' => $cardDetail, + 'pay_later' => $payLater, + ] ); } public function testLimitLength(): void @@ -124,74 +205,6 @@ public function testGetAvailablePaymentMethodsConditional(): void } } - private function getPaymentPayload($total, $currency) - { - $order_id = uniqid(); - - $basePayment = new BasePayment( [ - 'instructed_amount' => new Amount( [ - 'amount_value' => $total, - 'currency' => $currency, - ] ), - 'end_to_end' => new E2e( [ - 'variable_symbol' => '123', - ] ), - ] ); - - $userData = new UserData( [ - 'first_name' => 'Janko', - 'last_name' => 'Hrasko', - 'email' => 'janko.hrasko@test.sk', - ] ); - - $bankTransfer = new BankTransfer(); - $billingAddress = new Address( [ - 'street_name' => 'TestStreet', - 'building_number' => '12', - 'town_name' => 'Town', - 'post_code' => '97405', - 'country' => 'SK', - ] ); - $shippingAddress = new Address( [ - 'street_name' => 'TestStreet', - 'building_number' => '12', - 'town_name' => 'Town', - 'post_code' => '97405', - 'country' => 'SK', - ] ); - $card_holder = 'Janko Hraško'; - - $payLater = new PayLater( [ - 'order' => new Order( [ - 'order_no' => $order_id, - 'order_items' => array( - new OrderItem([ - 'quantity' => 1.0, - 'total_item_price' => $total, - 'item_detail' => new ItemDetail([ - 'item_detail_sk' => new ItemDetailLangUnit([ - 'item_name' => 'test product1', - ]), - ]), - ]) - ) - ] ), - ] ); - $cardDetail = new CardDetail( [ - 'card_holder' => $card_holder, - 'billing_address' => $billingAddress, - 'shipping_address' => $shippingAddress, - ] ); - - return new InitiatePaymentRequest( [ - 'base_payment' => $basePayment, - 'bank_transfer' => $bankTransfer, - 'user_data' => $userData, - 'card_detail' => $cardDetail, - 'pay_later' => $payLater, - ] ); - } - public function testInitiatePaymentCheckPaymentStatus(): void { $accept_language = 'sk'; @@ -211,12 +224,12 @@ public function testInitiatePaymentCheckPaymentStatus(): void $payment_id = $response['object']->getPaymentId(); $this->assertFalse(is_null($payment_id)); - $status = $api_instance->getPaymentIntentStatus($payment_id); + $response = $api_instance->getPaymentIntentStatus($payment_id); - $this->assertFalse(is_null($status['object'])); - $this->assertSame($status['response']->getStatusCode(), 200); - $this->assertSame($status['object']->getAuthorizationStatus(), PaymentIntentStatusResponse::AUTHORIZATION_STATUS__NEW); - $this->assertSame($status['object']->getSimpleStatus(), PaymentIntentStatusResponse::SIMPLE_STATUS_PENDING); + $this->assertFalse(is_null($response['object'])); + $this->assertSame($response['response']->getStatusCode(), 200); + $this->assertSame($response['object']->getAuthorizationStatus(), PaymentIntentStatusResponse::AUTHORIZATION_STATUS__NEW); + $this->assertSame($response['object']->getSimpleStatus(), PaymentIntentStatusResponse::SIMPLE_STATUS_PENDING); } public function testCancelPaymentIntent(): void @@ -247,11 +260,12 @@ public function testUpdatePaymentIntent(): void 201 ); - $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->setConstructorArgs([null, false])->getMock(); + $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); $mock_client->method('send')->will($this->returnValue($mock_response)); - $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret, $mock_client])->getMock(); + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + $api_instance->setClient($mock_client); $data = new CardPayUpdateInstruction( [ 'operation_type' =>CardPayUpdateInstruction::OPERATION_TYPE_CHARGEBACK, @@ -262,7 +276,137 @@ public function testUpdatePaymentIntent(): void $this->assertSame($response['response']->getStatusCode(), 201); } + public function testSavedCard(): void + { + $api_instance = new TatraPayPlusAPIApi( + $this->client_id, + $this->client_secret, + ); + $initiate_payment_request = $this->getPaymentPayload(10, 'EUR', true); + + $response = $api_instance->initiatePayment('http://localhost', $initiate_payment_request); + + $this->assertFalse(is_null($response['object'])); + $this->assertFalse(is_null($response['response'])); + + $payment_id = $response['object']->getPaymentId(); + $this->assertFalse(is_null($payment_id)); + } + + public function testSavedCardResponseMocked(): void + { + $mocked_status = json_encode(array( + "selectedPaymentMethod" => "CARD_PAY", + "authorizationStatus" => "AUTH_DONE", + "status" => array( + "status" => "OK", + "currency" => "EUR", + "maskedCardNumber" => "440577******5558", + "comfortPay" => array("cid" => "123", "status" => "OK"), + ) + )); + $mock_response = new HttpResponse( + $mocked_status, + array(), + 201 + ); + + $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); + $mock_client->method('send')->will($this->returnValue($mock_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); + $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + $api_instance->setClient($mock_client); + + $response = $api_instance->getPaymentIntentStatus( '12345' ); + + $this->assertFalse(is_null($response['object'])); + $this->assertSame($response['response']->getStatusCode(), 201); + $this->assertSame($response['object']->getSimpleStatus(), PaymentIntentStatusResponse::SIMPLE_STATUS_ACCEPTED); + $status_obj = $response['object']->getStatus(); + $this->assertSame($status_obj->getComfortPay()->getCid(), '123'); + $this->assertSame($status_obj->getMaskedCardNumber(), '440577******5558'); + } + + public function testSetAppearance(): void + { + $appearance_request = new AppearanceRequest( + array( + 'theme' => AppearanceRequest::THEME_SYSTEM, + 'tint_on_accent' => new ColorAttribute( [ + 'color_dark_mode' => '#fff', + 'color_light_mode' => '#fff', + ] ), + 'tint_accent' => new ColorAttribute( [ + 'color_dark_mode' => '#fff', + 'color_light_mode' => '#fff', + ] ), + 'surface_accent' => new ColorAttribute( [ + 'color_dark_mode' => '#fff', + 'color_light_mode' => '#fff', + ] ), + ) + ); + $api_instance = new TatraPayPlusAPIApi( + $this->client_id, + $this->client_secret, + ); + + $response = $api_instance->setAppearance($appearance_request); + $this->assertSame($response['response']->getStatusCode(), 201); + } + public function testSetLogoMocked(): void + { + $mock_response = new HttpResponse( + array(), + array(), + 201 + ); + + $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); + $mock_client->method('send')->will($this->returnValue($mock_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); + $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + $api_instance->setClient($mock_client); + + $logo_request = new AppearanceLogoRequest( + array( + 'logo_image' => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII" + ) + ); + $response = $api_instance->setLogo($logo_request); + $this->assertSame($response['response']->getStatusCode(), 201); + } + + public function testRetry(): void + { + $send_count = TatraPayPlusAPIApi::RETRIES; + $mock_error_body = json_encode(array('error' => 'testError1')); + $mock_error_response = new HttpResponse( + $mock_error_body, + array(), + 500 + ); + + $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); + $mock_client->expects($this->exactly($send_count))->method('send')->will($this->returnValue($mock_error_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); + $api_instance->setClient($mock_client); + $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + + $error_thrown = false; + try { + $api_instance->getAvailableMethods(); + } catch (ApiException $e) { + $error_thrown = true; + $this->assertSame(500, $e->getCode()); + $this->assertSame($mock_error_body, $e->getResponseBody()); + } + $this->assertTrue($error_thrown); + } } function mock_addAuthHeader($headers) From 9cf6052af928f4db2f6c1819dd8fbc0c4b28276f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Tue, 6 May 2025 12:33:45 +0200 Subject: [PATCH 09/16] fix: fix logger errors, add cid test --- lib/Api/TatraPayPlusAPIApi.php | 31 ++++++++++++++++-------------- lib/Request.php | 15 +++++++++++++++ lib/TatraPayPlusLogger.php | 35 ++++++++++++++++++++++------------ tests/ECID_PUBLIC_KEY_2023.txt | 6 ++++++ tests/tests.php | 14 ++++++++------ 5 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 tests/ECID_PUBLIC_KEY_2023.txt diff --git a/lib/Api/TatraPayPlusAPIApi.php b/lib/Api/TatraPayPlusAPIApi.php index 931be26..7f44618 100755 --- a/lib/Api/TatraPayPlusAPIApi.php +++ b/lib/Api/TatraPayPlusAPIApi.php @@ -11,7 +11,7 @@ use Tatrapayplus\TatrapayplusApiClient\Model\SanitizedInvalidArgumentException; use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; use Tatrapayplus\TatrapayplusApiClient\Request; -use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusLogger; +use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusService; class TatraPayPlusAPIApi { @@ -87,7 +87,8 @@ public function __construct( string $client_secret, $logger = null, $mode = self::SANDBOX, - $scope = 'TATRAPAYPLUS' + $scope = 'TATRAPAYPLUS', + $client = null ) { $this->client_id = $client_id; $this->client_secret = $client_secret; @@ -96,7 +97,11 @@ public function __construct( $this->logger = $logger; $this->headerSelector = new HeaderSelector(); - $this->client = new \Tatrapayplus\TatrapayplusApiClient\CurlClient(); + if (is_null($client)) { + $this->client = new \Tatrapayplus\TatrapayplusApiClient\CurlClient(); + } else { + $this->client = $client; + } $this->config = \Tatrapayplus\TatrapayplusApiClient\Configuration::getDefaultConfiguration($mode); } @@ -116,15 +121,9 @@ public function setClient($client) public function addAuthHeader(array $headers): array { if (is_null($this->access_token) || $this->access_token->isExpired()) { - try { - $response = $this->token('client_credentials', $this->client_id, $this->client_secret, $this->scope); - $responseObj = $response['object']; - $this->access_token = new AccessToken($responseObj->getAccessToken(), (int) $responseObj->getExpiresIn()); - } catch (Exception $e) { - error_log($e->getMessage()); - // TODO daky error handling lepsi - return $headers; - } + $response = $this->token('client_credentials', $this->client_id, $this->client_secret, $this->scope); + $responseObj = $response['object']; + $this->access_token = new AccessToken($responseObj->getAccessToken(), (int) $responseObj->getExpiresIn()); } $headers['Authorization'] = 'Bearer ' . $this->access_token->getAccessToken(); @@ -209,8 +208,7 @@ public function getDefaultHeaders() if (function_exists('sanitize_text_field')) { $remote_addr = sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])); } else { - // This line won't be used by WP. - $remote_addr = $_SERVER['REMOTE_ADDR']; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + $remote_addr = $_SERVER['REMOTE_ADDR']; } } else { $remote_addr = '127.0.0.1'; @@ -886,6 +884,11 @@ public function setLogoRequest($appearance_logo_request) ); } + public static function generateSignedCardId($cid, $public_key_content) + { + return TatraPayPlusService::generate_signed_card_id_from_cid($cid, $public_key_content); + } + public function log(HttpResponse $response, array $additional_data = null): void { if (!is_null($this->logger)) { diff --git a/lib/Request.php b/lib/Request.php index ac22283..fc604a5 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -22,6 +22,21 @@ public function getUri() return $this->url; } + public function getBody() + { + return $this->httpBody; + } + + public function getHeaders() + { + return $this->headers; + } + + public function getMethod() + { + return $this->method; + } + public function __toString() { $headersString = ''; diff --git a/lib/TatraPayPlusLogger.php b/lib/TatraPayPlusLogger.php index fdca823..959f9d2 100644 --- a/lib/TatraPayPlusLogger.php +++ b/lib/TatraPayPlusLogger.php @@ -24,7 +24,7 @@ private function _mask_value($value, $max_chars = 5): string private function _mask_header(array $header) { if (!$this->mask_sensitive_data) { - return $header; + return json_encode($header, JSON_PRETTY_PRINT); } $masked_headers = []; @@ -35,15 +35,25 @@ private function _mask_header(array $header) $masked_headers[$key] = $value; } } - return $masked_headers; + return json_encode($masked_headers, JSON_PRETTY_PRINT); } private function _mask_body($body) { + if (empty($body)) { + return "No body"; + } + if (!$this->mask_sensitive_data) { return $body; } + if (is_string($body)) { + try { + $body = json_decode($body, true); + } catch (\Exception $e) {} + } + if (is_string($body)) { $pairs = []; parse_str($body, $pairs); @@ -51,9 +61,10 @@ private function _mask_body($body) foreach ($pairs as $key => $value) { if (in_array($key, $this->mask_body_fields, true)) { - $masked_pairs[$key] = $this->_mask_value((string) $value); + $masked_pairs[] = $key . '=' . $this->_mask_value((string) $value); } else { - $masked_pairs[$key] = $value; + print $value; + $masked_pairs[] = $key . '=' . $value; } } return implode("&", $masked_pairs); @@ -61,11 +72,11 @@ private function _mask_body($body) if (is_array($body)) { foreach ($this->mask_body_fields as $key) { - if (in_array($key, $body, true)) { + if (array_key_exists($key, $body)) { $body[$key] = $this->_mask_value((string) $body[$key]); } } - return $body; + return json_encode($body, JSON_PRETTY_PRINT); } return (string) $body; @@ -79,9 +90,9 @@ public function log(HttpResponse $response, $additional_data): void $request_data = $this->_mask_body($request->getBody()); $headers = $this->_mask_header($request->getHeaders()); - $this->writeLine(printf('INFO [%s] [INFO] Request:', $date)); - $this->writeLine(printf('Method: %s', $request->getMethod())); - $this->writeLine(printf('URL: %s', $request->getUrl())); + $this->writeLine(sprintf('INFO [%s] [INFO] Request:', $date)); + $this->writeLine(sprintf('Method: %s', $request->getMethod())); + $this->writeLine(sprintf('URL: %s', $request->getUri())); $this->writeLine('Headers:'); $this->writeLine(print_r($headers, true)); if ($request_data) { @@ -89,7 +100,7 @@ public function log(HttpResponse $response, $additional_data): void $this->writeLine((string) $request_data); } - $this->writeLine(printf('INFO [%s] [INFO] Response status code: %s):', $date, $response->getStatusCode())); + $this->writeLine(sprintf('INFO [%s] [INFO] Response (status code: %s):', $date, $response->getStatusCode())); $response_body = $response->getBody(); if (is_array($response_body)) { @@ -102,7 +113,7 @@ public function log(HttpResponse $response, $additional_data): void public function writeLine(string $line): void { - print $line; -// throw new Exception('writeLine not implemented'); + print $line . "\n"; +// throw new Exception('TatraPayPlusLogger subclass must implement write_line()'); } } diff --git a/tests/ECID_PUBLIC_KEY_2023.txt b/tests/ECID_PUBLIC_KEY_2023.txt new file mode 100644 index 0000000..6085a36 --- /dev/null +++ b/tests/ECID_PUBLIC_KEY_2023.txt @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcGk6cYrtjOHOjP8KHJ5YPO9t0 +lXkR38dfkPbSkG5o873AKQqLiDC3JmMGPkm8gO79M4wWBas7DWo0NWM2Y+rT+zu4 +4w+/xHcwDl8K/LmVmDaBkV/irWfmAreDPVJTVt1t4nPK/nhPh+B3LHY1THhfXujV +sMWycfPgHB0nY7wcxQIDAQAB +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/tests/tests.php b/tests/tests.php index 16ec3f0..36799f6 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -42,7 +42,7 @@ public function __construct() $this->client_secret = getenv('TATRAPAY_CLIENT_SECRET'); } - private function getPaymentPayload($total, $currency, bool $save_card = false): InitiatePaymentRequest + private function getPaymentPayload(float $total, string $currency, bool $save_card = false): InitiatePaymentRequest { $order_id = uniqid(); @@ -101,11 +101,6 @@ private function getPaymentPayload($total, $currency, bool $save_card = false): 'shipping_address' => $shippingAddress, ] ); if ($save_card) { -// $public_key_content = file_get_contents( 'ECID_PUBLIC_KEY_2023.txt' ); -// $signed_card_id = TatraPayPlusService::generate_signed_card_id_from_cid('123', $public_key_content); -// $saved_card_data = new SignedCardIdObj( [ -// 'signed_card_id' => $signed_card_id, -// ] ); $cardDetail->setComfortPay( new RegisterForComfortPayObj( [ 'register_for_comfort_pay' => true, ] )); @@ -120,6 +115,13 @@ private function getPaymentPayload($total, $currency, bool $save_card = false): ] ); } + public function testGenerateSignedCardId(): void + { + $public_key_content = file_get_contents( dirname(dirname(__FILE__)) . '/tests/ECID_PUBLIC_KEY_2023.txt' ); + $signed_card_id = TatraPayPlusAPIApi::generateSignedCardId('123', $public_key_content); + $this->assertTrue(is_string($signed_card_id)); + } + public function testLimitLength(): void { $result = TatraPayPlusService::limit_length('test123', 4); From 3d6a9b9ea3d77518f5dc1aefa086a7735e042cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Tue, 6 May 2025 12:58:34 +0200 Subject: [PATCH 10/16] triv: reformat --- lib/Api/TatraPayPlusAPIApi.php | 24 +- lib/CurlClient.php | 81 ++-- lib/Model/PaymentIntentStatusResponse.php | 5 +- lib/TatraPayPlusLogger.php | 47 +- tests/tests.php | 537 ++++++++++++---------- 5 files changed, 382 insertions(+), 312 deletions(-) diff --git a/lib/Api/TatraPayPlusAPIApi.php b/lib/Api/TatraPayPlusAPIApi.php index 7f44618..68d8f50 100755 --- a/lib/Api/TatraPayPlusAPIApi.php +++ b/lib/Api/TatraPayPlusAPIApi.php @@ -52,6 +52,10 @@ class TatraPayPlusAPIApi * @var object */ protected $client; + + /** + * @var object + */ protected $logger; /** * @var Configuration @@ -85,10 +89,10 @@ class TatraPayPlusAPIApi public function __construct( string $client_id, string $client_secret, - $logger = null, - $mode = self::SANDBOX, - $scope = 'TATRAPAYPLUS', - $client = null + object|null $logger = null, + int $mode = self::SANDBOX, + string $scope = 'TATRAPAYPLUS', + object|null $client = null ) { $this->client_id = $client_id; $this->client_secret = $client_secret; @@ -113,7 +117,7 @@ public function getConfig() return $this->config; } - public function setClient($client) + public function setClient(object|null $client): void { $this->client = $client; } @@ -323,10 +327,10 @@ public static function json_decode(...$args) } public function getAvailableMethods( - $total_amount = null, - $currency = null, - $country = null - ) + float|null $total_amount = null, + string|null $currency = null, + string|null $country = null + ): array { $result = $this->getMethods(); $available_methods = $result['object']; @@ -884,7 +888,7 @@ public function setLogoRequest($appearance_logo_request) ); } - public static function generateSignedCardId($cid, $public_key_content) + public static function generateSignedCardId(string $cid, string $public_key_content): string { return TatraPayPlusService::generate_signed_card_id_from_cid($cid, $public_key_content); } diff --git a/lib/CurlClient.php b/lib/CurlClient.php index 00472d3..ce749a6 100644 --- a/lib/CurlClient.php +++ b/lib/CurlClient.php @@ -2,62 +2,63 @@ namespace Tatrapayplus\TatrapayplusApiClient; -class CurlClient { - public function send( Request $request ) { - $ch = curl_init( $request->url ); +class CurlClient +{ + public function send(Request $request): HttpResponse + { + $ch = curl_init($request->url); $headers = []; - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); - curl_setopt( $ch, CURLOPT_HTTPHEADER, $this->convert_headers_to_curl_format( $request->headers ) ); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( $ch, - CURLOPT_HEADERFUNCTION, - function ( $curl, $header ) use ( &$headers ) { - $len = strlen( $header ); - $header = explode( ':', $header, 2 ); - if ( count( $header ) < 2 ) { // ignore invalid headers - return $len; - } - - $headers[ strtolower( trim( $header[0] ) ) ][] = trim( $header[1] ); - + CURLOPT_HTTPHEADER, + $this->convert_headers_to_curl_format($request->headers) + ); + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use ( + &$headers + ) { + $len = strlen($header); + $header = explode(":", $header, 2); + if (count($header) < 2) { + // ignore invalid headers return $len; } - ); - if ( $request->method === 'POST' ) { - curl_setopt( $ch, CURLOPT_POST, true ); - curl_setopt( $ch, CURLOPT_POSTFIELDS, $request->httpBody ); - } elseif ( $request->method === 'GET' ) { - curl_setopt( $ch, CURLOPT_HTTPGET, true ); - } elseif ( $request->method === 'DELETE' ) { - curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'DELETE' ); - } elseif ( $request->method === 'PATCH' ) { - curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PATCH' ); - curl_setopt( $ch, CURLOPT_POSTFIELDS, $request->httpBody ); + + $headers[strtolower(trim($header[0]))][] = trim($header[1]); + + return $len; + }); + if ($request->method === "POST") { + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $request->httpBody); + } elseif ($request->method === "GET") { + curl_setopt($ch, CURLOPT_HTTPGET, true); + } elseif ($request->method === "DELETE") { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); + } elseif ($request->method === "PATCH") { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH"); + curl_setopt($ch, CURLOPT_POSTFIELDS, $request->httpBody); } else { - exit( 'Unsupported request type' ); + exit("Unsupported request type"); } - $response = curl_exec( $ch ); + $response = curl_exec($ch); - if ( $response === false ) { - $response = curl_error( $ch ); + if ($response === false) { + $response = curl_error($ch); } - $http_status = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); - curl_close( $ch ); + $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); - return new HttpResponse( - $response, - $headers, - $http_status, - $request - ); + return new HttpResponse($response, $headers, $http_status, $request); } - public function convert_headers_to_curl_format( $headers ) { + public function convert_headers_to_curl_format(array $headers): array + { $curlHeaders = []; - foreach ( $headers as $key => $value ) { + foreach ($headers as $key => $value) { $curlHeaders[] = "{$key}: {$value}"; } diff --git a/lib/Model/PaymentIntentStatusResponse.php b/lib/Model/PaymentIntentStatusResponse.php index d7eaa26..33b4446 100755 --- a/lib/Model/PaymentIntentStatusResponse.php +++ b/lib/Model/PaymentIntentStatusResponse.php @@ -440,11 +440,8 @@ public function getSimpleStatus() * * @return self */ - public function setSimpleStatus($simple_status) + public function setSimpleStatus(string|null $simple_status) { - if (is_null($simple_status)) { - throw new SanitizedInvalidArgumentException('non-nullable simple_status cannot be null'); - } $this->container['simple_status'] = $simple_status; return $this; diff --git a/lib/TatraPayPlusLogger.php b/lib/TatraPayPlusLogger.php index 959f9d2..f7c7c23 100644 --- a/lib/TatraPayPlusLogger.php +++ b/lib/TatraPayPlusLogger.php @@ -5,7 +5,11 @@ class TatraPayPlusLogger { public bool $mask_sensitive_data; - public array $mask_body_fields = ["client_id", "client_secret", "access_token"]; + public array $mask_body_fields = [ + "client_id", + "client_secret", + "access_token", + ]; public array $mask_header_fields = ["Authorization"]; public function __construct($mask_sensitive_data = true) @@ -13,15 +17,17 @@ public function __construct($mask_sensitive_data = true) $this->mask_sensitive_data = $mask_sensitive_data; } - private function _mask_value($value, $max_chars = 5): string + private function _mask_value($value, int $max_chars = 5): string { if (!is_string($value) || strlen($value) < $max_chars * 2) { return str_repeat("*", strlen($value)); } - return substr($value, 0, $max_chars) . str_repeat("*", strlen($value) - $max_chars * 2) . substr($value, -$max_chars); + return substr($value, 0, $max_chars) . + str_repeat("*", strlen($value) - $max_chars * 2) . + substr($value, -$max_chars); } - private function _mask_header(array $header) + private function _mask_header(array $header): false|string { if (!$this->mask_sensitive_data) { return json_encode($header, JSON_PRETTY_PRINT); @@ -38,7 +44,7 @@ private function _mask_header(array $header) return json_encode($masked_headers, JSON_PRETTY_PRINT); } - private function _mask_body($body) + private function _mask_body(mixed $body): mixed { if (empty($body)) { return "No body"; @@ -51,7 +57,8 @@ private function _mask_body($body) if (is_string($body)) { try { $body = json_decode($body, true); - } catch (\Exception $e) {} + } catch (\Exception $e) { + } } if (is_string($body)) { @@ -61,10 +68,11 @@ private function _mask_body($body) foreach ($pairs as $key => $value) { if (in_array($key, $this->mask_body_fields, true)) { - $masked_pairs[] = $key . '=' . $this->_mask_value((string) $value); + $masked_pairs[] = + $key . "=" . $this->_mask_value((string) $value); } else { print $value; - $masked_pairs[] = $key . '=' . $value; + $masked_pairs[] = $key . "=" . $value; } } return implode("&", $masked_pairs); @@ -84,23 +92,29 @@ private function _mask_body($body) public function log(HttpResponse $response, $additional_data): void { - $date = gmdate('Y-m-d H:i:s'); + $date = gmdate("Y-m-d H:i:s"); $request = $response->getRequest(); $request_data = $this->_mask_body($request->getBody()); $headers = $this->_mask_header($request->getHeaders()); - $this->writeLine(sprintf('INFO [%s] [INFO] Request:', $date)); - $this->writeLine(sprintf('Method: %s', $request->getMethod())); - $this->writeLine(sprintf('URL: %s', $request->getUri())); - $this->writeLine('Headers:'); + $this->writeLine(sprintf("INFO [%s] [INFO] Request:", $date)); + $this->writeLine(sprintf("Method: %s", $request->getMethod())); + $this->writeLine(sprintf("URL: %s", $request->getUri())); + $this->writeLine("Headers:"); $this->writeLine(print_r($headers, true)); if ($request_data) { - $this->writeLine('Body:'); + $this->writeLine("Body:"); $this->writeLine((string) $request_data); } - $this->writeLine(sprintf('INFO [%s] [INFO] Response (status code: %s):', $date, $response->getStatusCode())); + $this->writeLine( + sprintf( + "INFO [%s] [INFO] Response (status code: %s):", + $date, + $response->getStatusCode() + ) + ); $response_body = $response->getBody(); if (is_array($response_body)) { @@ -113,7 +127,6 @@ public function log(HttpResponse $response, $additional_data): void public function writeLine(string $line): void { - print $line . "\n"; -// throw new Exception('TatraPayPlusLogger subclass must implement write_line()'); + throw new Exception('TatraPayPlusLogger subclass must implement write_line()'); } } diff --git a/tests/tests.php b/tests/tests.php index 36799f6..8f297d4 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -29,7 +29,6 @@ use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusService; use Tatrapayplus\TatrapayplusApiClient\Api\TatraPayPlusAPIApi; - final class Tests extends TestCase { private string $client_id; @@ -38,366 +37,422 @@ final class Tests extends TestCase public function __construct() { parent::__construct(); - $this->client_id = getenv('TATRAPAY_CLIENT_ID'); - $this->client_secret = getenv('TATRAPAY_CLIENT_SECRET'); + $this->client_id = getenv("TATRAPAY_CLIENT_ID"); + $this->client_secret = getenv("TATRAPAY_CLIENT_SECRET"); } - private function getPaymentPayload(float $total, string $currency, bool $save_card = false): InitiatePaymentRequest - { + private function getPaymentPayload( + float $total, + string $currency, + bool $save_card = false + ): InitiatePaymentRequest { $order_id = uniqid(); - $basePayment = new BasePayment( [ - 'instructed_amount' => new Amount( [ - 'amount_value' => $total, - 'currency' => $currency, - ] ), - 'end_to_end' => new E2e( [ - 'variable_symbol' => '123', - ] ), - ] ); - - $userData = new UserData( [ - 'first_name' => 'Janko', - 'last_name' => 'Hrasko', - 'email' => 'janko.hrasko@test.sk', - ] ); - - $bankTransfer = new BankTransfer(); - $billingAddress = new Address( [ - 'street_name' => 'TestStreet', - 'building_number' => '12', - 'town_name' => 'Town', - 'post_code' => '97405', - 'country' => 'SK', - ] ); - $shippingAddress = new Address( [ - 'street_name' => 'TestStreet', - 'building_number' => '12', - 'town_name' => 'Town', - 'post_code' => '97405', - 'country' => 'SK', - ] ); - $card_holder = 'Janko Hraško'; - - $payLater = new PayLater( [ - 'order' => new Order( [ - 'order_no' => $order_id, - 'order_items' => array( + $basePayment = new BasePayment([ + "instructed_amount" => new Amount([ + "amount_value" => $total, + "currency" => $currency, + ]), + "end_to_end" => new E2e([ + "variable_symbol" => "123", + ]), + ]); + + $userData = new UserData([ + "first_name" => "Janko", + "last_name" => "Hrasko", + "email" => "janko.hrasko@test.sk", + ]); + + $bankTransfer = new BankTransfer(); + $billingAddress = new Address([ + "street_name" => "TestStreet", + "building_number" => "12", + "town_name" => "Town", + "post_code" => "97405", + "country" => "SK", + ]); + $shippingAddress = new Address([ + "street_name" => "TestStreet", + "building_number" => "12", + "town_name" => "Town", + "post_code" => "97405", + "country" => "SK", + ]); + $card_holder = "Janko Hraško"; + + $payLater = new PayLater([ + "order" => new Order([ + "order_no" => $order_id, + "order_items" => [ new OrderItem([ - 'quantity' => 1.0, - 'total_item_price' => $total, - 'item_detail' => new ItemDetail([ - 'item_detail_sk' => new ItemDetailLangUnit([ - 'item_name' => 'test product1', + "quantity" => 1.0, + "total_item_price" => $total, + "item_detail" => new ItemDetail([ + "item_detail_sk" => new ItemDetailLangUnit([ + "item_name" => "test product1", ]), ]), - ]) - ) - ] ), - ] ); - $cardDetail = new CardDetail( [ - 'card_holder' => $card_holder, - 'billing_address' => $billingAddress, - 'shipping_address' => $shippingAddress, - ] ); + ]), + ], + ]), + ]); + $cardDetail = new CardDetail([ + "card_holder" => $card_holder, + "billing_address" => $billingAddress, + "shipping_address" => $shippingAddress, + ]); if ($save_card) { - $cardDetail->setComfortPay( new RegisterForComfortPayObj( [ - 'register_for_comfort_pay' => true, - ] )); + $cardDetail->setComfortPay( + new RegisterForComfortPayObj([ + "register_for_comfort_pay" => true, + ]) + ); } - return new InitiatePaymentRequest( [ - 'base_payment' => $basePayment, - 'bank_transfer' => $bankTransfer, - 'user_data' => $userData, - 'card_detail' => $cardDetail, - 'pay_later' => $payLater, - ] ); + return new InitiatePaymentRequest([ + "base_payment" => $basePayment, + "bank_transfer" => $bankTransfer, + "user_data" => $userData, + "card_detail" => $cardDetail, + "pay_later" => $payLater, + ]); } public function testGenerateSignedCardId(): void { - $public_key_content = file_get_contents( dirname(dirname(__FILE__)) . '/tests/ECID_PUBLIC_KEY_2023.txt' ); - $signed_card_id = TatraPayPlusAPIApi::generateSignedCardId('123', $public_key_content); + $public_key_content = file_get_contents( + dirname(dirname(__FILE__)) . "/tests/ECID_PUBLIC_KEY_2023.txt" + ); + $signed_card_id = TatraPayPlusAPIApi::generateSignedCardId( + "123", + $public_key_content + ); $this->assertTrue(is_string($signed_card_id)); } public function testLimitLength(): void { - $result = TatraPayPlusService::limit_length('test123', 4); - $this->assertSame($result, 'test'); + $result = TatraPayPlusService::limit_length("test123", 4); + $this->assertSame($result, "test"); } public function testRemoveDiacritics(): void { - $initiate_payment_request = $this->getPaymentPayload(10, 'EUR'); + $initiate_payment_request = $this->getPaymentPayload(10, "EUR"); - $this->assertSame($initiate_payment_request->getCardDetail()->getCardHolder(), 'Janko Hrasko'); + $this->assertSame( + $initiate_payment_request->getCardDetail()->getCardHolder(), + "Janko Hrasko" + ); } public function testGetAvailablePaymentMethods(): void { - $api_instance = new TatraPayPlusAPIApi( + $api_instance = new TatraPayPlusAPIApi( $this->client_id, - $this->client_secret, + $this->client_secret ); $available_methods = $api_instance->getAvailableMethods(); $this->assertTrue(is_array($available_methods)); - $this->assertSame($available_methods['CARD_PAY']['supported_currencies'], ['EUR', 'USD']); + $this->assertSame( + $available_methods["CARD_PAY"]["supported_currencies"], + ["EUR", "USD"] + ); } public function testGetAvailablePaymentMethodsConditional(): void { - $mocked_methods = array( - new PaymentMethodRules( - array( - "supported_currency" => ["EUR"], - "paymentMethod" => "TEST1", - "amount_range_rule" => new AmountRangeRule( - array( - "min_amount" => 1, - "max_amount" => 1000, - ) - ), - ), - ), - new PaymentMethodRules( - array( - "supported_currency" => ["EUR", "USD"], - "paymentMethod" => "TEST2", - ), - ), - new PaymentMethodRules( - array( - "supported_currency" => ["EUR"], - "supported_country" => ["SK", "CZ"], - "paymentMethod" => "TEST3", - ), - ), - ); - $mocked_result = new PaymentMethodsListResponse( - array( - 'payment_methods' => $mocked_methods - ) - ); - $parsed_response = array( - 'object' => $mocked_result, - 'response' => null - ); - - $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['getMethods',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); - $api_instance->method('getMethods')->will($this->returnValue($parsed_response)); - - $test_cases = array( + $mocked_methods = [ + new PaymentMethodRules([ + "supported_currency" => ["EUR"], + "paymentMethod" => "TEST1", + "amount_range_rule" => new AmountRangeRule([ + "min_amount" => 1, + "max_amount" => 1000, + ]), + ]), + new PaymentMethodRules([ + "supported_currency" => ["EUR", "USD"], + "paymentMethod" => "TEST2", + ]), + new PaymentMethodRules([ + "supported_currency" => ["EUR"], + "supported_country" => ["SK", "CZ"], + "paymentMethod" => "TEST3", + ]), + ]; + $mocked_result = new PaymentMethodsListResponse([ + "payment_methods" => $mocked_methods, + ]); + $parsed_response = [ + "object" => $mocked_result, + "response" => null, + ]; + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class) + ->onlyMethods(["getMethods"]) + ->setConstructorArgs([$this->client_id, $this->client_secret]) + ->getMock(); + $api_instance + ->method("getMethods") + ->will($this->returnValue($parsed_response)); + + $test_cases = [ // amount, currency, country, expected_methods - array(100, 'EUR', null, ["TEST1", "TEST2", "TEST3"]), - array(10, 'USD', 'SK', ["TEST2"]), - array(1001, 'EUR', null, ["TEST2", "TEST3"]), - array(10, 'EUR', 'HUN', ["TEST1", "TEST2"]), - ); - - foreach ($test_cases as [$amount, $currency, $country, $expected_methods]) { - $available_methods = $api_instance->getAvailableMethods($amount, $currency, $country); + [100, "EUR", null, ["TEST1", "TEST2", "TEST3"]], + [10, "USD", "SK", ["TEST2"]], + [1001, "EUR", null, ["TEST2", "TEST3"]], + [10, "EUR", "HUN", ["TEST1", "TEST2"]], + ]; + + foreach ( + $test_cases + as [$amount, $currency, $country, $expected_methods] + ) { + $available_methods = $api_instance->getAvailableMethods( + $amount, + $currency, + $country + ); foreach ($expected_methods as $expected_method) { - $this->assertTrue(array_key_exists($expected_method, $available_methods)); + $this->assertTrue( + array_key_exists($expected_method, $available_methods) + ); } } } public function testInitiatePaymentCheckPaymentStatus(): void { - $accept_language = 'sk'; + $accept_language = "sk"; $preferred_method = null; - $initiate_payment_request = $this->getPaymentPayload(10, 'EUR'); + $initiate_payment_request = $this->getPaymentPayload(10, "EUR"); - $api_instance = new TatraPayPlusAPIApi( + $api_instance = new TatraPayPlusAPIApi( $this->client_id, - $this->client_secret, + $this->client_secret ); - $response = $api_instance->initiatePayment( 'http://localhost', $initiate_payment_request, $preferred_method, $accept_language ); + $response = $api_instance->initiatePayment( + "http://localhost", + $initiate_payment_request, + $preferred_method, + $accept_language + ); - $this->assertFalse(is_null($response['object'])); - $this->assertFalse(is_null($response['response'])); + $this->assertFalse(is_null($response["object"])); + $this->assertFalse(is_null($response["response"])); - $payment_id = $response['object']->getPaymentId(); + $payment_id = $response["object"]->getPaymentId(); $this->assertFalse(is_null($payment_id)); $response = $api_instance->getPaymentIntentStatus($payment_id); - $this->assertFalse(is_null($response['object'])); - $this->assertSame($response['response']->getStatusCode(), 200); - $this->assertSame($response['object']->getAuthorizationStatus(), PaymentIntentStatusResponse::AUTHORIZATION_STATUS__NEW); - $this->assertSame($response['object']->getSimpleStatus(), PaymentIntentStatusResponse::SIMPLE_STATUS_PENDING); + $this->assertFalse(is_null($response["object"])); + $this->assertSame($response["response"]->getStatusCode(), 200); + $this->assertSame( + $response["object"]->getAuthorizationStatus(), + PaymentIntentStatusResponse::AUTHORIZATION_STATUS__NEW + ); + $this->assertSame( + $response["object"]->getSimpleStatus(), + PaymentIntentStatusResponse::SIMPLE_STATUS_PENDING + ); } public function testCancelPaymentIntent(): void { - $api_instance = new TatraPayPlusAPIApi( + $api_instance = new TatraPayPlusAPIApi( $this->client_id, - $this->client_secret, + $this->client_secret ); - $initiate_payment_request = $this->getPaymentPayload(10, 'EUR'); + $initiate_payment_request = $this->getPaymentPayload(10, "EUR"); - $response = $api_instance->initiatePayment('http://localhost', $initiate_payment_request); + $response = $api_instance->initiatePayment( + "http://localhost", + $initiate_payment_request + ); - $this->assertFalse(is_null($response['object'])); - $this->assertFalse(is_null($response['response'])); + $this->assertFalse(is_null($response["object"])); + $this->assertFalse(is_null($response["response"])); - $payment_id = $response['object']->getPaymentId(); + $payment_id = $response["object"]->getPaymentId(); $this->assertFalse(is_null($payment_id)); $response = $api_instance->cancelPaymentIntent($payment_id); - $this->assertSame($response['response']->getStatusCode(), 200); + $this->assertSame($response["response"]->getStatusCode(), 200); } public function testUpdatePaymentIntent(): void { - $mock_response = new HttpResponse( - array(), - array(), - 201 - ); - - $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); - $mock_client->method('send')->will($this->returnValue($mock_response)); - - $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); - $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + $mock_response = new HttpResponse([], [], 201); + + $mock_client = $this->getMockBuilder(CurlClient::class) + ->onlyMethods(["send"]) + ->getMock(); + $mock_client->method("send")->will($this->returnValue($mock_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class) + ->onlyMethods(["addAuthHeader"]) + ->setConstructorArgs([$this->client_id, $this->client_secret]) + ->getMock(); + $api_instance + ->method("addAuthHeader") + ->will($this->returnCallback("mock_addAuthHeader")); $api_instance->setClient($mock_client); - $data = new CardPayUpdateInstruction( [ - 'operation_type' =>CardPayUpdateInstruction::OPERATION_TYPE_CHARGEBACK, - 'amount' => 3.0, - ] ); - $response = $api_instance->updatePaymentIntent( 'TEST123', $data ); + $data = new CardPayUpdateInstruction([ + "operation_type" => + CardPayUpdateInstruction::OPERATION_TYPE_CHARGEBACK, + "amount" => 3.0, + ]); + $response = $api_instance->updatePaymentIntent("TEST123", $data); - $this->assertSame($response['response']->getStatusCode(), 201); + $this->assertSame($response["response"]->getStatusCode(), 201); } public function testSavedCard(): void { - $api_instance = new TatraPayPlusAPIApi( + $api_instance = new TatraPayPlusAPIApi( $this->client_id, - $this->client_secret, + $this->client_secret ); - $initiate_payment_request = $this->getPaymentPayload(10, 'EUR', true); + $initiate_payment_request = $this->getPaymentPayload(10, "EUR", true); - $response = $api_instance->initiatePayment('http://localhost', $initiate_payment_request); + $response = $api_instance->initiatePayment( + "http://localhost", + $initiate_payment_request + ); - $this->assertFalse(is_null($response['object'])); - $this->assertFalse(is_null($response['response'])); + $this->assertFalse(is_null($response["object"])); + $this->assertFalse(is_null($response["response"])); - $payment_id = $response['object']->getPaymentId(); + $payment_id = $response["object"]->getPaymentId(); $this->assertFalse(is_null($payment_id)); } public function testSavedCardResponseMocked(): void { - $mocked_status = json_encode(array( + $mocked_status = json_encode([ "selectedPaymentMethod" => "CARD_PAY", "authorizationStatus" => "AUTH_DONE", - "status" => array( + "status" => [ "status" => "OK", "currency" => "EUR", "maskedCardNumber" => "440577******5558", - "comfortPay" => array("cid" => "123", "status" => "OK"), - ) - )); - $mock_response = new HttpResponse( - $mocked_status, - array(), - 201 - ); - - $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); - $mock_client->method('send')->will($this->returnValue($mock_response)); - - $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); - $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + "comfortPay" => ["cid" => "123", "status" => "OK"], + ], + ]); + $mock_response = new HttpResponse($mocked_status, [], 201); + + $mock_client = $this->getMockBuilder(CurlClient::class) + ->onlyMethods(["send"]) + ->getMock(); + $mock_client->method("send")->will($this->returnValue($mock_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class) + ->onlyMethods(["addAuthHeader"]) + ->setConstructorArgs([$this->client_id, $this->client_secret]) + ->getMock(); + $api_instance + ->method("addAuthHeader") + ->will($this->returnCallback("mock_addAuthHeader")); $api_instance->setClient($mock_client); - $response = $api_instance->getPaymentIntentStatus( '12345' ); + $response = $api_instance->getPaymentIntentStatus("12345"); - $this->assertFalse(is_null($response['object'])); - $this->assertSame($response['response']->getStatusCode(), 201); - $this->assertSame($response['object']->getSimpleStatus(), PaymentIntentStatusResponse::SIMPLE_STATUS_ACCEPTED); - $status_obj = $response['object']->getStatus(); - $this->assertSame($status_obj->getComfortPay()->getCid(), '123'); - $this->assertSame($status_obj->getMaskedCardNumber(), '440577******5558'); + $this->assertFalse(is_null($response["object"])); + $this->assertSame($response["response"]->getStatusCode(), 201); + $this->assertSame( + $response["object"]->getSimpleStatus(), + PaymentIntentStatusResponse::SIMPLE_STATUS_ACCEPTED + ); + $status_obj = $response["object"]->getStatus(); + $this->assertSame($status_obj->getComfortPay()->getCid(), "123"); + $this->assertSame( + $status_obj->getMaskedCardNumber(), + "440577******5558" + ); } public function testSetAppearance(): void { - $appearance_request = new AppearanceRequest( - array( - 'theme' => AppearanceRequest::THEME_SYSTEM, - 'tint_on_accent' => new ColorAttribute( [ - 'color_dark_mode' => '#fff', - 'color_light_mode' => '#fff', - ] ), - 'tint_accent' => new ColorAttribute( [ - 'color_dark_mode' => '#fff', - 'color_light_mode' => '#fff', - ] ), - 'surface_accent' => new ColorAttribute( [ - 'color_dark_mode' => '#fff', - 'color_light_mode' => '#fff', - ] ), - ) - ); - $api_instance = new TatraPayPlusAPIApi( + $appearance_request = new AppearanceRequest([ + "theme" => AppearanceRequest::THEME_SYSTEM, + "tint_on_accent" => new ColorAttribute([ + "color_dark_mode" => "#fff", + "color_light_mode" => "#fff", + ]), + "tint_accent" => new ColorAttribute([ + "color_dark_mode" => "#fff", + "color_light_mode" => "#fff", + ]), + "surface_accent" => new ColorAttribute([ + "color_dark_mode" => "#fff", + "color_light_mode" => "#fff", + ]), + ]); + $api_instance = new TatraPayPlusAPIApi( $this->client_id, - $this->client_secret, + $this->client_secret ); $response = $api_instance->setAppearance($appearance_request); - $this->assertSame($response['response']->getStatusCode(), 201); + $this->assertSame($response["response"]->getStatusCode(), 201); } public function testSetLogoMocked(): void { - $mock_response = new HttpResponse( - array(), - array(), - 201 - ); - - $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); - $mock_client->method('send')->will($this->returnValue($mock_response)); - - $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); - $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + $mock_response = new HttpResponse([], [], 201); + + $mock_client = $this->getMockBuilder(CurlClient::class) + ->onlyMethods(["send"]) + ->getMock(); + $mock_client->method("send")->will($this->returnValue($mock_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class) + ->onlyMethods(["addAuthHeader"]) + ->setConstructorArgs([$this->client_id, $this->client_secret]) + ->getMock(); + $api_instance + ->method("addAuthHeader") + ->will($this->returnCallback("mock_addAuthHeader")); $api_instance->setClient($mock_client); - $logo_request = new AppearanceLogoRequest( - array( - 'logo_image' => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII" - ) - ); + $logo_request = new AppearanceLogoRequest([ + "logo_image" => + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII", + ]); $response = $api_instance->setLogo($logo_request); - $this->assertSame($response['response']->getStatusCode(), 201); + $this->assertSame($response["response"]->getStatusCode(), 201); } public function testRetry(): void { $send_count = TatraPayPlusAPIApi::RETRIES; - $mock_error_body = json_encode(array('error' => 'testError1')); - $mock_error_response = new HttpResponse( - $mock_error_body, - array(), - 500 - ); - - $mock_client = $this->getMockBuilder(CurlClient::class)->onlyMethods(['send',])->getMock(); - $mock_client->expects($this->exactly($send_count))->method('send')->will($this->returnValue($mock_error_response)); - - $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class)->onlyMethods(['addAuthHeader',])->setConstructorArgs([$this->client_id, $this->client_secret])->getMock(); + $mock_error_body = json_encode(["error" => "testError1"]); + $mock_error_response = new HttpResponse($mock_error_body, [], 500); + + $mock_client = $this->getMockBuilder(CurlClient::class) + ->onlyMethods(["send"]) + ->getMock(); + $mock_client + ->expects($this->exactly($send_count)) + ->method("send") + ->will($this->returnValue($mock_error_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class) + ->onlyMethods(["addAuthHeader"]) + ->setConstructorArgs([$this->client_id, $this->client_secret]) + ->getMock(); $api_instance->setClient($mock_client); - $api_instance->method('addAuthHeader')->will($this->returnCallback('mock_addAuthHeader')); + $api_instance + ->method("addAuthHeader") + ->will($this->returnCallback("mock_addAuthHeader")); $error_thrown = false; try { From 7f664471cd24c384023879798bc0e5682cdde32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Tue, 6 May 2025 17:29:32 +0200 Subject: [PATCH 11/16] triv: reformat, add logger test --- tests/tests.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/tests.php b/tests/tests.php index 8f297d4..5e3877f 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -26,6 +26,7 @@ use Tatrapayplus\TatrapayplusApiClient\Model\ItemDetail; use Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit; use Tatrapayplus\TatrapayplusApiClient\CurlClient; +use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusLogger; use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusService; use Tatrapayplus\TatrapayplusApiClient\Api\TatraPayPlusAPIApi; @@ -464,9 +465,39 @@ public function testRetry(): void } $this->assertTrue($error_thrown); } + + public function testLogger() + { + $logger = new TestLogger(); + $api_instance = new TatraPayPlusAPIApi( + $this->client_id, + $this->client_secret, + $logger, + mode: TatraPayPlusAPIApi::SANDBOX + ); + + $api_instance->getAvailableMethods(); + // 7 - token operation, 9 - getMethods operation + $this->assertSame(16, count($logger->lines)); + } } function mock_addAuthHeader($headers) { return $headers; } + + +class TestLogger extends TatraPayPlusLogger +{ + public array $lines = []; + + public array $mask_body_fields = [ + "access_token", + ]; + + public function writeLine(string $line): void + { + $this->lines[] = $line; + } +} From 405878ce79e30b26762235c22f0c7eea689de9dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Wed, 7 May 2025 14:32:24 +0200 Subject: [PATCH 12/16] feat: add direct transaction operation --- lib/Api/TatraPayPlusAPIApi.php | 83 ++- lib/Model/ApplePayToken.php | 428 +++++++++++++++ lib/Model/DirectTransactionIPSPData.php | 478 ++++++++++++++++ lib/Model/DirectTransactionTDSData.php | 473 ++++++++++++++++ .../InitiateDirectTransactionRequest.php | 516 ++++++++++++++++++ .../InitiateDirectTransactionResponse.php | 376 +++++++++++++ lib/Model/Token.php | 366 +++++++++++++ tests/tests.php | 84 ++- 8 files changed, 2802 insertions(+), 2 deletions(-) create mode 100644 lib/Model/ApplePayToken.php create mode 100644 lib/Model/DirectTransactionIPSPData.php create mode 100644 lib/Model/DirectTransactionTDSData.php create mode 100755 lib/Model/InitiateDirectTransactionRequest.php create mode 100755 lib/Model/InitiateDirectTransactionResponse.php create mode 100644 lib/Model/Token.php diff --git a/lib/Api/TatraPayPlusAPIApi.php b/lib/Api/TatraPayPlusAPIApi.php index 68d8f50..d8707bd 100755 --- a/lib/Api/TatraPayPlusAPIApi.php +++ b/lib/Api/TatraPayPlusAPIApi.php @@ -125,7 +125,7 @@ public function setClient(object|null $client): void public function addAuthHeader(array $headers): array { if (is_null($this->access_token) || $this->access_token->isExpired()) { - $response = $this->token('client_credentials', $this->client_id, $this->client_secret, $this->scope); + $response = $this->token(self::GRANT_TYPE, $this->client_id, $this->client_secret, $this->scope); $responseObj = $response['object']; $this->access_token = new AccessToken($responseObj->getAccessToken(), (int) $responseObj->getExpiresIn()); } @@ -595,6 +595,87 @@ public function initiatePaymentRequest($redirect_uri, $initiate_payment_request, ); } + /** + * Operation initiateDirectTransaction + * + * Initiate direct payment intent + * + * @param string $redirect_uri URI of the client application endpoint, where the user shall be redirected to after payment process. URI has to be registered in Developer portal (required) + * @param \Tatrapayplus\TatrapayplusApiClient\Model\InitiateDirectTransactionRequest $initiate_transaction_request + * + * @return array of \Tatrapayplus\TatrapayplusApiClient\Model\InitiatePaymentResponse|\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody, HTTP status code, HTTP response headers (array of strings) + * + * @throws SanitizedInvalidArgumentException + * @throws ApiException on non-2xx response or if the response body is not in the expected format + */ + public function initiateDirectTransaction($redirect_uri, $initiate_transaction_request) + { + $request = $this->initiateDirectTransactionRequest($redirect_uri, $initiate_transaction_request); + + return $this->processRequest($request, '\Tatrapayplus\TatrapayplusApiClient\Model\InitiateDirectTransactionResponse', '\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody'); + } + + /** + * Create request for operation 'initiateDirectTransactionRequest' + * + * @param string $redirect_uri URI of the client application endpoint, where the user shall be redirected to after payment process. URI has to be registered in Developer portal (required) + * @param \Tatrapayplus\TatrapayplusApiClient\Model\InitiateDirectTransactionRequest $initiate_transaction_request + * + * @return Request + * + * @throws SanitizedInvalidArgumentException + */ + public function initiateDirectTransactionRequest($redirect_uri, $initiate_transaction_request) + { + // verify the required parameter 'redirect_uri' is set + if ($redirect_uri === null || (is_array($redirect_uri) && count($redirect_uri) === 0)) { + throw new SanitizedInvalidArgumentException('Missing the required parameter $redirect_uri when calling initiateDirectTransactionRequest'); + } + + // verify the required parameter 'initiate_payment_request' is set + if ($initiate_transaction_request === null || (is_array($initiate_transaction_request) && count($initiate_transaction_request) === 0)) { + throw new SanitizedInvalidArgumentException('Missing the required parameter $initiate_transaction_request when calling initiateDirectTransactionRequest'); + } + + $resourcePath = '/v1/payments-direct'; + $queryParams = []; + $headerParams = []; + + // header params + if ($redirect_uri !== null) { + $headerParams['Redirect-URI'] = ObjectSerializer::toHeaderValue($redirect_uri); + } + + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + self::contentTypes['initiatePayment'][0], + false + ); + + $httpBody = static::json_encode(ObjectSerializer::sanitizeForSerialization($initiate_transaction_request)); + $httpBody = str_replace('\\\\n', '\\n', $httpBody); + // this endpoint requires OAuth (access token) + $headers = $this->addAuthHeader($headers); + + $defaultHeaders = $this->getDefaultHeaders(); + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + public static function json_encode(...$args) { // Store the current precision diff --git a/lib/Model/ApplePayToken.php b/lib/Model/ApplePayToken.php new file mode 100644 index 0000000..d8c3382 --- /dev/null +++ b/lib/Model/ApplePayToken.php @@ -0,0 +1,428 @@ + 'array', + 'data' => 'string', + 'signature' => 'string', + 'version' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * + * @phpstan-var array + * + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'header' => null, + 'data' => null, + 'signature' => null, + 'version' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'header' => true, + 'data' => true, + 'signature' => true, + 'version' => true, + ]; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'header' => 'header', + 'data' => 'data', + 'signature' => 'signature', + 'version' => 'version', + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'header' => 'setHeader', + 'data' => 'setData', + 'signature' => 'setSignature', + 'version' => 'setVersion', + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'header' => 'getHeader', + 'data' => 'getData', + 'signature' => 'getSignature', + 'version' => 'getVersion', + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** + * 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->setIfExists('header', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('signature', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * 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; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets header + * + * @return array + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param array $header header + * + * @return self + */ + public function setHeader($header) + { + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets data + * + * @return string + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string $data data + * + * @return self + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets signature + * + * @return string + */ + public function getSignature() + { + return $this->container['signature']; + } + + /** + * Sets signature + * + * @param string $signature signature + * + * @return self + */ + public function setSignature($signature) + { + $this->container['signature'] = $signature; + + return $this; + } + + /** + * Gets version + * + * @return string + */ + public function getVersion() + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string $version version + * + * @return self + */ + public function setVersion($version) + { + $this->container['version'] = $version; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } +} diff --git a/lib/Model/DirectTransactionIPSPData.php b/lib/Model/DirectTransactionIPSPData.php new file mode 100644 index 0000000..9984653 --- /dev/null +++ b/lib/Model/DirectTransactionIPSPData.php @@ -0,0 +1,478 @@ + 'string', + 'name' => 'string', + 'location' => 'string', + 'country' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * + * @phpstan-var array + * + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sub_merchant_id' => null, + 'name' => null, + 'location' => null, + 'country' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'sub_merchant_id' => false, + 'name' => false, + 'location' => false, + 'country' => false, + ]; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sub_merchant_id' => 'subMerchantId', + 'name' => 'name', + 'location' => 'location', + 'country' => 'country', + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sub_merchant_id' => 'setSubMerchantId', + 'name' => 'setName', + 'location' => 'setLocation', + 'country' => 'setCountry', + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_merchant_id' => 'getSubMerchantId', + 'name' => 'getName', + 'location' => 'getLocation', + 'country' => 'getCountry', + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** + * 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->setIfExists('sub_merchant_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * 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; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!preg_match('/^[0-9]*$/', $this->container['sub_merchant_id'])) { + $invalidProperties[] = "invalid value for 'sub_merchant_id', must be conform to the pattern /^[0-9]*$/."; + } + + if (!is_null($this->container['name']) && !preg_match("/^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/", $this->container['name'])) { + $invalidProperties[] = "invalid value for 'name', must be conform to the pattern /^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/."; + } + + if (!is_null($this->container['location']) && !preg_match('/^[ 0-9a-zA-Z-]{1,13}$/', $this->container['location'])) { + $invalidProperties[] = "invalid value for 'location', must be conform to the pattern /^[ 0-9a-zA-Z-]{1,13}$/."; + } + + if (!is_null($this->container['country']) && !preg_match('/^[A-Z]{2}$/', $this->container['country'])) { + $invalidProperties[] = "invalid value for 'country', must be conform to the pattern /^[A-Z]{2}$/."; + } + + return $invalidProperties; + } + + /** + * Gets sub_merchant_id + * + * @return string + */ + public function getSubMerchantId() + { + return $this->container['sub_merchant_id']; + } + + /** + * Sets sub_merchant_id + * + * @param string $sub_merchant_id sub_merchant_id + * + * @return self + */ + public function setSubMerchantId($sub_merchant_id) + { + if (is_null($sub_merchant_id)) { + throw new SanitizedInvalidArgumentException('non-nullable sub_merchant_id cannot be null'); + } + + if (!preg_match('/^[0-9]*$/', ObjectSerializer::toString($sub_merchant_id))) { + throw new SanitizedInvalidArgumentException("invalid value for 'sub_merchant_id', must be conform to the pattern /^[0-9]*$/."); + } + + $this->container['sub_merchant_id'] = $sub_merchant_id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new SanitizedInvalidArgumentException('non-nullable name cannot be null'); + } + + if (!preg_match("/^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/", ObjectSerializer::toString($name))) { + throw new SanitizedInvalidArgumentException("invalid value for 'name', must be conform to the pattern /^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/."); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets location + * + * @return string|null + */ + public function getLocation() + { + return $this->container['location']; + } + + /** + * Sets location + * + * @param string + * + * @return self + */ + public function setLocation($location) + { + if (is_null($location)) { + throw new SanitizedInvalidArgumentException('non-nullable location cannot be null'); + } + + if (!preg_match('/^[ 0-9a-zA-Z-]{1,13}$/', ObjectSerializer::toString($location))) { + throw new SanitizedInvalidArgumentException("invalid value for 'location', must be conform to the pattern /^[ 0-9a-zA-Z-]{1,13}$/."); + } + + $this->container['location'] = $location; + + return $this; + } + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new SanitizedInvalidArgumentException('non-nullable country cannot be null'); + } + + if (!preg_match('/^[A-Z]{2}$/', ObjectSerializer::toString($country))) { + throw new SanitizedInvalidArgumentException("invalid value for 'country', must be conform to the pattern /^[A-Z]{2}$/."); + } + + $this->container['country'] = $country; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } +} diff --git a/lib/Model/DirectTransactionTDSData.php b/lib/Model/DirectTransactionTDSData.php new file mode 100644 index 0000000..37e8637 --- /dev/null +++ b/lib/Model/DirectTransactionTDSData.php @@ -0,0 +1,473 @@ + 'string', + 'email' => 'string', + 'phone' => 'string', + 'billing_address' => '\Tatrapayplus\TatrapayplusApiClient\Model\Address', + 'shipping_address' => '\Tatrapayplus\TatrapayplusApiClient\Model\Address', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * + * @phpstan-var array + * + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'card_holder' => null, + 'email' => null, + 'phone' => null, + 'billing_address' => null, + 'shipping_address' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'card_holder' => true, + 'email' => true, + 'phone' => true, + 'billing_address' => true, + 'shipping_address' => true, + ]; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'card_holder' => 'cardHolder', + 'email' => 'email', + 'phone' => 'phone', + 'billing_address' => 'billingAddress', + 'shipping_address' => 'shippingAddress', + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'card_holder' => 'setCardHolder', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'billing_address' => 'setBillingAddress', + 'shipping_address' => 'setShippingAddress', + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'card_holder' => 'getCardHolder', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'billing_address' => 'getBillingAddress', + 'shipping_address' => 'getShippingAddress', + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** + * 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) + { + if ($data['card_holder']) { + $data['card_holder'] = TatraPayPlusService::remove_diacritics($data['card_holder']); + } + $this->setIfExists('card_holder', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('billing_address', $data ?? [], null); + $this->setIfExists('shipping_address', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * 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; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!preg_match('/^[ 0-9a-zA-Z.@_-]{2,45}$/', $this->container['card_holder'])) { + $invalidProperties[] = "invalid value for 'card_holder', must be conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/."; + } + + return $invalidProperties; + } + + /** + * Gets card_holder + * + * @return string + */ + public function getCardHolder() + { + return $this->container['card_holder']; + } + + /** + * Sets card_holder + * + * @param string $card_holder card_holder + * + * @return self + */ + public function setCardHolder($card_holder) + { + if (!preg_match('/^[ 0-9a-zA-Z.@_-]{2,45}$/', ObjectSerializer::toString($card_holder))) { + throw new SanitizedInvalidArgumentException("invalid value for 'card_holder', must be conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/."); + } + + $this->container['card_holder'] = $card_holder; + + return $this; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email email + * + * @return self + */ + public function setEmail($email) + { + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string + * + * @return self + */ + public function setPhone($phone) + { + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets billing_address + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address + */ + public function getBillingAddress() + { + return $this->container['billing_address']; + } + + /** + * Sets billing_address + * + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address + * + * @return self + */ + public function setBillingAddress($billing_address) + { + $this->container['billing_address'] = $billing_address; + + return $this; + } + + /** + * Gets shipping_address + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address + */ + public function getShippingAddress() + { + return $this->container['shipping_address']; + } + + /** + * Sets shipping_address + * + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address + * + * @return self + */ + public function setShippingAddress($shipping_address) + { + $this->container['shipping_address'] = $shipping_address; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } +} diff --git a/lib/Model/InitiateDirectTransactionRequest.php b/lib/Model/InitiateDirectTransactionRequest.php new file mode 100755 index 0000000..bc608b4 --- /dev/null +++ b/lib/Model/InitiateDirectTransactionRequest.php @@ -0,0 +1,516 @@ + '\Tatrapayplus\TatrapayplusApiClient\Model\Amount', + 'end_to_end' => '\Tatrapayplus\TatrapayplusApiClient\Model\E2e', + 'is_pre_authorization' => 'bool', + 'tds_data' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionTDSData', + 'ipsp_data' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionIPSPData', + 'token' => '\Tatrapayplus\TatrapayplusApiClient\Model\Token', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * + * @phpstan-var array + * + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'end_to_end' => null, + 'is_pre_authorization' => null, + 'tds_data' => null, + 'ipsp_data' => null, + 'token' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'end_to_end' => false, + 'is_pre_authorization' => true, + 'tds_data' => false, + 'ipsp_data' => true, + 'token' => false, + ]; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'end_to_end' => 'endToEnd', + 'is_pre_authorization' => 'isPreAuthorization', + 'tds_data' => 'tdsData', + 'ipsp_data' => 'ipspData', + 'token' => 'token', + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'end_to_end' => 'setEndToEnd', + 'is_pre_authorization' => 'setIsPreAuthorization', + 'tds_data' => 'setTdsData', + 'ipsp_data' => 'setIpspData', + 'token' => 'setToken', + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'end_to_end' => 'getEndToEnd', + 'is_pre_authorization' => 'getIsPreAuthorization', + 'tds_data' => 'getTdsData', + 'ipsp_data' => 'getIpspData', + 'token' => 'getToken', + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** + * 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->setIfExists('amount', $data ?? [], null); + $this->setIfExists('end_to_end', $data ?? [], null); + $this->setIfExists('is_pre_authorization', $data ?? [], null); + $this->setIfExists('tds_data', $data ?? [], null); + $this->setIfExists('ipsp_data', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * 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; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['end_to_end'] === null) { + $invalidProperties[] = "'end_to_end' can't be null"; + } + if ($this->container['tds_data'] === null) { + $invalidProperties[] = "'tds_data' can't be null"; + } + if ($this->container['token'] === null) { + $invalidProperties[] = "'token' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets amount + * + * @return Amount + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param Amount $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new SanitizedInvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets end_to_end + * + * @return E2e + */ + public function getEndToEnd() + { + return $this->container['end_to_end']; + } + + /** + * Sets end_to_end + * + * @param E2e $end_to_end end_to_end + * + * @return self + */ + public function setEndToEnd($end_to_end) + { + if (is_null($end_to_end)) { + throw new SanitizedInvalidArgumentException('non-nullable end_to_end cannot be null'); + } + $this->container['end_to_end'] = $end_to_end; + + return $this; + } + + /** + * Gets is_pre_authorization + * + * @return bool + */ + public function getIsPreAuthorization() + { + return $this->container['is_pre_authorization']; + } + + /** + * Sets is_pre_authorization + * + * @param bool $is_pre_authorization is_pre_authorization + * + * @return self + */ + public function setIsPreAuthorization($is_pre_authorization) + { + $this->container['is_pre_authorization'] = $is_pre_authorization; + + return $this; + } + + /** + * Gets tds_data + * + * @return DirectTransactionTDSData + */ + public function getTdsData() + { + return $this->container['tds_data']; + } + + /** + * Sets tds_data + * + * @param DirectTransactionTDSData $tds_data tds_data + * + * @return self + */ + public function setTdsData($tds_data) + { + if (is_null($tds_data)) { + throw new SanitizedInvalidArgumentException('non-nullable tds_data cannot be null'); + } + $this->container['tds_data'] = $tds_data; + + return $this; + } + + /** + * Gets ipsp_data + * + * @return DirectTransactionIPSPData + */ + public function getIpspData() + { + return $this->container['ipsp_data']; + } + + /** + * Sets ipsp_data + * + * @param DirectTransactionIPSPData $ipsp_data tds_data + * + * @return self + */ + public function setIpspData($ipsp_data) + { + $this->container['ipsp_data'] = $ipsp_data; + + return $this; + } + + /** + * Gets token + * + * @return Token + */ + public function getToken() + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param Token $token token + * + * @return self + */ + public function setToken($token) + { + if (is_null($token)) { + throw new SanitizedInvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } +} diff --git a/lib/Model/InitiateDirectTransactionResponse.php b/lib/Model/InitiateDirectTransactionResponse.php new file mode 100755 index 0000000..2d31f8e --- /dev/null +++ b/lib/Model/InitiateDirectTransactionResponse.php @@ -0,0 +1,376 @@ + 'string', + 'redirect_form_html' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * + * @phpstan-var array + * + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'payment_id' => '$uuid', + 'redirect_form_html' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'payment_id' => false, + 'redirect_form_html' => false, + ]; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'payment_id' => 'paymentId', + 'redirect_form_html' => 'redirectFormHtml', + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'payment_id' => 'setPaymentId', + 'redirect_form_html' => 'setRedirectFormHtml', + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_id' => 'getPaymentId', + 'redirect_form_html' => 'getRedirectFormHtml', + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** + * 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->setIfExists('payment_id', $data ?? [], null); + $this->setIfExists('redirect_form_html', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * 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; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['payment_id'] === null) { + $invalidProperties[] = "'payment_id' can't be null"; + } + + return $invalidProperties; + } + + /** + * Gets payment_id + * + * @return string + */ + public function getPaymentId() + { + return $this->container['payment_id']; + } + + /** + * Sets payment_id + * + * @param string $payment_id Payment intent identifier + * + * @return self + */ + public function setPaymentId($payment_id) + { + if (is_null($payment_id)) { + throw new SanitizedInvalidArgumentException('non-nullable payment_id cannot be null'); + } + $this->container['payment_id'] = $payment_id; + + return $this; + } + + /** + * Gets redirect_form_html + * + * @return string|null + */ + public function getRedirectFormHtml() + { + return $this->container['redirect_form_html']; + } + + /** + * Sets redirect_form_html + * + * @param string|null redirect_form_html + * + * @return self + */ + public function setRedirectFormHtml($redirect_form_html) + { + if (is_null($redirect_form_html)) { + throw new SanitizedInvalidArgumentException('non-nullable redirect_form_html cannot be null'); + } + $this->container['redirect_form_html'] = $redirect_form_html; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } +} diff --git a/lib/Model/Token.php b/lib/Model/Token.php new file mode 100644 index 0000000..f2e31df --- /dev/null +++ b/lib/Model/Token.php @@ -0,0 +1,366 @@ + 'string', + 'apple_pay_token' => '\Tatrapayplus\TatrapayplusApiClient\Model\ApplePayToken', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * + * @phpstan-var array + * + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'google_pay_token' => null, + 'apple_pay_token' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'google_pay_token' => false, + 'apple_pay_token' => false, + ]; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'google_pay_token' => 'googlePayToken', + 'apple_pay_token' => 'applePayToken', + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'google_pay_token' => 'setGooglePayToken', + 'apple_pay_token' => 'setApplePayToken', + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'google_pay_token' => 'getGooglePayToken', + 'apple_pay_token' => 'getApplePayToken', + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** + * 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->setIfExists('google_pay_token', $data ?? [], null); + $this->setIfExists('apple_pay_token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * 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; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * 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; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Gets google_pay_token + * + * @return string + */ + public function getGooglePayToken() + { + return $this->container['google_pay_token']; + } + + /** + * Sets google_pay_token + * + * @param string $google_pay_token google_pay_token + * + * @return self + */ + public function setGooglePayToken($google_pay_token) + { + $this->container['google_pay_token'] = $google_pay_token; + + return $this; + } + + /** + * Gets apple_pay_token + * + * @return ApplePayToken + */ + public function getApplePayToken() + { + return $this->container['apple_pay_token']; + } + + /** + * Sets apple_pay_token + * + * @param ApplePayToken|null $apple_pay_token apple_pay_token + * + * @return self + */ + public function setApplePayToken($apple_pay_token) + { + $this->container['apple_pay_token'] = $apple_pay_token; + + return $this; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } +} diff --git a/tests/tests.php b/tests/tests.php index 5e3877f..bd19e7e 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -7,6 +7,9 @@ use Tatrapayplus\TatrapayplusApiClient\Model\AppearanceRequest; use Tatrapayplus\TatrapayplusApiClient\Model\CardPayUpdateInstruction; use Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute; +use Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionIPSPData; +use Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionTDSData; +use Tatrapayplus\TatrapayplusApiClient\Model\InitiateDirectTransactionRequest; use Tatrapayplus\TatrapayplusApiClient\Model\InitiatePaymentRequest; use Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponse; use Tatrapayplus\TatrapayplusApiClient\Model\AmountRangeRule; @@ -16,6 +19,7 @@ use Tatrapayplus\TatrapayplusApiClient\Model\Amount; use Tatrapayplus\TatrapayplusApiClient\Model\E2e; use Tatrapayplus\TatrapayplusApiClient\Model\RegisterForComfortPayObj; +use Tatrapayplus\TatrapayplusApiClient\Model\Token; use Tatrapayplus\TatrapayplusApiClient\Model\UserData; use Tatrapayplus\TatrapayplusApiClient\Model\BankTransfer; use Tatrapayplus\TatrapayplusApiClient\Model\Address; @@ -42,6 +46,47 @@ public function __construct() $this->client_secret = getenv("TATRAPAY_CLIENT_SECRET"); } + private function getDirectTransactionPayload( + float $total, + string $currency, + ): InitiateDirectTransactionRequest + { + $address = new Address([ + "street_name" => "TestStreet", + "building_number" => "12", + "town_name" => "Town", + "post_code" => "97405", + "country" => "SK", + ]); + + $request_data = new InitiateDirectTransactionRequest([ + "amount" => new Amount([ + "amount_value" => $total, + "currency" => $currency, + ]), + "is_pre_authorization" => true, + "end_to_end" => new E2e([ + "variable_symbol" => "123", + ]), + "tds_data" => new DirectTransactionTDSData([ + "card_holder" => "Janko Hraško", + "email" => "janko.hrasko@example.com", + "billing_address" => $address, + "shipping_address" => $address, + ]), + "ipsp_data" => new DirectTransactionIPSPData([ + "sub_merchant_id" => "12345", + "name" => "Test 123", + "location" => "Test 123", + "country" => "SK", + ]), + "token" => new Token([ + "google_pay_token" => "ABC12345" + ]), + ]); + return $request_data; + } + private function getPaymentPayload( float $total, string $currency, @@ -62,7 +107,7 @@ private function getPaymentPayload( $userData = new UserData([ "first_name" => "Janko", "last_name" => "Hrasko", - "email" => "janko.hrasko@test.sk", + "email" => "janko.hrasko@example.com", ]); $bankTransfer = new BankTransfer(); @@ -480,6 +525,43 @@ public function testLogger() // 7 - token operation, 9 - getMethods operation $this->assertSame(16, count($logger->lines)); } + + public function testInitiateDirectTransactionMocked(): void + { + $mock_response_body = json_encode( + array( + "paymentId" => "123456789", + "redirectFormHtml" => "custom HTML" + ) + ); + $mock_response = new HttpResponse($mock_response_body, [], 201); + $mock_client = $this->getMockBuilder(CurlClient::class) + ->onlyMethods(["send"]) + ->getMock(); + $mock_client->method("send")->will($this->returnValue($mock_response)); + + $api_instance = $this->getMockBuilder(TatraPayPlusAPIApi::class) + ->onlyMethods(["addAuthHeader"]) + ->setConstructorArgs([$this->client_id, $this->client_secret]) + ->getMock(); + $api_instance + ->method("addAuthHeader") + ->will($this->returnCallback("mock_addAuthHeader")); + $api_instance->setClient($mock_client); + + $request_data = $this->getDirectTransactionPayload(10, "EUR"); + + $response = $api_instance->initiateDirectTransaction( + "http://localhost", + $request_data, + ); + + $this->assertFalse(is_null($response["object"])); + $this->assertFalse(is_null($response["response"])); + + $this->assertSame("123456789", $response["object"]->getPaymentId()); + $this->assertSame("custom HTML", $response["object"]->getRedirectFormHtml()); + } } function mock_addAuthHeader($headers) From b60ded577edf073b71d61a96146bc4ce862aab96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Fri, 9 May 2025 14:43:30 +0200 Subject: [PATCH 13/16] feat: add model generator based on openAPI config, refactor simple_status --- .gitignore | 3 +- .openapi-generator-ignore | 26 + README.md | 21 + generate_openapi_models.sh | 31 + lib/Api/TatraPayPlusAPIApi.php | 70 +- lib/Configuration.php | 11 +- lib/Model/AccountReference.php | 320 ++- lib/Model/Address.php | 375 +-- lib/Model/Amount.php | 330 ++- lib/Model/AmountRangeRule.php | 322 ++- lib/Model/AppearanceLogoRequest.php | 318 ++- lib/Model/AppearanceRequest.php | 384 +-- lib/Model/ApplePayToken.php | 405 ++- lib/Model/ApplePayTokenToken.php | 511 ++++ lib/Model/ApplePayTokenTokenHeader.php | 477 ++++ lib/Model/AvailablePaymentMethod.php | 383 +-- lib/Model/BankTransfer.php | 322 ++- lib/Model/BankTransferStatus.php | 71 +- lib/Model/BasePayment.php | 331 ++- lib/Model/CapacityInfo.php | 338 ++- lib/Model/CardDetail.php | 454 ++-- lib/Model/CardIdentifierOrRegister.php | 325 ++- lib/Model/CardPayAmount.php | 313 ++- lib/Model/CardPayStatus.php | 46 +- lib/Model/CardPayStatusStructure.php | 479 ++-- .../CardPayStatusStructureComfortPay.php | 335 ++- lib/Model/CardPayUpdateInstruction.php | 353 ++- lib/Model/ColorAttribute.php | 334 ++- lib/Model/ComfortPay.php | 316 ++- lib/Model/ComfortPayStatus.php | 35 +- lib/Model/DirectTransactionData.php | 452 ++++ ...hp => DirectTransactionDataReasonCode.php} | 311 ++- lib/Model/DirectTransactionIPSPData.php | 389 +-- lib/Model/DirectTransactionStatus.php | 65 + lib/Model/DirectTransactionTDSData.php | 426 ++-- .../DirectTransactionTaskStatusResponse.php | 477 ++++ lib/Model/E2e.php | 350 ++- .../InitiateDirectTransactionRequest.php | 392 +-- .../InitiateDirectTransactionResponse.php | 330 ++- lib/Model/InitiatePaymentRequest.php | 373 +-- lib/Model/InitiatePaymentResponse.php | 334 ++- lib/Model/ItemDetail.php | 330 ++- lib/Model/ItemDetailLangUnit.php | 341 ++- lib/Model/Model400ErrorBody.php | 421 +-- lib/Model/Model40xErrorBody.php | 500 ++++ lib/Model/ModelInterface.php | 59 +- lib/Model/Order.php | 366 +-- lib/Model/OrderItem.php | 359 +-- lib/Model/PayLater.php | 330 ++- lib/Model/PayLaterStatus.php | 70 +- lib/Model/PaymentIntentCancelResponse.php | 316 ++- lib/Model/PaymentIntentStatusResponse.php | 8 +- ... => PaymentIntentStatusResponseStatus.php} | 459 ++-- lib/Model/PaymentIntentUpdateResponse.php | 316 ++- lib/Model/PaymentMethod.php | 0 lib/Model/PaymentMethodRules.php | 8 +- lib/Model/PaymentMethodsListResponse.php | 313 ++- lib/Model/PaymentSymbols.php | 349 ++- lib/Model/Provider.php | 368 +-- lib/Model/QRStatus.php | 2 +- lib/Model/RegisterForComfortPayObj.php | 311 ++- .../SanitizedInvalidArgumentException.php | 15 - lib/Model/SignedCardIdObj.php | 315 ++- lib/Model/Status.php | 36 +- lib/Model/Token.php | 345 +-- lib/Model/TokenSuccessResponseType.php | 12 +- lib/Model/UserData.php | 418 +-- lib/ObjectSerializer.php | 6 +- lib/TatraPayPlusService.php | 68 + openapi_generator_config.json | 7 + tatrapayplus_api_sandbox.json | 2252 +++++++++++++++++ tests/tests.php | 22 +- 72 files changed, 14377 insertions(+), 6283 deletions(-) create mode 100644 .openapi-generator-ignore create mode 100644 README.md create mode 100755 generate_openapi_models.sh mode change 100755 => 100644 lib/Model/AccountReference.php mode change 100755 => 100644 lib/Model/Address.php mode change 100755 => 100644 lib/Model/Amount.php mode change 100755 => 100644 lib/Model/AmountRangeRule.php mode change 100755 => 100644 lib/Model/AppearanceLogoRequest.php mode change 100755 => 100644 lib/Model/AppearanceRequest.php create mode 100644 lib/Model/ApplePayTokenToken.php create mode 100644 lib/Model/ApplePayTokenTokenHeader.php mode change 100755 => 100644 lib/Model/AvailablePaymentMethod.php mode change 100755 => 100644 lib/Model/BankTransfer.php mode change 100755 => 100644 lib/Model/BankTransferStatus.php mode change 100755 => 100644 lib/Model/BasePayment.php mode change 100755 => 100644 lib/Model/CapacityInfo.php mode change 100755 => 100644 lib/Model/CardDetail.php mode change 100755 => 100644 lib/Model/CardIdentifierOrRegister.php mode change 100755 => 100644 lib/Model/CardPayAmount.php mode change 100755 => 100644 lib/Model/CardPayStatus.php mode change 100755 => 100644 lib/Model/CardPayStatusStructure.php mode change 100755 => 100644 lib/Model/CardPayStatusStructureComfortPay.php mode change 100755 => 100644 lib/Model/CardPayUpdateInstruction.php mode change 100755 => 100644 lib/Model/ColorAttribute.php mode change 100755 => 100644 lib/Model/ComfortPay.php mode change 100755 => 100644 lib/Model/ComfortPayStatus.php create mode 100644 lib/Model/DirectTransactionData.php rename lib/Model/{CardPayStatusStructureReasonCode.php => DirectTransactionDataReasonCode.php} (61%) mode change 100755 => 100644 create mode 100644 lib/Model/DirectTransactionStatus.php create mode 100644 lib/Model/DirectTransactionTaskStatusResponse.php mode change 100755 => 100644 lib/Model/E2e.php mode change 100755 => 100644 lib/Model/InitiateDirectTransactionRequest.php mode change 100755 => 100644 lib/Model/InitiateDirectTransactionResponse.php mode change 100755 => 100644 lib/Model/InitiatePaymentRequest.php mode change 100755 => 100644 lib/Model/InitiatePaymentResponse.php mode change 100755 => 100644 lib/Model/ItemDetail.php mode change 100755 => 100644 lib/Model/ItemDetailLangUnit.php mode change 100755 => 100644 lib/Model/Model400ErrorBody.php create mode 100644 lib/Model/Model40xErrorBody.php mode change 100755 => 100644 lib/Model/ModelInterface.php mode change 100755 => 100644 lib/Model/Order.php mode change 100755 => 100644 lib/Model/OrderItem.php mode change 100755 => 100644 lib/Model/PayLater.php mode change 100755 => 100644 lib/Model/PayLaterStatus.php mode change 100755 => 100644 lib/Model/PaymentIntentCancelResponse.php mode change 100755 => 100644 lib/Model/PaymentIntentStatusResponse.php rename lib/Model/{PaymentIntentUpdateResponseStatus.php => PaymentIntentStatusResponseStatus.php} (62%) mode change 100755 => 100644 mode change 100755 => 100644 lib/Model/PaymentIntentUpdateResponse.php mode change 100755 => 100644 lib/Model/PaymentMethod.php mode change 100755 => 100644 lib/Model/PaymentMethodsListResponse.php mode change 100755 => 100644 lib/Model/PaymentSymbols.php mode change 100755 => 100644 lib/Model/Provider.php mode change 100755 => 100644 lib/Model/RegisterForComfortPayObj.php delete mode 100644 lib/Model/SanitizedInvalidArgumentException.php mode change 100755 => 100644 lib/Model/SignedCardIdObj.php mode change 100755 => 100644 lib/Model/Status.php mode change 100755 => 100644 lib/Model/UserData.php create mode 100644 openapi_generator_config.json create mode 100644 tatrapayplus_api_sandbox.json diff --git a/.gitignore b/.gitignore index 9186c28..923f8ec 100755 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ composer.phar # PHPUnit cache .phpunit.result.cache /logs/ -.idea \ No newline at end of file +.idea +/lib/ModelBackup \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..e592e28 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,26 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md + +** +!lib/Model/** \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..39215bb --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# tatrapayplus-php + +[![Release](https://img.shields.io/github/v/release/SmartBase-SK/tatrapayplus-php)](https://img.shields.io/github/v/release/SmartBase-SK/tatrapayplus-php) +[![Build status](https://img.shields.io/github/actions/workflow/status/SmartBase-SK/tatrapayplus-php/php.yml?branch=main)](https://github.com/SmartBase-SK/tatrapayplus-php/actions/workflows/php.yml?query=branch%3Amain) +[![codecov](https://codecov.io/gh/SmartBase-SK/tatrapayplus-php/branch/main/graph/badge.svg)](https://codecov.io/gh/SmartBase-SK/tatrapayplus-php) +[![Commit activity](https://img.shields.io/github/commit-activity/m/SmartBase-SK/tatrapayplus-php)](https://img.shields.io/github/commit-activity/m/SmartBase-SK/tatrapayplus-php) +[![License](https://img.shields.io/github/license/SmartBase-SK/tatrapayplus-php)](https://img.shields.io/github/license/SmartBase-SK/tatrapayplus-php) + +PHP SDK for Tatrapay+ payment gateway. + +- **Github repository**: +- **Documentation** + +## Type generation +To generate new types after OpenAPI structure has been changed please run +``` +./generate_openapi_models.sh +``` +This command will automatically generate models based on `tatrapayplus_api_sandbox.json` file +and preserve custom Model classes.\ +Old models will be backed up in ModelBackup folder. \ No newline at end of file diff --git a/generate_openapi_models.sh b/generate_openapi_models.sh new file mode 100755 index 0000000..7ec5d9e --- /dev/null +++ b/generate_openapi_models.sh @@ -0,0 +1,31 @@ +mkdir tmp-openapi +cp .openapi-generator-ignore ./tmp-openapi + +openapi-generator-cli generate -g php -c openapi_generator_config.json -i ./tatrapayplus_api_sandbox.json -o ./tmp-openapi + +echo "Backing up existing Model files..." +rm -rf ./lib/ModelBackup +cp -R ./lib/Model ./lib/ModelBackup +echo "Backup done" +rm -rf ./lib/Model +echo "Removed existing Model files" + +echo "Copying generated Model files to repo files..." +cp -R ./tmp-openapi/lib/Model ./lib/ +echo "Copying finished" +rm -rf ./tmp-openapi + +echo "Adding custom Model classes from backup..." +cp ./lib/ModelBackup/TokenSuccessResponseType.php ./lib/Model +cp ./lib/ModelBackup/QRStatus.php ./lib/Model +cp ./lib/ModelBackup/PaymentIntentStatusResponse.php ./lib/Model +cp ./lib/ModelBackup/PaymentMethod.php ./lib/Model +cp ./lib/ModelBackup/PaymentMethodRules.php ./lib/Model + +echo "Verify new Model files by running tests -> phpunit --bootstrap vendor/autoload.php tests/tests.php" +echo "Ensure env variables TATRAPAY_CLIENT_ID and TATRAPAY_CLIENT_SECRET are set before running tests" +echo "If successful, remove old Model files backup (dir ./lib/ModelBackup)" + +# to revert back to old Model files +# rm -rf ./lib/Model +# cp -R ./lib/ModelBackup ./lib/Model \ No newline at end of file diff --git a/lib/Api/TatraPayPlusAPIApi.php b/lib/Api/TatraPayPlusAPIApi.php index d8707bd..8bd066e 100755 --- a/lib/Api/TatraPayPlusAPIApi.php +++ b/lib/Api/TatraPayPlusAPIApi.php @@ -2,13 +2,13 @@ namespace Tatrapayplus\TatrapayplusApiClient\Api; +use InvalidArgumentException; use Tatrapayplus\TatrapayplusApiClient\AccessToken; use Tatrapayplus\TatrapayplusApiClient\ApiException; use Tatrapayplus\TatrapayplusApiClient\Configuration; use Tatrapayplus\TatrapayplusApiClient\HeaderSelector; use Tatrapayplus\TatrapayplusApiClient\HttpResponse; use Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod; -use Tatrapayplus\TatrapayplusApiClient\Model\SanitizedInvalidArgumentException; use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; use Tatrapayplus\TatrapayplusApiClient\Request; use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusService; @@ -159,13 +159,13 @@ public function cancelPaymentIntent($payment_id) * * @return Request * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function cancelPaymentIntentRequest($payment_id) { // verify the required parameter 'payment_id' is set if ($payment_id === null || (is_array($payment_id) && count($payment_id) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $payment_id when calling cancelPaymentIntent'); + throw new InvalidArgumentException('Missing the required parameter $payment_id when calling cancelPaymentIntent'); } $resourcePath = '/v1/payments/{payment-id}'; @@ -383,7 +383,7 @@ public function getAvailableMethods( * * @return array of \Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethodsListResponse|\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody, HTTP status code, HTTP response headers (array of strings) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException * @throws ApiException on non-2xx response or if the response body is not in the expected format */ public function getMethods() @@ -398,7 +398,7 @@ public function getMethods() * * @return Request * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function getMethodsRequest() { @@ -434,16 +434,19 @@ public function getMethodsRequest() * * @param string $payment_id payment intent identifier (required) * - * @return array of \Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponse|\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody, HTTP status code, HTTP response headers (array of strings) + * @return array of simple_status and \Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponse|\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody, HTTP status code, HTTP response headers (array of strings) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException * @throws ApiException on non-2xx response or if the response body is not in the expected format */ public function getPaymentIntentStatus($payment_id) { $request = $this->getPaymentIntentStatusRequest($payment_id); - return $this->processRequest($request, '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponse', '\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody'); + $response = $this->processRequest($request, '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponse', '\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody'); + $simple_status = TatraPayPlusService::map_simple_status($response); + + return [$simple_status, $response]; } /** @@ -453,13 +456,13 @@ public function getPaymentIntentStatus($payment_id) * * @return Request * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function getPaymentIntentStatusRequest($payment_id) { // verify the required parameter 'payment_id' is set if ($payment_id === null || (is_array($payment_id) && count($payment_id) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $payment_id when calling getPaymentIntentStatus'); + throw new InvalidArgumentException('Missing the required parameter $payment_id when calling getPaymentIntentStatus'); } $resourcePath = '/v1/payments/{payment-id}/status'; @@ -514,7 +517,7 @@ public function getPaymentIntentStatusRequest($payment_id) * * @return array of \Tatrapayplus\TatrapayplusApiClient\Model\InitiatePaymentResponse|\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody, HTTP status code, HTTP response headers (array of strings) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException * @throws ApiException on non-2xx response or if the response body is not in the expected format */ public function initiatePayment($redirect_uri, $initiate_payment_request, $preferred_method = null, $accept_language = 'sk') @@ -534,18 +537,18 @@ public function initiatePayment($redirect_uri, $initiate_payment_request, $prefe * * @return Request * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function initiatePaymentRequest($redirect_uri, $initiate_payment_request, $preferred_method = null, $accept_language = 'sk') { // verify the required parameter 'redirect_uri' is set if ($redirect_uri === null || (is_array($redirect_uri) && count($redirect_uri) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $redirect_uri when calling initiatePayment'); + throw new InvalidArgumentException('Missing the required parameter $redirect_uri when calling initiatePayment'); } // verify the required parameter 'initiate_payment_request' is set if ($initiate_payment_request === null || (is_array($initiate_payment_request) && count($initiate_payment_request) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $initiate_payment_request when calling initiatePayment'); + throw new InvalidArgumentException('Missing the required parameter $initiate_payment_request when calling initiatePayment'); } $resourcePath = '/v1/payments'; @@ -571,6 +574,8 @@ public function initiatePaymentRequest($redirect_uri, $initiate_payment_request, false ); + $initiate_payment_request = TatraPayPlusService::remove_card_holder_diacritics($initiate_payment_request); + $httpBody = static::json_encode(ObjectSerializer::sanitizeForSerialization($initiate_payment_request)); $httpBody = str_replace('\\\\n', '\\n', $httpBody); // this endpoint requires OAuth (access token) @@ -605,7 +610,7 @@ public function initiatePaymentRequest($redirect_uri, $initiate_payment_request, * * @return array of \Tatrapayplus\TatrapayplusApiClient\Model\InitiatePaymentResponse|\Tatrapayplus\TatrapayplusApiClient\Model\Model400ErrorBody, HTTP status code, HTTP response headers (array of strings) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException * @throws ApiException on non-2xx response or if the response body is not in the expected format */ public function initiateDirectTransaction($redirect_uri, $initiate_transaction_request) @@ -623,18 +628,18 @@ public function initiateDirectTransaction($redirect_uri, $initiate_transaction_r * * @return Request * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function initiateDirectTransactionRequest($redirect_uri, $initiate_transaction_request) { // verify the required parameter 'redirect_uri' is set if ($redirect_uri === null || (is_array($redirect_uri) && count($redirect_uri) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $redirect_uri when calling initiateDirectTransactionRequest'); + throw new InvalidArgumentException('Missing the required parameter $redirect_uri when calling initiateDirectTransactionRequest'); } // verify the required parameter 'initiate_payment_request' is set if ($initiate_transaction_request === null || (is_array($initiate_transaction_request) && count($initiate_transaction_request) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $initiate_transaction_request when calling initiateDirectTransactionRequest'); + throw new InvalidArgumentException('Missing the required parameter $initiate_transaction_request when calling initiateDirectTransactionRequest'); } $resourcePath = '/v1/payments-direct'; @@ -652,6 +657,7 @@ public function initiateDirectTransactionRequest($redirect_uri, $initiate_transa false ); + $initiate_transaction_request = TatraPayPlusService::remove_card_holder_diacritics($initiate_transaction_request); $httpBody = static::json_encode(ObjectSerializer::sanitizeForSerialization($initiate_transaction_request)); $httpBody = str_replace('\\\\n', '\\n', $httpBody); // this endpoint requires OAuth (access token) @@ -706,7 +712,7 @@ public static function json_encode(...$args) * * @return array of null, HTTP status code, HTTP response headers (array of strings) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException * @throws ApiException on non-2xx response or if the response body is not in the expected format */ public function updatePaymentIntent($payment_id, $body) @@ -724,18 +730,18 @@ public function updatePaymentIntent($payment_id, $body) * * @return Request * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function updatePaymentIntentRequest($payment_id, $body) { // verify the required parameter 'payment_id' is set if ($payment_id === null || (is_array($payment_id) && count($payment_id) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $payment_id when calling updatePaymentIntent'); + throw new InvalidArgumentException('Missing the required parameter $payment_id when calling updatePaymentIntent'); } // verify the required parameter 'body' is set if ($body === null || (is_array($body) && count($body) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $body when calling updatePaymentIntent'); + throw new InvalidArgumentException('Missing the required parameter $body when calling updatePaymentIntent'); } $resourcePath = '/v1/payments/{payment-id}'; @@ -791,22 +797,22 @@ public function tokenRequest($grant_type, $client_id, $client_secret, $scope) { // verify the required parameter '$grant_type' is set if ($grant_type === null || (is_array($grant_type) && count($grant_type) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $grant_type when calling tokenRequest'); + throw new InvalidArgumentException('Missing the required parameter $grant_type when calling tokenRequest'); } // verify the required parameter '$client_id' is set if ($client_id === null || (is_array($client_id) && count($client_id) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $client_id when calling tokenRequest'); + throw new InvalidArgumentException('Missing the required parameter $client_id when calling tokenRequest'); } // verify the required parameter '$client_secret' is set if ($client_secret === null || (is_array($client_secret) && count($client_secret) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $client_secret when calling tokenRequest'); + throw new InvalidArgumentException('Missing the required parameter $client_secret when calling tokenRequest'); } // verify the required parameter '$scope' is set if ($scope === null || (is_array($scope) && count($scope) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $scope when calling tokenRequest'); + throw new InvalidArgumentException('Missing the required parameter $scope when calling tokenRequest'); } $resourcePath = '/auth/oauth/v2/token'; @@ -850,7 +856,7 @@ public function tokenRequest($grant_type, $client_id, $client_secret, $scope) * * @return array of null, HTTP status code, HTTP response headers (array of strings) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException * @throws ApiException on non-2xx response or if the response body is not in the expected format */ public function setAppearance($appearance_request) @@ -867,13 +873,13 @@ public function setAppearance($appearance_request) * * @return Request * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function setAppearanceRequest($appearance_request) { // verify the required parameter 'appearance_request' is set if ($appearance_request === null || (is_array($appearance_request) && count($appearance_request) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $appearance_request when calling setAppearance'); + throw new InvalidArgumentException('Missing the required parameter $appearance_request when calling setAppearance'); } $resourcePath = '/v1/appearances'; @@ -915,7 +921,7 @@ public function setAppearanceRequest($appearance_request) * * @return array of null, HTTP status code, HTTP response headers (array of strings) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException * @throws ApiException on non-2xx response or if the response body is not in the expected format */ public function setLogo($appearance_logo_request) @@ -930,13 +936,13 @@ public function setLogo($appearance_logo_request) * * @param \Tatrapayplus\TatrapayplusApiClient\Model\AppearanceLogoRequest $appearance_logo_request (required) * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function setLogoRequest($appearance_logo_request) { // verify the required parameter 'appearance_logo_request' is set if ($appearance_logo_request === null || (is_array($appearance_logo_request) && count($appearance_logo_request) === 0)) { - throw new SanitizedInvalidArgumentException('Missing the required parameter $appearance_logo_request when calling setLogo'); + throw new InvalidArgumentException('Missing the required parameter $appearance_logo_request when calling setLogo'); } $resourcePath = '/v1/appearances/logo'; diff --git a/lib/Configuration.php b/lib/Configuration.php index 4b5cb07..da22e9a 100755 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -8,7 +8,8 @@ namespace Tatrapayplus\TatrapayplusApiClient; -use Tatrapayplus\TatrapayplusApiClient\Model\SanitizedInvalidArgumentException; + +use InvalidArgumentException; class Configuration { @@ -138,7 +139,7 @@ public static function getHostString(array $hostSettings, $hostIndex, ?array $va // check array index out of bound if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { - throw new SanitizedInvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than " . count($hostSettings)); + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than " . count($hostSettings)); } $host = $hostSettings[$hostIndex]; @@ -150,7 +151,7 @@ public static function getHostString(array $hostSettings, $hostIndex, ?array $va if (!isset($variable['enum_values']) || in_array($variables[$name], $variable['enum_values'], true)) { // check to see if the value is in the enum $url = str_replace('{' . $name . '}', $variables[$name], $url); } else { - throw new SanitizedInvalidArgumentException("The variable `$name` in the host URL has invalid value " . $variables[$name] . '. Must be ' . join(',', $variable['enum_values']) . '.'); + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value " . $variables[$name] . '. Must be ' . join(',', $variable['enum_values']) . '.'); } } else { // use default value @@ -397,12 +398,12 @@ public function getUserAgent() * * @return $this * - * @throws SanitizedInvalidArgumentException + * @throws InvalidArgumentException */ public function setUserAgent($userAgent) { if (!is_string($userAgent)) { - throw new SanitizedInvalidArgumentException('User-agent must be a string.'); + throw new InvalidArgumentException('User-agent must be a string.'); } $this->userAgent = $userAgent; diff --git a/lib/Model/AccountReference.php b/lib/Model/AccountReference.php old mode 100755 new mode 100644 index 5269f96..13f82ef --- a/lib/Model/AccountReference.php +++ b/lib/Model/AccountReference.php @@ -2,128 +2,146 @@ /** * AccountReference * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class AccountReference implements ModelInterface, \ArrayAccess +/** + * AccountReference Class Doc Comment + * + * @category Class + * @description Reference to an account by IBAN, of a payment accounts + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AccountReference implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'accountReference'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'iban' => 'string', + 'iban' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'iban' => null, + 'iban' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'iban' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'iban' => 'iban', + 'iban' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'iban' => 'setIban', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'iban' => 'getIban', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('iban', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -132,34 +150,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'iban' => 'iban' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'iban' => 'setIban' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'iban' => 'getIban' + ]; /** * Array of attributes where the key is the local name, @@ -193,46 +220,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('iban', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -244,13 +275,25 @@ public function listInvalidProperties() { $invalidProperties = []; - if (!is_null($this->container['iban']) && !preg_match('/[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}/', $this->container['iban'])) { + if (!is_null($this->container['iban']) && !preg_match("/[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}/", $this->container['iban'])) { $invalidProperties[] = "invalid value for 'iban', must be conform to the pattern /[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}/."; } return $invalidProperties; } + /** + * 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 iban * @@ -264,31 +307,30 @@ public function getIban() /** * Sets iban * - * @param string|null $iban IBAN of an account + * @param string|null $iban IBAN of an account. * * @return self */ public function setIban($iban) { if (is_null($iban)) { - throw new SanitizedInvalidArgumentException('non-nullable iban cannot be null'); + throw new \InvalidArgumentException('non-nullable iban cannot be null'); } - if (!preg_match('/[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}/', ObjectSerializer::toString($iban))) { - throw new SanitizedInvalidArgumentException('invalid value for $iban when calling AccountReference., must conform to the pattern /[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}/.'); + if ((!preg_match("/[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}/", ObjectSerializer::toString($iban)))) { + throw new \InvalidArgumentException("invalid value for \$iban when calling AccountReference., must conform to the pattern /[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}/."); } $this->container['iban'] = $iban; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -298,7 +340,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -312,7 +354,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -328,7 +370,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -338,12 +380,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/Address.php b/lib/Model/Address.php old mode 100755 new mode 100644 index 38608c1..1497be8 --- a/lib/Model/Address.php +++ b/lib/Model/Address.php @@ -2,156 +2,157 @@ /** * Address * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class Address implements ModelInterface, \ArrayAccess +/** + * Address Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class Address implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'address'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'street_name' => 'string', 'building_number' => 'string', 'town_name' => 'string', 'post_code' => 'string', - 'country' => 'string', + 'country' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'street_name' => null, 'building_number' => null, 'town_name' => null, 'post_code' => null, - 'country' => null, + 'country' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'street_name' => false, 'building_number' => false, 'town_name' => false, 'post_code' => false, - 'country' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'street_name' => 'streetName', - 'building_number' => 'buildingNumber', - 'town_name' => 'townName', - 'post_code' => 'postCode', - 'country' => 'country', + 'country' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'street_name' => 'setStreetName', - 'building_number' => 'setBuildingNumber', - 'town_name' => 'setTownName', - 'post_code' => 'setPostCode', - 'country' => 'setCountry', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'street_name' => 'getStreetName', - 'building_number' => 'getBuildingNumber', - 'town_name' => 'getTownName', - 'post_code' => 'getPostCode', - 'country' => 'getCountry', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('street_name', $data ?? [], null); - $this->setIfExists('building_number', $data ?? [], null); - $this->setIfExists('town_name', $data ?? [], null); - $this->setIfExists('post_code', $data ?? [], null); - $this->setIfExists('country', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -160,34 +161,55 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'street_name' => 'streetName', + 'building_number' => 'buildingNumber', + 'town_name' => 'townName', + 'post_code' => 'postCode', + 'country' => 'country' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'street_name' => 'setStreetName', + 'building_number' => 'setBuildingNumber', + 'town_name' => 'setTownName', + 'post_code' => 'setPostCode', + 'country' => 'setCountry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'street_name' => 'getStreetName', + 'building_number' => 'getBuildingNumber', + 'town_name' => 'getTownName', + 'post_code' => 'getPostCode', + 'country' => 'getCountry' + ]; /** * Array of attributes where the key is the local name, @@ -221,46 +243,54 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('street_name', $data ?? [], null); + $this->setIfExists('building_number', $data ?? [], null); + $this->setIfExists('town_name', $data ?? [], null); + $this->setIfExists('post_code', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -291,13 +321,25 @@ public function listInvalidProperties() if ($this->container['country'] === null) { $invalidProperties[] = "'country' can't be null"; } - if (!preg_match('/[A-Z]{2}/', $this->container['country'])) { + if (!preg_match("/[A-Z]{2}/", $this->container['country'])) { $invalidProperties[] = "invalid value for 'country', must be conform to the pattern /[A-Z]{2}/."; } return $invalidProperties; } + /** + * 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 street_name * @@ -318,10 +360,10 @@ public function getStreetName() public function setStreetName($street_name) { if (is_null($street_name)) { - throw new SanitizedInvalidArgumentException('non-nullable street_name cannot be null'); + throw new \InvalidArgumentException('non-nullable street_name cannot be null'); } - if (mb_strlen($street_name) > 40) { - throw new SanitizedInvalidArgumentException('invalid length for $street_name when calling Address., must be smaller than or equal to 40.'); + if ((mb_strlen($street_name) > 40)) { + throw new \InvalidArgumentException('invalid length for $street_name when calling Address., must be smaller than or equal to 40.'); } $this->container['street_name'] = $street_name; @@ -349,10 +391,10 @@ public function getBuildingNumber() public function setBuildingNumber($building_number) { if (is_null($building_number)) { - throw new SanitizedInvalidArgumentException('non-nullable building_number cannot be null'); + throw new \InvalidArgumentException('non-nullable building_number cannot be null'); } - if (mb_strlen($building_number) > 10) { - throw new SanitizedInvalidArgumentException('invalid length for $building_number when calling Address., must be smaller than or equal to 10.'); + if ((mb_strlen($building_number) > 10)) { + throw new \InvalidArgumentException('invalid length for $building_number when calling Address., must be smaller than or equal to 10.'); } $this->container['building_number'] = $building_number; @@ -380,10 +422,10 @@ public function getTownName() public function setTownName($town_name) { if (is_null($town_name)) { - throw new SanitizedInvalidArgumentException('non-nullable town_name cannot be null'); + throw new \InvalidArgumentException('non-nullable town_name cannot be null'); } - if (mb_strlen($town_name) > 35) { - throw new SanitizedInvalidArgumentException('invalid length for $town_name when calling Address., must be smaller than or equal to 35.'); + if ((mb_strlen($town_name) > 35)) { + throw new \InvalidArgumentException('invalid length for $town_name when calling Address., must be smaller than or equal to 35.'); } $this->container['town_name'] = $town_name; @@ -411,10 +453,10 @@ public function getPostCode() public function setPostCode($post_code) { if (is_null($post_code)) { - throw new SanitizedInvalidArgumentException('non-nullable post_code cannot be null'); + throw new \InvalidArgumentException('non-nullable post_code cannot be null'); } - if (mb_strlen($post_code) > 10) { - throw new SanitizedInvalidArgumentException('invalid length for $post_code when calling Address., must be smaller than or equal to 10.'); + if ((mb_strlen($post_code) > 10)) { + throw new \InvalidArgumentException('invalid length for $post_code when calling Address., must be smaller than or equal to 10.'); } $this->container['post_code'] = $post_code; @@ -435,31 +477,30 @@ public function getCountry() /** * Sets country * - * @param string $country ISO 3166 ALPHA2 country code + * @param string $country ISO 3166 ALPHA2 country code. * * @return self */ public function setCountry($country) { if (is_null($country)) { - throw new SanitizedInvalidArgumentException('non-nullable country cannot be null'); + throw new \InvalidArgumentException('non-nullable country cannot be null'); } - if (!preg_match('/[A-Z]{2}/', ObjectSerializer::toString($country))) { - throw new SanitizedInvalidArgumentException('invalid value for $country when calling Address., must conform to the pattern /[A-Z]{2}/.'); + if ((!preg_match("/[A-Z]{2}/", ObjectSerializer::toString($country)))) { + throw new \InvalidArgumentException("invalid value for \$country when calling Address., must conform to the pattern /[A-Z]{2}/."); } $this->container['country'] = $country; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -469,7 +510,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -483,7 +524,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -499,7 +540,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -509,12 +550,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/Amount.php b/lib/Model/Amount.php old mode 100755 new mode 100644 index 2848414..97d6a4c --- a/lib/Model/Amount.php +++ b/lib/Model/Amount.php @@ -2,135 +2,148 @@ /** * Amount * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class Amount implements ModelInterface, \ArrayAccess +/** + * Amount Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class Amount implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'amount'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'amount_value' => 'float', - 'currency' => 'string', + 'currency' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'amount_value' => null, - 'currency' => null, + 'currency' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'amount_value' => false, - 'currency' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'amount_value' => 'amountValue', - 'currency' => 'currency', + 'currency' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'amount_value' => 'setAmountValue', - 'currency' => 'setCurrency', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'amount_value' => 'getAmountValue', - 'currency' => 'getCurrency', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('amount_value', $data ?? [], null); - $this->setIfExists('currency', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -139,34 +152,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'amount_value' => 'amountValue', + 'currency' => 'currency' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'amount_value' => 'setAmountValue', + 'currency' => 'setCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount_value' => 'getAmountValue', + 'currency' => 'getCurrency' + ]; /** * Array of attributes where the key is the local name, @@ -200,46 +225,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('amount_value', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -257,13 +287,25 @@ public function listInvalidProperties() if ($this->container['currency'] === null) { $invalidProperties[] = "'currency' can't be null"; } - if (!preg_match('/[A-Z]{3}/', $this->container['currency'])) { + if (!preg_match("/[A-Z]{3}/", $this->container['currency'])) { $invalidProperties[] = "invalid value for 'currency', must be conform to the pattern /[A-Z]{3}/."; } return $invalidProperties; } + /** + * 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 amount_value * @@ -284,9 +326,10 @@ public function getAmountValue() public function setAmountValue($amount_value) { if (is_null($amount_value)) { - throw new SanitizedInvalidArgumentException('non-nullable amount_value cannot be null'); + throw new \InvalidArgumentException('non-nullable amount_value cannot be null'); } + $this->container['amount_value'] = $amount_value; return $this; @@ -305,31 +348,30 @@ public function getCurrency() /** * Sets currency * - * @param string $currency ISO 4217 Alpha 3 currency code + * @param string $currency ISO 4217 Alpha 3 currency code. * * @return self */ public function setCurrency($currency) { if (is_null($currency)) { - throw new SanitizedInvalidArgumentException('non-nullable currency cannot be null'); + throw new \InvalidArgumentException('non-nullable currency cannot be null'); } - if (!preg_match('/[A-Z]{3}/', ObjectSerializer::toString($currency))) { - throw new SanitizedInvalidArgumentException('invalid value for $currency when calling Amount., must conform to the pattern /[A-Z]{3}/.'); + if ((!preg_match("/[A-Z]{3}/", ObjectSerializer::toString($currency)))) { + throw new \InvalidArgumentException("invalid value for \$currency when calling Amount., must conform to the pattern /[A-Z]{3}/."); } $this->container['currency'] = $currency; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -339,7 +381,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -353,7 +395,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -369,7 +411,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -379,12 +421,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/AmountRangeRule.php b/lib/Model/AmountRangeRule.php old mode 100755 new mode 100644 index fc21638..872b7d1 --- a/lib/Model/AmountRangeRule.php +++ b/lib/Model/AmountRangeRule.php @@ -2,133 +2,149 @@ /** * AmountRangeRule * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class AmountRangeRule implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * AmountRangeRule Class Doc Comment + * + * @category Class + * @description Range of amounts allowed for a given payment method + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AmountRangeRule implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'amountRangeRule'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'min_amount' => 'float', - 'max_amount' => 'float', + 'max_amount' => 'float' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'min_amount' => null, - 'max_amount' => null, + 'max_amount' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'min_amount' => false, - 'max_amount' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'min_amount' => 'minAmount', - 'max_amount' => 'maxAmount', + 'max_amount' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'min_amount' => 'setMinAmount', - 'max_amount' => 'setMaxAmount', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'min_amount' => 'getMinAmount', - 'max_amount' => 'getMaxAmount', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('min_amount', $data ?? [], null); - $this->setIfExists('max_amount', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +153,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'min_amount' => 'minAmount', + 'max_amount' => 'maxAmount' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +226,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('min_amount', $data ?? [], null); + $this->setIfExists('max_amount', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -252,6 +285,18 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 min_amount * @@ -272,7 +317,7 @@ public function getMinAmount() public function setMinAmount($min_amount) { if (is_null($min_amount)) { - throw new SanitizedInvalidArgumentException('non-nullable min_amount cannot be null'); + throw new \InvalidArgumentException('non-nullable min_amount cannot be null'); } $this->container['min_amount'] = $min_amount; @@ -299,19 +344,18 @@ public function getMaxAmount() public function setMaxAmount($max_amount) { if (is_null($max_amount)) { - throw new SanitizedInvalidArgumentException('non-nullable max_amount cannot be null'); + throw new \InvalidArgumentException('non-nullable max_amount cannot be null'); } $this->container['max_amount'] = $max_amount; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -321,7 +365,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -335,7 +379,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -351,7 +395,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -361,12 +405,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/AppearanceLogoRequest.php b/lib/Model/AppearanceLogoRequest.php old mode 100755 new mode 100644 index 24d6058..0e7524a --- a/lib/Model/AppearanceLogoRequest.php +++ b/lib/Model/AppearanceLogoRequest.php @@ -2,126 +2,146 @@ /** * AppearanceLogoRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class AppearanceLogoRequest implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * AppearanceLogoRequest Class Doc Comment + * + * @category Class + * @description The logo image. + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AppearanceLogoRequest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'appearanceLogoRequest'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'logo_image' => 'string', + 'logo_image' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'logo_image' => 'byte', + 'logo_image' => 'byte' ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'logo_image' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'logo_image' => 'logoImage', + 'logo_image' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'logo_image' => 'setLogoImage', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'logo_image' => 'getLogoImage', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('logo_image', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +150,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'logo_image' => 'logoImage' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'logo_image' => 'setLogoImage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'logo_image' => 'getLogoImage' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +220,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('logo_image', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -245,13 +278,25 @@ public function listInvalidProperties() if ($this->container['logo_image'] === null) { $invalidProperties[] = "'logo_image' can't be null"; } - if (mb_strlen($this->container['logo_image']) > 1000000) { + if ((mb_strlen($this->container['logo_image']) > 1000000)) { $invalidProperties[] = "invalid value for 'logo_image', the character length must be smaller than or equal to 1000000."; } return $invalidProperties; } + /** + * 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 logo_image * @@ -272,23 +317,22 @@ public function getLogoImage() public function setLogoImage($logo_image) { if (is_null($logo_image)) { - throw new SanitizedInvalidArgumentException('non-nullable logo_image cannot be null'); + throw new \InvalidArgumentException('non-nullable logo_image cannot be null'); } - if (mb_strlen($logo_image) > 1000000) { - throw new SanitizedInvalidArgumentException('invalid length for $logo_image when calling AppearanceLogoRequest., must be smaller than or equal to 1000000.'); + if ((mb_strlen($logo_image) > 1000000)) { + throw new \InvalidArgumentException('invalid length for $logo_image when calling AppearanceLogoRequest., must be smaller than or equal to 1000000.'); } $this->container['logo_image'] = $logo_image; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -298,7 +342,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -312,7 +356,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -328,7 +372,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -338,12 +382,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/AppearanceRequest.php b/lib/Model/AppearanceRequest.php old mode 100755 new mode 100644 index 786e958..6dad8f7 --- a/lib/Model/AppearanceRequest.php +++ b/lib/Model/AppearanceRequest.php @@ -2,146 +2,155 @@ /** * AppearanceRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class AppearanceRequest implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * AppearanceRequest Class Doc Comment + * + * @category Class + * @description Attributes that can be customised + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AppearanceRequest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const THEME_DARK = 'DARK'; - public const THEME_LIGHT = 'LIGHT'; - public const THEME_SYSTEM = 'SYSTEM'; + /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'appearanceRequest'; + /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'theme' => 'string', 'tint_on_accent' => '\Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute', 'tint_accent' => '\Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute', - 'surface_accent' => '\Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute', + 'surface_accent' => '\Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute' ]; + /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'theme' => null, 'tint_on_accent' => null, 'tint_accent' => null, - 'surface_accent' => null, + 'surface_accent' => null ]; + /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'theme' => false, 'tint_on_accent' => false, 'tint_accent' => false, - 'surface_accent' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'theme' => 'theme', - 'tint_on_accent' => 'tintOnAccent', - 'tint_accent' => 'tintAccent', - 'surface_accent' => 'surfaceAccent', + 'surface_accent' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'theme' => 'setTheme', - 'tint_on_accent' => 'setTintOnAccent', - 'tint_accent' => 'setTintAccent', - 'surface_accent' => 'setSurfaceAccent', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'theme' => 'getTheme', - 'tint_on_accent' => 'getTintOnAccent', - 'tint_accent' => 'getTintAccent', - 'surface_accent' => 'getSurfaceAccent', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('theme', $data ?? [], 'SYSTEM'); - $this->setIfExists('tint_on_accent', $data ?? [], null); - $this->setIfExists('tint_accent', $data ?? [], null); - $this->setIfExists('surface_accent', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -150,34 +159,52 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'theme' => 'theme', + 'tint_on_accent' => 'tintOnAccent', + 'tint_accent' => 'tintAccent', + 'surface_accent' => 'surfaceAccent' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'theme' => 'setTheme', + 'tint_on_accent' => 'setTintOnAccent', + 'tint_accent' => 'setTintAccent', + 'surface_accent' => 'setSurfaceAccent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'theme' => 'getTheme', + 'tint_on_accent' => 'getTintOnAccent', + 'tint_accent' => 'getTintAccent', + 'surface_accent' => 'getSurfaceAccent' + ]; /** * Array of attributes where the key is the local name, @@ -211,46 +238,70 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + public const THEME_DARK = 'DARK'; + public const THEME_LIGHT = 'LIGHT'; + public const THEME_SYSTEM = 'SYSTEM'; + /** - * Array of nullable field names deliberately set to null + * Gets allowable values of the enum * - * @return bool[] + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array + public function getThemeAllowableValues() { - return $this->openAPINullablesSetToNull; + return [ + self::THEME_DARK, + self::THEME_LIGHT, + self::THEME_SYSTEM, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() - { - return self::$openAPIModelName; - } + protected $container = []; /** - * Validate all the properties in the model - * return true if all passed + * Constructor * - * @return bool True if all properties are valid + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function valid() + public function __construct(?array $data = null) { - return count($this->listInvalidProperties()) === 0; + $this->setIfExists('theme', $data ?? [], 'SYSTEM'); + $this->setIfExists('tint_on_accent', $data ?? [], null); + $this->setIfExists('tint_accent', $data ?? [], null); + $this->setIfExists('surface_accent', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -275,19 +326,17 @@ public function listInvalidProperties() } /** - * Gets allowable values of the enum + * Validate all the properties in the model + * return true if all passed * - * @return string[] + * @return bool True if all properties are valid */ - public function getThemeAllowableValues() + public function valid() { - return [ - self::THEME_DARK, - self::THEME_LIGHT, - self::THEME_SYSTEM, - ]; + return count($this->listInvalidProperties()) === 0; } + /** * Gets theme * @@ -308,11 +357,17 @@ public function getTheme() public function setTheme($theme) { if (is_null($theme)) { - throw new SanitizedInvalidArgumentException('non-nullable theme cannot be null'); + throw new \InvalidArgumentException('non-nullable theme cannot be null'); } $allowedValues = $this->getThemeAllowableValues(); if (!in_array($theme, $allowedValues, true)) { - throw new SanitizedInvalidArgumentException(sprintf("Invalid value '%s' for 'theme', must be one of '%s'", $theme, implode("', '", $allowedValues))); + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'theme', must be one of '%s'", + $theme, + implode("', '", $allowedValues) + ) + ); } $this->container['theme'] = $theme; @@ -322,7 +377,7 @@ public function setTheme($theme) /** * Gets tint_on_accent * - * @return ColorAttribute|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute|null */ public function getTintOnAccent() { @@ -332,14 +387,14 @@ public function getTintOnAccent() /** * Sets tint_on_accent * - * @param ColorAttribute|null $tint_on_accent tint_on_accent + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute|null $tint_on_accent tint_on_accent * * @return self */ public function setTintOnAccent($tint_on_accent) { if (is_null($tint_on_accent)) { - throw new SanitizedInvalidArgumentException('non-nullable tint_on_accent cannot be null'); + throw new \InvalidArgumentException('non-nullable tint_on_accent cannot be null'); } $this->container['tint_on_accent'] = $tint_on_accent; @@ -349,7 +404,7 @@ public function setTintOnAccent($tint_on_accent) /** * Gets tint_accent * - * @return ColorAttribute|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute|null */ public function getTintAccent() { @@ -359,14 +414,14 @@ public function getTintAccent() /** * Sets tint_accent * - * @param ColorAttribute|null $tint_accent tint_accent + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute|null $tint_accent tint_accent * * @return self */ public function setTintAccent($tint_accent) { if (is_null($tint_accent)) { - throw new SanitizedInvalidArgumentException('non-nullable tint_accent cannot be null'); + throw new \InvalidArgumentException('non-nullable tint_accent cannot be null'); } $this->container['tint_accent'] = $tint_accent; @@ -376,7 +431,7 @@ public function setTintAccent($tint_accent) /** * Gets surface_accent * - * @return ColorAttribute|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute|null */ public function getSurfaceAccent() { @@ -386,26 +441,25 @@ public function getSurfaceAccent() /** * Sets surface_accent * - * @param ColorAttribute|null $surface_accent surface_accent + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ColorAttribute|null $surface_accent surface_accent * * @return self */ public function setSurfaceAccent($surface_accent) { if (is_null($surface_accent)) { - throw new SanitizedInvalidArgumentException('non-nullable surface_accent cannot be null'); + throw new \InvalidArgumentException('non-nullable surface_accent cannot be null'); } $this->container['surface_accent'] = $surface_accent; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -415,7 +469,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -429,7 +483,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -445,7 +499,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -455,12 +509,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/ApplePayToken.php b/lib/Model/ApplePayToken.php index d8c3382..443c9a9 100644 --- a/lib/Model/ApplePayToken.php +++ b/lib/Model/ApplePayToken.php @@ -2,147 +2,145 @@ /** * ApplePayToken * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class ApplePayToken implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * ApplePayToken Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class ApplePayToken implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'applePayToken'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'header' => 'array', - 'data' => 'string', - 'signature' => 'string', - 'version' => 'string', + 'token' => '\Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenToken' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'header' => null, - 'data' => null, - 'signature' => null, - 'version' => null, + 'token' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'header' => true, - 'data' => true, - 'signature' => true, - 'version' => true, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'header' => 'header', - 'data' => 'data', - 'signature' => 'signature', - 'version' => 'version', + 'token' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'header' => 'setHeader', - 'data' => 'setData', - 'signature' => 'setSignature', - 'version' => 'setVersion', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'header' => 'getHeader', - 'data' => 'getData', - 'signature' => 'getSignature', - 'version' => 'getVersion', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('header', $data ?? [], null); - $this->setIfExists('data', $data ?? [], null); - $this->setIfExists('signature', $data ?? [], null); - $this->setIfExists('version', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -151,34 +149,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'token' => 'token' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'token' => 'setToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'token' => 'getToken' + ]; /** * Array of attributes where the key is the local name, @@ -211,28 +218,6 @@ public static function getters() return self::$getters; } - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of nullable field names deliberately set to null - * - * @return bool[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - /** * The original name of the model. * @@ -243,131 +228,99 @@ public function getModelName() return self::$openAPIModelName; } - /** - * 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; - } /** - * Show all the invalid properties with reasons. + * Associative array for storing property values * - * @return array invalid properties with reasons + * @var mixed[] */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } + protected $container = []; /** - * Gets header + * Constructor * - * @return array + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getHeader() + public function __construct(?array $data = null) { - return $this->container['header']; + $this->setIfExists('token', $data ?? [], null); } /** - * Sets header - * - * @param array $header header - * - * @return self - */ - public function setHeader($header) + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - $this->container['header'] = $header; - - return $this; - } + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - /** - * Gets data - * - * @return string - */ - public function getData() - { - return $this->container['data']; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** - * Sets data - * - * @param string $data data + * Show all the invalid properties with reasons. * - * @return self + * @return array invalid properties with reasons */ - public function setData($data) + public function listInvalidProperties() { - $this->container['data'] = $data; + $invalidProperties = []; - return $this; + return $invalidProperties; } /** - * Gets signature + * Validate all the properties in the model + * return true if all passed * - * @return string + * @return bool True if all properties are valid */ - public function getSignature() + public function valid() { - return $this->container['signature']; + return count($this->listInvalidProperties()) === 0; } - /** - * Sets signature - * - * @param string $signature signature - * - * @return self - */ - public function setSignature($signature) - { - $this->container['signature'] = $signature; - - return $this; - } /** - * Gets version + * Gets token * - * @return string + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenToken|null */ - public function getVersion() + public function getToken() { - return $this->container['version']; + return $this->container['token']; } /** - * Sets version + * Sets token * - * @param string $version version + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenToken|null $token token * * @return self */ - public function setVersion($version) + public function setToken($token) { - $this->container['version'] = $version; + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -377,7 +330,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -391,7 +344,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -407,7 +360,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -417,12 +370,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/ApplePayTokenToken.php b/lib/Model/ApplePayTokenToken.php new file mode 100644 index 0000000..96319cd --- /dev/null +++ b/lib/Model/ApplePayTokenToken.php @@ -0,0 +1,511 @@ + + */ +class ApplePayTokenToken implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'applePayToken_token'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'header' => '\Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenTokenHeader', + 'data' => 'string', + 'signature' => 'string', + 'version' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'header' => null, + 'data' => null, + 'signature' => null, + 'version' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'header' => false, + 'data' => false, + 'signature' => false, + 'version' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'header' => 'header', + 'data' => 'data', + 'signature' => 'signature', + 'version' => 'version' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'header' => 'setHeader', + 'data' => 'setData', + 'signature' => 'setSignature', + 'version' => 'setVersion' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'header' => 'getHeader', + 'data' => 'getData', + 'signature' => 'getSignature', + 'version' => 'getVersion' + ]; + + /** + * 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::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('signature', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * 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 header + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenTokenHeader|null + */ + public function getHeader() + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenTokenHeader|null $header header + * + * @return self + */ + public function setHeader($header) + { + if (is_null($header)) { + throw new \InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets data + * + * @return string|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param string|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets signature + * + * @return string|null + */ + public function getSignature() + { + return $this->container['signature']; + } + + /** + * Sets signature + * + * @param string|null $signature signature + * + * @return self + */ + public function setSignature($signature) + { + if (is_null($signature)) { + throw new \InvalidArgumentException('non-nullable signature cannot be null'); + } + $this->container['signature'] = $signature; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion() + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version version + * + * @return self + */ + public function setVersion($version) + { + if (is_null($version)) { + throw new \InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ApplePayTokenTokenHeader.php b/lib/Model/ApplePayTokenTokenHeader.php new file mode 100644 index 0000000..13ac49e --- /dev/null +++ b/lib/Model/ApplePayTokenTokenHeader.php @@ -0,0 +1,477 @@ + + */ +class ApplePayTokenTokenHeader implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'applePayToken_token_header'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ephemeral_public_key' => 'string', + 'public_key_hash' => 'string', + 'transaction_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ephemeral_public_key' => null, + 'public_key_hash' => null, + 'transaction_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ephemeral_public_key' => false, + 'public_key_hash' => false, + 'transaction_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ephemeral_public_key' => 'ephemeralPublicKey', + 'public_key_hash' => 'publicKeyHash', + 'transaction_id' => 'transactionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ephemeral_public_key' => 'setEphemeralPublicKey', + 'public_key_hash' => 'setPublicKeyHash', + 'transaction_id' => 'setTransactionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ephemeral_public_key' => 'getEphemeralPublicKey', + 'public_key_hash' => 'getPublicKeyHash', + 'transaction_id' => 'getTransactionId' + ]; + + /** + * 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::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ephemeral_public_key', $data ?? [], null); + $this->setIfExists('public_key_hash', $data ?? [], null); + $this->setIfExists('transaction_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * 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 ephemeral_public_key + * + * @return string|null + */ + public function getEphemeralPublicKey() + { + return $this->container['ephemeral_public_key']; + } + + /** + * Sets ephemeral_public_key + * + * @param string|null $ephemeral_public_key ephemeral_public_key + * + * @return self + */ + public function setEphemeralPublicKey($ephemeral_public_key) + { + if (is_null($ephemeral_public_key)) { + throw new \InvalidArgumentException('non-nullable ephemeral_public_key cannot be null'); + } + $this->container['ephemeral_public_key'] = $ephemeral_public_key; + + return $this; + } + + /** + * Gets public_key_hash + * + * @return string|null + */ + public function getPublicKeyHash() + { + return $this->container['public_key_hash']; + } + + /** + * Sets public_key_hash + * + * @param string|null $public_key_hash public_key_hash + * + * @return self + */ + public function setPublicKeyHash($public_key_hash) + { + if (is_null($public_key_hash)) { + throw new \InvalidArgumentException('non-nullable public_key_hash cannot be null'); + } + $this->container['public_key_hash'] = $public_key_hash; + + return $this; + } + + /** + * Gets transaction_id + * + * @return string|null + */ + public function getTransactionId() + { + return $this->container['transaction_id']; + } + + /** + * Sets transaction_id + * + * @param string|null $transaction_id transaction_id + * + * @return self + */ + public function setTransactionId($transaction_id) + { + if (is_null($transaction_id)) { + throw new \InvalidArgumentException('non-nullable transaction_id cannot be null'); + } + $this->container['transaction_id'] = $transaction_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/AvailablePaymentMethod.php b/lib/Model/AvailablePaymentMethod.php old mode 100755 new mode 100644 index 8590bb2..8becbb4 --- a/lib/Model/AvailablePaymentMethod.php +++ b/lib/Model/AvailablePaymentMethod.php @@ -2,149 +2,154 @@ /** * AvailablePaymentMethod * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class AvailablePaymentMethod implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * AvailablePaymentMethod Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class AvailablePaymentMethod implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const REASON_CODE_METHOD_AVAILABILITY_NO_CONTRACT = 'NO_CONTRACT'; - public const REASON_CODE_METHOD_AVAILABILITY_NOT_FEASIBLE_CURRENCY = 'NOT_FEASIBLE_CURRENCY'; - public const REASON_CODE_METHOD_AVAILABILITY_OUT_OF_RANGE_AMOUNT = 'OUT_OF_RANGE_AMOUNT'; - public const REASON_CODE_METHOD_AVAILABILITY_MANDATORY_STRUCTURE_NOT_PROVIDED = 'MANDATORY_STRUCTURE_NOT_PROVIDED'; - public const REASON_CODE_METHOD_AVAILABILITY_UNSUPPORTED_BANK_PROVIDER = 'UNSUPPORTED_BANK_PROVIDER'; - public const REASON_CODE_METHOD_AVAILABILITY_INCORRECT_INPUT = 'INCORRECT_INPUT'; + /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'availablePaymentMethod'; + /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'payment_method' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod', 'is_available' => 'bool', 'reason_code_method_availability' => 'string', - 'reason_code_method_availability_description' => 'string', + 'reason_code_method_availability_description' => 'string' ]; + /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'payment_method' => null, 'is_available' => null, 'reason_code_method_availability' => null, - 'reason_code_method_availability_description' => null, + 'reason_code_method_availability_description' => null ]; + /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'payment_method' => false, 'is_available' => false, 'reason_code_method_availability' => false, - 'reason_code_method_availability_description' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'payment_method' => 'paymentMethod', - 'is_available' => 'isAvailable', - 'reason_code_method_availability' => 'reasonCodeMethodAvailability', - 'reason_code_method_availability_description' => 'reasonCodeMethodAvailabilityDescription', + 'reason_code_method_availability_description' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'payment_method' => 'setPaymentMethod', - 'is_available' => 'setIsAvailable', - 'reason_code_method_availability' => 'setReasonCodeMethodAvailability', - 'reason_code_method_availability_description' => 'setReasonCodeMethodAvailabilityDescription', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'payment_method' => 'getPaymentMethod', - 'is_available' => 'getIsAvailable', - 'reason_code_method_availability' => 'getReasonCodeMethodAvailability', - 'reason_code_method_availability_description' => 'getReasonCodeMethodAvailabilityDescription', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('payment_method', $data ?? [], null); - $this->setIfExists('is_available', $data ?? [], null); - $this->setIfExists('reason_code_method_availability', $data ?? [], null); - $this->setIfExists('reason_code_method_availability_description', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -153,34 +158,52 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'payment_method' => 'paymentMethod', + 'is_available' => 'isAvailable', + 'reason_code_method_availability' => 'reasonCodeMethodAvailability', + 'reason_code_method_availability_description' => 'reasonCodeMethodAvailabilityDescription' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'payment_method' => 'setPaymentMethod', + 'is_available' => 'setIsAvailable', + 'reason_code_method_availability' => 'setReasonCodeMethodAvailability', + 'reason_code_method_availability_description' => 'setReasonCodeMethodAvailabilityDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_method' => 'getPaymentMethod', + 'is_available' => 'getIsAvailable', + 'reason_code_method_availability' => 'getReasonCodeMethodAvailability', + 'reason_code_method_availability_description' => 'getReasonCodeMethodAvailabilityDescription' + ]; /** * Array of attributes where the key is the local name, @@ -214,46 +237,72 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + public const REASON_CODE_METHOD_AVAILABILITY_NO_CONTRACT = 'NO_CONTRACT'; + public const REASON_CODE_METHOD_AVAILABILITY_NOT_FEASIBLE_CURRENCY = 'NOT_FEASIBLE_CURRENCY'; + public const REASON_CODE_METHOD_AVAILABILITY_OUT_OF_RANGE_AMOUNT = 'OUT_OF_RANGE_AMOUNT'; + public const REASON_CODE_METHOD_AVAILABILITY_MANDATORY_STRUCTURE_NOT_PROVIDED = 'MANDATORY_STRUCTURE_NOT_PROVIDED'; + /** - * Array of nullable field names deliberately set to null + * Gets allowable values of the enum * - * @return bool[] + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array + public function getReasonCodeMethodAvailabilityAllowableValues() { - return $this->openAPINullablesSetToNull; + return [ + self::REASON_CODE_METHOD_AVAILABILITY_NO_CONTRACT, + self::REASON_CODE_METHOD_AVAILABILITY_NOT_FEASIBLE_CURRENCY, + self::REASON_CODE_METHOD_AVAILABILITY_OUT_OF_RANGE_AMOUNT, + self::REASON_CODE_METHOD_AVAILABILITY_MANDATORY_STRUCTURE_NOT_PROVIDED, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() - { - return self::$openAPIModelName; - } + protected $container = []; /** - * Validate all the properties in the model - * return true if all passed + * Constructor * - * @return bool True if all properties are valid + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function valid() + public function __construct(?array $data = null) { - return count($this->listInvalidProperties()) === 0; + $this->setIfExists('payment_method', $data ?? [], null); + $this->setIfExists('is_available', $data ?? [], null); + $this->setIfExists('reason_code_method_availability', $data ?? [], null); + $this->setIfExists('reason_code_method_availability_description', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -284,26 +333,21 @@ public function listInvalidProperties() } /** - * Gets allowable values of the enum + * Validate all the properties in the model + * return true if all passed * - * @return string[] + * @return bool True if all properties are valid */ - public function getReasonCodeMethodAvailabilityAllowableValues() + public function valid() { - return [ - self::REASON_CODE_METHOD_AVAILABILITY_NO_CONTRACT, - self::REASON_CODE_METHOD_AVAILABILITY_NOT_FEASIBLE_CURRENCY, - self::REASON_CODE_METHOD_AVAILABILITY_OUT_OF_RANGE_AMOUNT, - self::REASON_CODE_METHOD_AVAILABILITY_MANDATORY_STRUCTURE_NOT_PROVIDED, - self::REASON_CODE_METHOD_AVAILABILITY_UNSUPPORTED_BANK_PROVIDER, - self::REASON_CODE_METHOD_AVAILABILITY_INCORRECT_INPUT, - ]; + return count($this->listInvalidProperties()) === 0; } + /** * Gets payment_method * - * @return PaymentMethod + * @return \Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod */ public function getPaymentMethod() { @@ -313,14 +357,14 @@ public function getPaymentMethod() /** * Sets payment_method * - * @param PaymentMethod $payment_method payment_method + * @param \Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod $payment_method payment_method * * @return self */ public function setPaymentMethod($payment_method) { if (is_null($payment_method)) { - throw new SanitizedInvalidArgumentException('non-nullable payment_method cannot be null'); + throw new \InvalidArgumentException('non-nullable payment_method cannot be null'); } $this->container['payment_method'] = $payment_method; @@ -347,7 +391,7 @@ public function getIsAvailable() public function setIsAvailable($is_available) { if (is_null($is_available)) { - throw new SanitizedInvalidArgumentException('non-nullable is_available cannot be null'); + throw new \InvalidArgumentException('non-nullable is_available cannot be null'); } $this->container['is_available'] = $is_available; @@ -374,11 +418,17 @@ public function getReasonCodeMethodAvailability() public function setReasonCodeMethodAvailability($reason_code_method_availability) { if (is_null($reason_code_method_availability)) { - throw new SanitizedInvalidArgumentException('non-nullable reason_code_method_availability cannot be null'); + throw new \InvalidArgumentException('non-nullable reason_code_method_availability cannot be null'); } $allowedValues = $this->getReasonCodeMethodAvailabilityAllowableValues(); if (!in_array($reason_code_method_availability, $allowedValues, true)) { - throw new SanitizedInvalidArgumentException(sprintf("Invalid value '%s' for 'reason_code_method_availability', must be one of '%s'", $reason_code_method_availability, implode("', '", $allowedValues))); + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'reason_code_method_availability', must be one of '%s'", + $reason_code_method_availability, + implode("', '", $allowedValues) + ) + ); } $this->container['reason_code_method_availability'] = $reason_code_method_availability; @@ -405,19 +455,18 @@ public function getReasonCodeMethodAvailabilityDescription() public function setReasonCodeMethodAvailabilityDescription($reason_code_method_availability_description) { if (is_null($reason_code_method_availability_description)) { - throw new SanitizedInvalidArgumentException('non-nullable reason_code_method_availability_description cannot be null'); + throw new \InvalidArgumentException('non-nullable reason_code_method_availability_description cannot be null'); } $this->container['reason_code_method_availability_description'] = $reason_code_method_availability_description; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -427,7 +476,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -441,7 +490,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -457,7 +506,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -467,12 +516,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/BankTransfer.php b/lib/Model/BankTransfer.php old mode 100755 new mode 100644 index 1133a83..50a742f --- a/lib/Model/BankTransfer.php +++ b/lib/Model/BankTransfer.php @@ -2,128 +2,146 @@ /** * BankTransfer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class BankTransfer implements ModelInterface, \ArrayAccess +/** + * BankTransfer Class Doc Comment + * + * @category Class + * @description Bank transder attributes + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class BankTransfer implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'bankTransfer'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'remittance_information_unstructured' => 'string', + 'remittance_information_unstructured' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'remittance_information_unstructured' => null, + 'remittance_information_unstructured' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'remittance_information_unstructured' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'remittance_information_unstructured' => 'remittanceInformationUnstructured', + 'remittance_information_unstructured' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'remittance_information_unstructured' => 'setRemittanceInformationUnstructured', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'remittance_information_unstructured' => 'getRemittanceInformationUnstructured', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('remittance_information_unstructured', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -132,34 +150,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'remittance_information_unstructured' => 'remittanceInformationUnstructured' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'remittance_information_unstructured' => 'setRemittanceInformationUnstructured' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'remittance_information_unstructured' => 'getRemittanceInformationUnstructured' + ]; /** * Array of attributes where the key is the local name, @@ -193,46 +220,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('remittance_information_unstructured', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -255,6 +286,18 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 remittance_information_unstructured * @@ -268,33 +311,32 @@ public function getRemittanceInformationUnstructured() /** * Sets remittance_information_unstructured * - * @param string|null $remittance_information_unstructured Unstructured remittance information. At present, Tatrabanka bank transfer does not display the remittance information. SEPA remittanceInformationUnstructured contains 140 characters. For TatraPayPlus purposes, the first 40 characters are assigned to the paymentId. Others 100 characters are free to use + * @param string|null $remittance_information_unstructured Unstructured transfer information. Currently, Tatrabanka bank transfer does not display the transfer information. The entire SEPA remittanceInformationUnstructured contains 140 characters. The structure of the string consists of 3 parts: - A. paymentId - fixed 40 characters are reserved for paymentId - B. Merchant Name value length - provided in the contract, up to 50 characters - C. Custom value length - free characters are calculated as C = 140-A-(B+1). Depends on the length of the merchant name. E.g. Merchant name = MerchantABCD,s.r.o. (19 characters + 1 separator space). 80 characters are available. The result of the UnstructuredTransferInformation will look like this 07b940d2-8b82-4c7a-a0dd-5ebeabcf1f3d MerchantABCD,s.r.o. Your text in remittance If the value of RemittanceInformationUnstructured in this attribute is longer than the calculated C, your custom value will be truncated. * * @return self */ public function setRemittanceInformationUnstructured($remittance_information_unstructured) { if (is_null($remittance_information_unstructured)) { - throw new SanitizedInvalidArgumentException('non-nullable remittance_information_unstructured cannot be null'); + throw new \InvalidArgumentException('non-nullable remittance_information_unstructured cannot be null'); } - if (mb_strlen($remittance_information_unstructured) > 100) { - throw new SanitizedInvalidArgumentException('invalid length for $remittance_information_unstructured when calling BankTransfer., must be smaller than or equal to 100.'); + if ((mb_strlen($remittance_information_unstructured) > 100)) { + throw new \InvalidArgumentException('invalid length for $remittance_information_unstructured when calling BankTransfer., must be smaller than or equal to 100.'); } - if (!preg_match("/^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,100}$/", ObjectSerializer::toString($remittance_information_unstructured))) { - throw new SanitizedInvalidArgumentException("invalid value for \$remittance_information_unstructured when calling BankTransfer., must conform to the pattern /^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,100}$/."); + if ((!preg_match("/^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,100}$/", ObjectSerializer::toString($remittance_information_unstructured)))) { + throw new \InvalidArgumentException("invalid value for \$remittance_information_unstructured when calling BankTransfer., must conform to the pattern /^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,100}$/."); } $this->container['remittance_information_unstructured'] = $remittance_information_unstructured; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -304,7 +346,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -318,7 +360,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -334,7 +376,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -344,12 +386,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/BankTransferStatus.php b/lib/Model/BankTransferStatus.php old mode 100755 new mode 100644 index 27d96b5..d1d7630 --- a/lib/Model/BankTransferStatus.php +++ b/lib/Model/BankTransferStatus.php @@ -2,13 +2,42 @@ /** * BankTransferStatus * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +/** + * BankTransferStatus Class Doc Comment + * + * @category Class + * @description The transaction status is filled with codes of the ISO 20022 + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ class BankTransferStatus { /** @@ -41,16 +70,9 @@ class BankTransferStatus public const PATC = 'PATC'; public const PART = 'PART'; - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; /** * Gets allowable values of the enum - * * @return string[] */ public static function getAllowableEnumValues() @@ -69,38 +91,9 @@ public static function getAllowableEnumValues() self::CANC, self::ACFC, self::PATC, - self::PART, + self::PART ]; } +} - public static function getAcceptedStatuses() - { - return [ - self::ACSC, - self::ACCC, - ]; - } - - public static function getRejectedStatuses() - { - return [ - self::CANC, - self::RJCT, - ]; - } - - public function getStatus() - { - return $this->container['status']; - } - - public function setStatus($status) - { - if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); - } - $this->container['status'] = $status; - return $this; - } -} diff --git a/lib/Model/BasePayment.php b/lib/Model/BasePayment.php old mode 100755 new mode 100644 index 1f9038d..e9fe4ab --- a/lib/Model/BasePayment.php +++ b/lib/Model/BasePayment.php @@ -2,133 +2,149 @@ /** * BasePayment * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class BasePayment implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * BasePayment Class Doc Comment + * + * @category Class + * @description Common instruction detail + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class BasePayment implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'basePayment'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'instructed_amount' => '\Tatrapayplus\TatrapayplusApiClient\Model\Amount', - 'end_to_end' => '\Tatrapayplus\TatrapayplusApiClient\Model\E2e', + 'end_to_end' => '\Tatrapayplus\TatrapayplusApiClient\Model\E2e' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'instructed_amount' => null, - 'end_to_end' => null, + 'end_to_end' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'instructed_amount' => false, - 'end_to_end' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'instructed_amount' => 'instructedAmount', - 'end_to_end' => 'endToEnd', + 'end_to_end' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'instructed_amount' => 'setInstructedAmount', - 'end_to_end' => 'setEndToEnd', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'instructed_amount' => 'getInstructedAmount', - 'end_to_end' => 'getEndToEnd', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('instructed_amount', $data ?? [], null); - $this->setIfExists('end_to_end', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +153,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'instructed_amount' => 'instructedAmount', + 'end_to_end' => 'endToEnd' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'instructed_amount' => 'setInstructedAmount', + 'end_to_end' => 'setEndToEnd' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'instructed_amount' => 'getInstructedAmount', + 'end_to_end' => 'getEndToEnd' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +226,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('instructed_amount', $data ?? [], null); + $this->setIfExists('end_to_end', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -255,14 +288,25 @@ public function listInvalidProperties() if ($this->container['end_to_end'] === null) { $invalidProperties[] = "'end_to_end' can't be null"; } - return $invalidProperties; } + /** + * 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 instructed_amount * - * @return Amount + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Amount */ public function getInstructedAmount() { @@ -272,14 +316,14 @@ public function getInstructedAmount() /** * Sets instructed_amount * - * @param Amount $instructed_amount instructed_amount + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Amount $instructed_amount instructed_amount * * @return self */ public function setInstructedAmount($instructed_amount) { if (is_null($instructed_amount)) { - throw new SanitizedInvalidArgumentException('non-nullable instructed_amount cannot be null'); + throw new \InvalidArgumentException('non-nullable instructed_amount cannot be null'); } $this->container['instructed_amount'] = $instructed_amount; @@ -289,7 +333,7 @@ public function setInstructedAmount($instructed_amount) /** * Gets end_to_end * - * @return E2e + * @return \Tatrapayplus\TatrapayplusApiClient\Model\E2e */ public function getEndToEnd() { @@ -299,26 +343,25 @@ public function getEndToEnd() /** * Sets end_to_end * - * @param E2e $end_to_end end_to_end + * @param \Tatrapayplus\TatrapayplusApiClient\Model\E2e $end_to_end end_to_end * * @return self */ public function setEndToEnd($end_to_end) { if (is_null($end_to_end)) { - throw new SanitizedInvalidArgumentException('non-nullable end_to_end cannot be null'); + throw new \InvalidArgumentException('non-nullable end_to_end cannot be null'); } $this->container['end_to_end'] = $end_to_end; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -328,7 +371,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -342,7 +385,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -358,7 +401,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -368,12 +411,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/CapacityInfo.php b/lib/Model/CapacityInfo.php old mode 100755 new mode 100644 index e3af53d..4e88ccf --- a/lib/Model/CapacityInfo.php +++ b/lib/Model/CapacityInfo.php @@ -2,140 +2,152 @@ /** * CapacityInfo * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class CapacityInfo implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * CapacityInfo Class Doc Comment + * + * @category Class + * @description Capacity posibilities of user. It is used to specify the calculation of the client's request. Based on this, the bank can make a more accurate calculation of the possibility of obtaining a loan + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CapacityInfo implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'capacityInfo'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'monthly_income' => 'float', 'monthly_expenses' => 'float', - 'number_of_children' => 'int', + 'number_of_children' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'monthly_income' => 'double', 'monthly_expenses' => 'double', - 'number_of_children' => null, + 'number_of_children' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'monthly_income' => false, 'monthly_expenses' => false, - 'number_of_children' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'monthly_income' => 'monthlyIncome', - 'monthly_expenses' => 'monthlyExpenses', - 'number_of_children' => 'numberOfChildren', + 'number_of_children' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'monthly_income' => 'setMonthlyIncome', - 'monthly_expenses' => 'setMonthlyExpenses', - 'number_of_children' => 'setNumberOfChildren', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'monthly_income' => 'getMonthlyIncome', - 'monthly_expenses' => 'getMonthlyExpenses', - 'number_of_children' => 'getNumberOfChildren', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('monthly_income', $data ?? [], null); - $this->setIfExists('monthly_expenses', $data ?? [], null); - $this->setIfExists('number_of_children', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -144,34 +156,49 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'monthly_income' => 'monthlyIncome', + 'monthly_expenses' => 'monthlyExpenses', + 'number_of_children' => 'numberOfChildren' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'monthly_income' => 'setMonthlyIncome', + 'monthly_expenses' => 'setMonthlyExpenses', + 'number_of_children' => 'setNumberOfChildren' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'monthly_income' => 'getMonthlyIncome', + 'monthly_expenses' => 'getMonthlyExpenses', + 'number_of_children' => 'getNumberOfChildren' + ]; /** * Array of attributes where the key is the local name, @@ -205,46 +232,52 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('monthly_income', $data ?? [], null); + $this->setIfExists('monthly_expenses', $data ?? [], null); + $this->setIfExists('number_of_children', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -265,13 +298,25 @@ public function listInvalidProperties() if ($this->container['number_of_children'] === null) { $invalidProperties[] = "'number_of_children' can't be null"; } - if ($this->container['number_of_children'] < 0) { + if (($this->container['number_of_children'] < 0)) { $invalidProperties[] = "invalid value for 'number_of_children', must be bigger than or equal to 0."; } return $invalidProperties; } + /** + * 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 monthly_income * @@ -292,7 +337,7 @@ public function getMonthlyIncome() public function setMonthlyIncome($monthly_income) { if (is_null($monthly_income)) { - throw new SanitizedInvalidArgumentException('non-nullable monthly_income cannot be null'); + throw new \InvalidArgumentException('non-nullable monthly_income cannot be null'); } $this->container['monthly_income'] = $monthly_income; @@ -319,7 +364,7 @@ public function getMonthlyExpenses() public function setMonthlyExpenses($monthly_expenses) { if (is_null($monthly_expenses)) { - throw new SanitizedInvalidArgumentException('non-nullable monthly_expenses cannot be null'); + throw new \InvalidArgumentException('non-nullable monthly_expenses cannot be null'); } $this->container['monthly_expenses'] = $monthly_expenses; @@ -346,24 +391,23 @@ public function getNumberOfChildren() public function setNumberOfChildren($number_of_children) { if (is_null($number_of_children)) { - throw new SanitizedInvalidArgumentException('non-nullable number_of_children cannot be null'); + throw new \InvalidArgumentException('non-nullable number_of_children cannot be null'); } - if ($number_of_children < 0) { - throw new SanitizedInvalidArgumentException('invalid value for $number_of_children when calling CapacityInfo., must be bigger than or equal to 0.'); + if (($number_of_children < 0)) { + throw new \InvalidArgumentException('invalid value for $number_of_children when calling CapacityInfo., must be bigger than or equal to 0.'); } $this->container['number_of_children'] = $number_of_children; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -373,7 +417,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -387,7 +431,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -403,7 +447,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -413,12 +457,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/CardDetail.php b/lib/Model/CardDetail.php old mode 100755 new mode 100644 index aacf2f5..7d5f613 --- a/lib/Model/CardDetail.php +++ b/lib/Model/CardDetail.php @@ -2,172 +2,161 @@ /** * CardDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -use Tatrapayplus\TatrapayplusApiClient\TatraPayPlusService; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class CardDetail implements ModelInterface, \ArrayAccess +/** + * CardDetail Class Doc Comment + * + * @category Class + * @description Card pay information + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CardDetail implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const CARD_PAY_LANG_OVERRIDE_SK = 'SK'; - public const CARD_PAY_LANG_OVERRIDE_EN = 'EN'; - public const CARD_PAY_LANG_OVERRIDE_DE = 'DE'; - public const CARD_PAY_LANG_OVERRIDE_HU = 'HU'; - public const CARD_PAY_LANG_OVERRIDE_CZ = 'CZ'; - public const CARD_PAY_LANG_OVERRIDE_ES = 'ES'; - public const CARD_PAY_LANG_OVERRIDE_FR = 'FR'; - public const CARD_PAY_LANG_OVERRIDE_IT = 'IT'; - public const CARD_PAY_LANG_OVERRIDE_PL = 'PL'; + /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'cardDetail'; + /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'card_pay_lang_override' => 'string', 'is_pre_authorization' => 'bool', 'card_holder' => 'string', 'billing_address' => '\Tatrapayplus\TatrapayplusApiClient\Model\Address', 'shipping_address' => '\Tatrapayplus\TatrapayplusApiClient\Model\Address', - 'comfort_pay' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister', + 'comfort_pay' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister' ]; + /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'card_pay_lang_override' => null, 'is_pre_authorization' => null, 'card_holder' => null, 'billing_address' => null, 'shipping_address' => null, - 'comfort_pay' => null, + 'comfort_pay' => null ]; + /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'card_pay_lang_override' => false, 'is_pre_authorization' => false, 'card_holder' => false, 'billing_address' => false, 'shipping_address' => false, - 'comfort_pay' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'card_pay_lang_override' => 'cardPayLangOverride', - 'is_pre_authorization' => 'isPreAuthorization', - 'card_holder' => 'cardHolder', - 'billing_address' => 'billingAddress', - 'shipping_address' => 'shippingAddress', - 'comfort_pay' => 'comfortPay', + 'comfort_pay' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'card_pay_lang_override' => 'setCardPayLangOverride', - 'is_pre_authorization' => 'setIsPreAuthorization', - 'card_holder' => 'setCardHolder', - 'billing_address' => 'setBillingAddress', - 'shipping_address' => 'setShippingAddress', - 'comfort_pay' => 'setComfortPay', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'card_pay_lang_override' => 'getCardPayLangOverride', - 'is_pre_authorization' => 'getIsPreAuthorization', - 'card_holder' => 'getCardHolder', - 'billing_address' => 'getBillingAddress', - 'shipping_address' => 'getShippingAddress', - 'comfort_pay' => 'getComfortPay', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - if ($data['card_holder']) { - $data['card_holder'] = TatraPayPlusService::remove_diacritics($data['card_holder']); - } - - $this->setIfExists('card_pay_lang_override', $data ?? [], null); - $this->setIfExists('is_pre_authorization', $data ?? [], null); - $this->setIfExists('card_holder', $data ?? [], null); - $this->setIfExists('billing_address', $data ?? [], null); - $this->setIfExists('shipping_address', $data ?? [], null); - $this->setIfExists('comfort_pay', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -176,34 +165,58 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'card_pay_lang_override' => 'cardPayLangOverride', + 'is_pre_authorization' => 'isPreAuthorization', + 'card_holder' => 'cardHolder', + 'billing_address' => 'billingAddress', + 'shipping_address' => 'shippingAddress', + 'comfort_pay' => 'comfortPay' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'card_pay_lang_override' => 'setCardPayLangOverride', + 'is_pre_authorization' => 'setIsPreAuthorization', + 'card_holder' => 'setCardHolder', + 'billing_address' => 'setBillingAddress', + 'shipping_address' => 'setShippingAddress', + 'comfort_pay' => 'setComfortPay' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'card_pay_lang_override' => 'getCardPayLangOverride', + 'is_pre_authorization' => 'getIsPreAuthorization', + 'card_holder' => 'getCardHolder', + 'billing_address' => 'getBillingAddress', + 'shipping_address' => 'getShippingAddress', + 'comfort_pay' => 'getComfortPay' + ]; /** * Array of attributes where the key is the local name, @@ -237,46 +250,84 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + public const CARD_PAY_LANG_OVERRIDE_SK = 'SK'; + public const CARD_PAY_LANG_OVERRIDE_EN = 'EN'; + public const CARD_PAY_LANG_OVERRIDE_DE = 'DE'; + public const CARD_PAY_LANG_OVERRIDE_HU = 'HU'; + public const CARD_PAY_LANG_OVERRIDE_CZ = 'CZ'; + public const CARD_PAY_LANG_OVERRIDE_ES = 'ES'; + public const CARD_PAY_LANG_OVERRIDE_FR = 'FR'; + public const CARD_PAY_LANG_OVERRIDE_IT = 'IT'; + public const CARD_PAY_LANG_OVERRIDE_PL = 'PL'; + /** - * Array of nullable field names deliberately set to null + * Gets allowable values of the enum * - * @return bool[] + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array + public function getCardPayLangOverrideAllowableValues() { - return $this->openAPINullablesSetToNull; + return [ + self::CARD_PAY_LANG_OVERRIDE_SK, + self::CARD_PAY_LANG_OVERRIDE_EN, + self::CARD_PAY_LANG_OVERRIDE_DE, + self::CARD_PAY_LANG_OVERRIDE_HU, + self::CARD_PAY_LANG_OVERRIDE_CZ, + self::CARD_PAY_LANG_OVERRIDE_ES, + self::CARD_PAY_LANG_OVERRIDE_FR, + self::CARD_PAY_LANG_OVERRIDE_IT, + self::CARD_PAY_LANG_OVERRIDE_PL, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() - { - return self::$openAPIModelName; - } + protected $container = []; /** - * Validate all the properties in the model - * return true if all passed + * Constructor * - * @return bool True if all properties are valid + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function valid() + public function __construct(?array $data = null) { - return count($this->listInvalidProperties()) === 0; + $this->setIfExists('card_pay_lang_override', $data ?? [], null); + $this->setIfExists('is_pre_authorization', $data ?? [], null); + $this->setIfExists('card_holder', $data ?? [], null); + $this->setIfExists('billing_address', $data ?? [], null); + $this->setIfExists('shipping_address', $data ?? [], null); + $this->setIfExists('comfort_pay', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -300,15 +351,15 @@ public function listInvalidProperties() if ($this->container['card_holder'] === null) { $invalidProperties[] = "'card_holder' can't be null"; } - if (mb_strlen($this->container['card_holder']) > 45) { + if ((mb_strlen($this->container['card_holder']) > 45)) { $invalidProperties[] = "invalid value for 'card_holder', the character length must be smaller than or equal to 45."; } - if (mb_strlen($this->container['card_holder']) < 2) { + if ((mb_strlen($this->container['card_holder']) < 2)) { $invalidProperties[] = "invalid value for 'card_holder', the character length must be bigger than or equal to 2."; } - if (!preg_match('/^[ 0-9a-zA-Z.@_-]{2,45}$/', $this->container['card_holder'])) { + if (!preg_match("/^[ 0-9a-zA-Z.@_-]{2,45}$/", $this->container['card_holder'])) { $invalidProperties[] = "invalid value for 'card_holder', must be conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/."; } @@ -316,25 +367,17 @@ public function listInvalidProperties() } /** - * Gets allowable values of the enum + * Validate all the properties in the model + * return true if all passed * - * @return string[] + * @return bool True if all properties are valid */ - public function getCardPayLangOverrideAllowableValues() + public function valid() { - return [ - self::CARD_PAY_LANG_OVERRIDE_SK, - self::CARD_PAY_LANG_OVERRIDE_EN, - self::CARD_PAY_LANG_OVERRIDE_DE, - self::CARD_PAY_LANG_OVERRIDE_HU, - self::CARD_PAY_LANG_OVERRIDE_CZ, - self::CARD_PAY_LANG_OVERRIDE_ES, - self::CARD_PAY_LANG_OVERRIDE_FR, - self::CARD_PAY_LANG_OVERRIDE_IT, - self::CARD_PAY_LANG_OVERRIDE_PL, - ]; + return count($this->listInvalidProperties()) === 0; } + /** * Gets card_pay_lang_override * @@ -355,11 +398,17 @@ public function getCardPayLangOverride() public function setCardPayLangOverride($card_pay_lang_override) { if (is_null($card_pay_lang_override)) { - throw new SanitizedInvalidArgumentException('non-nullable card_pay_lang_override cannot be null'); + throw new \InvalidArgumentException('non-nullable card_pay_lang_override cannot be null'); } $allowedValues = $this->getCardPayLangOverrideAllowableValues(); if (!in_array($card_pay_lang_override, $allowedValues, true)) { - throw new SanitizedInvalidArgumentException(sprintf("Invalid value '%s' for 'card_pay_lang_override', must be one of '%s'", $card_pay_lang_override, implode("', '", $allowedValues))); + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'card_pay_lang_override', must be one of '%s'", + $card_pay_lang_override, + implode("', '", $allowedValues) + ) + ); } $this->container['card_pay_lang_override'] = $card_pay_lang_override; @@ -386,7 +435,7 @@ public function getIsPreAuthorization() public function setIsPreAuthorization($is_pre_authorization) { if (is_null($is_pre_authorization)) { - throw new SanitizedInvalidArgumentException('non-nullable is_pre_authorization cannot be null'); + throw new \InvalidArgumentException('non-nullable is_pre_authorization cannot be null'); } $this->container['is_pre_authorization'] = $is_pre_authorization; @@ -406,25 +455,23 @@ public function getCardHolder() /** * Sets card_holder * - * @param string $card_holder Unstructured remittance information. At present, Tatrabanka bank transfer does not display the remittance information. + * @param string $card_holder The card holder name. In case of Direct API either cardHolder or email is mandatory * * @return self */ public function setCardHolder($card_holder) { - $card_holder = TatraPayPlusService::remove_diacritics($card_holder); - if (is_null($card_holder)) { - throw new SanitizedInvalidArgumentException('non-nullable card_holder cannot be null'); + throw new \InvalidArgumentException('non-nullable card_holder cannot be null'); } - if (mb_strlen($card_holder) > 45) { - throw new SanitizedInvalidArgumentException('invalid length for $card_holder when calling CardDetail., must be smaller than or equal to 45.'); + if ((mb_strlen($card_holder) > 45)) { + throw new \InvalidArgumentException('invalid length for $card_holder when calling CardDetail., must be smaller than or equal to 45.'); } - if (mb_strlen($card_holder) < 2) { - throw new SanitizedInvalidArgumentException('invalid length for $card_holder when calling CardDetail., must be bigger than or equal to 2.'); + if ((mb_strlen($card_holder) < 2)) { + throw new \InvalidArgumentException('invalid length for $card_holder when calling CardDetail., must be bigger than or equal to 2.'); } - if (!preg_match('/^[ 0-9a-zA-Z.@_-]{2,45}$/', ObjectSerializer::toString($card_holder))) { - throw new SanitizedInvalidArgumentException('invalid value for $card_holder when calling CardDetail., must conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/.'); + if ((!preg_match("/^[ 0-9a-zA-Z.@_-]{2,45}$/", ObjectSerializer::toString($card_holder)))) { + throw new \InvalidArgumentException("invalid value for \$card_holder when calling CardDetail., must conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/."); } $this->container['card_holder'] = $card_holder; @@ -435,7 +482,7 @@ public function setCardHolder($card_holder) /** * Gets billing_address * - * @return Address|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address|null */ public function getBillingAddress() { @@ -445,14 +492,14 @@ public function getBillingAddress() /** * Sets billing_address * - * @param Address|null $billing_address billing_address + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address|null $billing_address billing_address * * @return self */ public function setBillingAddress($billing_address) { if (is_null($billing_address)) { - throw new SanitizedInvalidArgumentException('non-nullable billing_address cannot be null'); + throw new \InvalidArgumentException('non-nullable billing_address cannot be null'); } $this->container['billing_address'] = $billing_address; @@ -462,7 +509,7 @@ public function setBillingAddress($billing_address) /** * Gets shipping_address * - * @return Address|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address|null */ public function getShippingAddress() { @@ -472,14 +519,14 @@ public function getShippingAddress() /** * Sets shipping_address * - * @param Address|null $shipping_address shipping_address + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address|null $shipping_address shipping_address * * @return self */ public function setShippingAddress($shipping_address) { if (is_null($shipping_address)) { - throw new SanitizedInvalidArgumentException('non-nullable shipping_address cannot be null'); + throw new \InvalidArgumentException('non-nullable shipping_address cannot be null'); } $this->container['shipping_address'] = $shipping_address; @@ -489,7 +536,7 @@ public function setShippingAddress($shipping_address) /** * Gets comfort_pay * - * @return CardIdentifierOrRegister|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister|null */ public function getComfortPay() { @@ -499,26 +546,25 @@ public function getComfortPay() /** * Sets comfort_pay * - * @param CardIdentifierOrRegister|null $comfort_pay comfort_pay + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister|null $comfort_pay comfort_pay * * @return self */ public function setComfortPay($comfort_pay) { if (is_null($comfort_pay)) { - throw new SanitizedInvalidArgumentException('non-nullable comfort_pay cannot be null'); + throw new \InvalidArgumentException('non-nullable comfort_pay cannot be null'); } $this->container['comfort_pay'] = $comfort_pay; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -528,7 +574,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -542,7 +588,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -558,7 +604,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -568,12 +614,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/CardIdentifierOrRegister.php b/lib/Model/CardIdentifierOrRegister.php old mode 100755 new mode 100644 index 0fc79dc..e585dc8 --- a/lib/Model/CardIdentifierOrRegister.php +++ b/lib/Model/CardIdentifierOrRegister.php @@ -2,133 +2,148 @@ /** * CardIdentifierOrRegister * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class CardIdentifierOrRegister implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * CardIdentifierOrRegister Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CardIdentifierOrRegister implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'cardIdentifierOrRegister'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'register_for_comfort_pay' => 'bool', - 'signed_card_id' => 'string', + 'signed_card_id' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'register_for_comfort_pay' => null, - 'signed_card_id' => null, + 'signed_card_id' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'register_for_comfort_pay' => false, - 'signed_card_id' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'register_for_comfort_pay' => 'registerForComfortPay', - 'signed_card_id' => 'signedCardId', + 'signed_card_id' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'register_for_comfort_pay' => 'setRegisterForComfortPay', - 'signed_card_id' => 'setSignedCardId', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'register_for_comfort_pay' => 'getRegisterForComfortPay', - 'signed_card_id' => 'getSignedCardId', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('register_for_comfort_pay', $data ?? [], false); - $this->setIfExists('signed_card_id', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +152,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'register_for_comfort_pay' => 'registerForComfortPay', + 'signed_card_id' => 'signedCardId' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'register_for_comfort_pay' => 'setRegisterForComfortPay', + 'signed_card_id' => 'setSignedCardId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'register_for_comfort_pay' => 'getRegisterForComfortPay', + 'signed_card_id' => 'getSignedCardId' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +225,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('register_for_comfort_pay', $data ?? [], false); + $this->setIfExists('signed_card_id', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -256,6 +288,18 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 register_for_comfort_pay * @@ -276,7 +320,7 @@ public function getRegisterForComfortPay() public function setRegisterForComfortPay($register_for_comfort_pay) { if (is_null($register_for_comfort_pay)) { - throw new SanitizedInvalidArgumentException('non-nullable register_for_comfort_pay cannot be null'); + throw new \InvalidArgumentException('non-nullable register_for_comfort_pay cannot be null'); } $this->container['register_for_comfort_pay'] = $register_for_comfort_pay; @@ -303,23 +347,22 @@ public function getSignedCardId() public function setSignedCardId($signed_card_id) { if (is_null($signed_card_id)) { - throw new SanitizedInvalidArgumentException('non-nullable signed_card_id cannot be null'); + throw new \InvalidArgumentException('non-nullable signed_card_id cannot be null'); } - if (mb_strlen($signed_card_id) > 1024) { - throw new SanitizedInvalidArgumentException('invalid length for $signed_card_id when calling CardIdentifierOrRegister., must be smaller than or equal to 1024.'); + if ((mb_strlen($signed_card_id) > 1024)) { + throw new \InvalidArgumentException('invalid length for $signed_card_id when calling CardIdentifierOrRegister., must be smaller than or equal to 1024.'); } $this->container['signed_card_id'] = $signed_card_id; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -329,7 +372,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -343,7 +386,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -359,7 +402,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -369,12 +412,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/CardPayAmount.php b/lib/Model/CardPayAmount.php old mode 100755 new mode 100644 index 96829bd..68bfedf --- a/lib/Model/CardPayAmount.php +++ b/lib/Model/CardPayAmount.php @@ -2,126 +2,145 @@ /** * CardPayAmount * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class CardPayAmount implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * CardPayAmount Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CardPayAmount implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'cardPayAmount'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'amount' => 'float', + 'amount' => 'float' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'amount' => null, + 'amount' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'amount' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'amount' => 'amount', + 'amount' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'amount' => 'setAmount', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'amount' => 'getAmount', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('amount', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +149,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'amount' => 'amount' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +219,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('amount', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -245,10 +277,21 @@ public function listInvalidProperties() if ($this->container['amount'] === null) { $invalidProperties[] = "'amount' can't be null"; } - return $invalidProperties; } + /** + * 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 amount * @@ -269,20 +312,20 @@ public function getAmount() public function setAmount($amount) { if (is_null($amount)) { - throw new SanitizedInvalidArgumentException('non-nullable amount cannot be null'); + throw new \InvalidArgumentException('non-nullable amount cannot be null'); } + $this->container['amount'] = $amount; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -292,7 +335,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -306,7 +349,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -322,7 +365,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -332,12 +375,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/CardPayStatus.php b/lib/Model/CardPayStatus.php old mode 100755 new mode 100644 index 38cb67c..39a76de --- a/lib/Model/CardPayStatus.php +++ b/lib/Model/CardPayStatus.php @@ -2,18 +2,49 @@ /** * CardPayStatus * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +/** + * CardPayStatus Class Doc Comment + * + * @category Class + * @description **CardPay status** | Enum | description | | ---------------- | ------------| | INIT | initialized transaction | | OK | processed successfully transaction | | FAIL | failed transaction | | PA | pre-authorization | | CPA | completed pre-authorization | | SPA | canceled preauthorization | | XPA | expired pre-authorization | | CB | returned payment | | AUTH_REQUIRED | 3D secure authorization required | | AUTH_EXPIRED | authorization expired | | AUTH_CANCELED | authorization canceled | + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ class CardPayStatus { /** * Possible values of this enum */ + public const INIT = 'INIT'; + public const OK = 'OK'; public const FAIL = 'FAIL'; @@ -28,14 +59,20 @@ class CardPayStatus public const CB = 'CB'; + public const AUTH_REQUIRED = 'AUTH_REQUIRED'; + + public const AUTH_EXPIRED = 'AUTH_EXPIRED'; + + public const AUTH_CANCELED = 'AUTH_CANCELED'; + /** * Gets allowable values of the enum - * * @return string[] */ public static function getAllowableEnumValues() { return [ + self::INIT, self::OK, self::FAIL, self::PA, @@ -43,6 +80,11 @@ public static function getAllowableEnumValues() self::SPA, self::XPA, self::CB, + self::AUTH_REQUIRED, + self::AUTH_EXPIRED, + self::AUTH_CANCELED ]; } } + + diff --git a/lib/Model/CardPayStatusStructure.php b/lib/Model/CardPayStatusStructure.php old mode 100755 new mode 100644 index e8e0f5a..a39a20f --- a/lib/Model/CardPayStatusStructure.php +++ b/lib/Model/CardPayStatusStructure.php @@ -2,51 +2,80 @@ /** * CardPayStatusStructure * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class CardPayStatusStructure implements ModelInterface, \ArrayAccess +/** + * CardPayStatusStructure Class Doc Comment + * + * @category Class + * @description card pay status structure + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CardPayStatusStructure implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'cardPayStatusStructure'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'status' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatus', 'currency' => 'string', - 'amount' => 'string', + 'amount' => 'float', 'pre_authorization' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount', 'charge_back' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount', 'comfort_pay' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureComfortPay', 'masked_card_number' => 'string', - 'reason_code' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureReasonCode', + 'reason_code' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode', + 'payment_authorization_code' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'status' => null, 'currency' => null, @@ -56,13 +85,14 @@ class CardPayStatusStructure implements ModelInterface, \ArrayAccess 'comfort_pay' => null, 'masked_card_number' => null, 'reason_code' => null, + 'payment_authorization_code' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'status' => false, 'currency' => false, @@ -72,107 +102,70 @@ class CardPayStatusStructure implements ModelInterface, \ArrayAccess 'comfort_pay' => false, 'masked_card_number' => false, 'reason_code' => false, + 'payment_authorization_code' => false ]; + /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'status' => 'status', - 'currency' => 'currency', - 'amount' => 'amount', - 'pre_authorization' => 'preAuthorization', - 'charge_back' => 'chargeBack', - 'comfort_pay' => 'comfortPay', - 'masked_card_number' => 'maskedCardNumber', - 'reason_code' => 'reasonCode', - ]; - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'status' => 'setStatus', - 'currency' => 'setCurrency', - 'amount' => 'setAmount', - 'pre_authorization' => 'setPreAuthorization', - 'charge_back' => 'setChargeBack', - 'comfort_pay' => 'setComfortPay', - 'masked_card_number' => 'setMaskedCardNumber', - 'reason_code' => 'setReasonCode', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'status' => 'getStatus', - 'currency' => 'getCurrency', - 'amount' => 'getAmount', - 'pre_authorization' => 'getPreAuthorization', - 'charge_back' => 'getChargeBack', - 'comfort_pay' => 'getComfortPay', - 'masked_card_number' => 'getMaskedCardNumber', - 'reason_code' => 'getReasonCode', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('currency', $data ?? [], null); - $this->setIfExists('amount', $data ?? [], null); - $this->setIfExists('pre_authorization', $data ?? [], null); - $this->setIfExists('charge_back', $data ?? [], null); - $this->setIfExists('comfort_pay', $data ?? [], null); - $this->setIfExists('masked_card_number', $data ?? [], null); - $this->setIfExists('reason_code', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -181,34 +174,67 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'status' => 'status', + 'currency' => 'currency', + 'amount' => 'amount', + 'pre_authorization' => 'preAuthorization', + 'charge_back' => 'chargeBack', + 'comfort_pay' => 'comfortPay', + 'masked_card_number' => 'maskedCardNumber', + 'reason_code' => 'reasonCode', + 'payment_authorization_code' => 'paymentAuthorizationCode' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'status' => 'setStatus', + 'currency' => 'setCurrency', + 'amount' => 'setAmount', + 'pre_authorization' => 'setPreAuthorization', + 'charge_back' => 'setChargeBack', + 'comfort_pay' => 'setComfortPay', + 'masked_card_number' => 'setMaskedCardNumber', + 'reason_code' => 'setReasonCode', + 'payment_authorization_code' => 'setPaymentAuthorizationCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'currency' => 'getCurrency', + 'amount' => 'getAmount', + 'pre_authorization' => 'getPreAuthorization', + 'charge_back' => 'getChargeBack', + 'comfort_pay' => 'getComfortPay', + 'masked_card_number' => 'getMaskedCardNumber', + 'reason_code' => 'getReasonCode', + 'payment_authorization_code' => 'getPaymentAuthorizationCode' + ]; /** * Array of attributes where the key is the local name, @@ -241,62 +267,59 @@ public static function getters() return self::$getters; } - public static function getAcceptedStatuses() - { - return [ - CardPayStatus::OK, - CardPayStatus::CB, - ]; - } - - public static function getRejectedStatuses() - { - return [ - CardPayStatus::FAIL, - ]; - } - /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('pre_authorization', $data ?? [], null); + $this->setIfExists('charge_back', $data ?? [], null); + $this->setIfExists('comfort_pay', $data ?? [], null); + $this->setIfExists('masked_card_number', $data ?? [], null); + $this->setIfExists('reason_code', $data ?? [], null); + $this->setIfExists('payment_authorization_code', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -314,7 +337,7 @@ public function listInvalidProperties() if ($this->container['currency'] === null) { $invalidProperties[] = "'currency' can't be null"; } - if (!preg_match('/[A-Z]{3}/', $this->container['currency'])) { + if (!preg_match("/[A-Z]{3}/", $this->container['currency'])) { $invalidProperties[] = "invalid value for 'currency', must be conform to the pattern /[A-Z]{3}/."; } @@ -322,18 +345,46 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'masked_card_number', the character length must be smaller than or equal to 19."; } + if (!is_null($this->container['payment_authorization_code']) && !preg_match("/^[ 0-9A-Z]{6}$/", $this->container['payment_authorization_code'])) { + $invalidProperties[] = "invalid value for 'payment_authorization_code', must be conform to the pattern /^[ 0-9A-Z]{6}$/."; + } + return $invalidProperties; } + /** + * 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 status + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatus + */ public function getStatus() { return $this->container['status']; } + /** + * Sets status + * + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatus $status status + * + * @return self + */ public function setStatus($status) { if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); + throw new \InvalidArgumentException('non-nullable status cannot be null'); } $this->container['status'] = $status; @@ -353,18 +404,18 @@ public function getCurrency() /** * Sets currency * - * @param string $currency ISO 4217 Alpha 3 currency code + * @param string $currency ISO 4217 Alpha 3 currency code. * * @return self */ public function setCurrency($currency) { if (is_null($currency)) { - throw new SanitizedInvalidArgumentException('non-nullable currency cannot be null'); + throw new \InvalidArgumentException('non-nullable currency cannot be null'); } - if (!preg_match('/[A-Z]{3}/', ObjectSerializer::toString($currency))) { - throw new SanitizedInvalidArgumentException('invalid value for $currency when calling CardPayStatusStructure., must conform to the pattern /[A-Z]{3}/.'); + if ((!preg_match("/[A-Z]{3}/", ObjectSerializer::toString($currency)))) { + throw new \InvalidArgumentException("invalid value for \$currency when calling CardPayStatusStructure., must conform to the pattern /[A-Z]{3}/."); } $this->container['currency'] = $currency; @@ -392,9 +443,10 @@ public function getAmount() public function setAmount($amount) { if (is_null($amount)) { - throw new SanitizedInvalidArgumentException('non-nullable amount cannot be null'); + throw new \InvalidArgumentException('non-nullable amount cannot be null'); } + $this->container['amount'] = $amount; return $this; @@ -403,7 +455,7 @@ public function setAmount($amount) /** * Gets pre_authorization * - * @return CardPayAmount|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null */ public function getPreAuthorization() { @@ -413,14 +465,14 @@ public function getPreAuthorization() /** * Sets pre_authorization * - * @param CardPayAmount|null $pre_authorization pre_authorization + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null $pre_authorization pre_authorization * * @return self */ public function setPreAuthorization($pre_authorization) { if (is_null($pre_authorization)) { - throw new SanitizedInvalidArgumentException('non-nullable pre_authorization cannot be null'); + throw new \InvalidArgumentException('non-nullable pre_authorization cannot be null'); } $this->container['pre_authorization'] = $pre_authorization; @@ -430,7 +482,7 @@ public function setPreAuthorization($pre_authorization) /** * Gets charge_back * - * @return CardPayAmount|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null */ public function getChargeBack() { @@ -440,14 +492,14 @@ public function getChargeBack() /** * Sets charge_back * - * @param CardPayAmount|null $charge_back charge_back + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null $charge_back charge_back * * @return self */ public function setChargeBack($charge_back) { if (is_null($charge_back)) { - throw new SanitizedInvalidArgumentException('non-nullable charge_back cannot be null'); + throw new \InvalidArgumentException('non-nullable charge_back cannot be null'); } $this->container['charge_back'] = $charge_back; @@ -457,7 +509,7 @@ public function setChargeBack($charge_back) /** * Gets comfort_pay * - * @return CardPayStatusStructureComfortPay|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureComfortPay|null */ public function getComfortPay() { @@ -467,14 +519,14 @@ public function getComfortPay() /** * Sets comfort_pay * - * @param CardPayStatusStructureComfortPay|null $comfort_pay comfort_pay + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureComfortPay|null $comfort_pay comfort_pay * * @return self */ public function setComfortPay($comfort_pay) { if (is_null($comfort_pay)) { - throw new SanitizedInvalidArgumentException('non-nullable comfort_pay cannot be null'); + throw new \InvalidArgumentException('non-nullable comfort_pay cannot be null'); } $this->container['comfort_pay'] = $comfort_pay; @@ -494,17 +546,17 @@ public function getMaskedCardNumber() /** * Sets masked_card_number * - * @param string|null $masked_card_number masked card number + * @param string|null $masked_card_number Masked card number. * * @return self */ public function setMaskedCardNumber($masked_card_number) { if (is_null($masked_card_number)) { - throw new SanitizedInvalidArgumentException('non-nullable masked_card_number cannot be null'); + throw new \InvalidArgumentException('non-nullable masked_card_number cannot be null'); } - if (mb_strlen($masked_card_number) > 19) { - throw new SanitizedInvalidArgumentException('invalid length for $masked_card_number when calling CardPayStatusStructure., must be smaller than or equal to 19.'); + if ((mb_strlen($masked_card_number) > 19)) { + throw new \InvalidArgumentException('invalid length for $masked_card_number when calling CardPayStatusStructure., must be smaller than or equal to 19.'); } $this->container['masked_card_number'] = $masked_card_number; @@ -515,7 +567,7 @@ public function setMaskedCardNumber($masked_card_number) /** * Gets reason_code * - * @return CardPayStatusStructureReasonCode|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode|null */ public function getReasonCode() { @@ -525,26 +577,57 @@ public function getReasonCode() /** * Sets reason_code * - * @param CardPayStatusStructureReasonCode|null $reason_code reason_code + * @param \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode|null $reason_code reason_code * * @return self */ public function setReasonCode($reason_code) { if (is_null($reason_code)) { - throw new SanitizedInvalidArgumentException('non-nullable reason_code cannot be null'); + throw new \InvalidArgumentException('non-nullable reason_code cannot be null'); } $this->container['reason_code'] = $reason_code; return $this; } + /** + * Gets payment_authorization_code + * + * @return string|null + */ + public function getPaymentAuthorizationCode() + { + return $this->container['payment_authorization_code']; + } + + /** + * Sets payment_authorization_code + * + * @param string|null $payment_authorization_code Payment authorization code + * + * @return self + */ + public function setPaymentAuthorizationCode($payment_authorization_code) + { + if (is_null($payment_authorization_code)) { + throw new \InvalidArgumentException('non-nullable payment_authorization_code cannot be null'); + } + + if ((!preg_match("/^[ 0-9A-Z]{6}$/", ObjectSerializer::toString($payment_authorization_code)))) { + throw new \InvalidArgumentException("invalid value for \$payment_authorization_code when calling CardPayStatusStructure., must conform to the pattern /^[ 0-9A-Z]{6}$/."); + } + + $this->container['payment_authorization_code'] = $payment_authorization_code; + + return $this; + } /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -554,7 +637,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -568,7 +651,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -584,7 +667,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -594,12 +677,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/CardPayStatusStructureComfortPay.php b/lib/Model/CardPayStatusStructureComfortPay.php old mode 100755 new mode 100644 index 97d257f..5259a96 --- a/lib/Model/CardPayStatusStructureComfortPay.php +++ b/lib/Model/CardPayStatusStructureComfortPay.php @@ -2,135 +2,148 @@ /** * CardPayStatusStructureComfortPay * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class CardPayStatusStructureComfortPay implements ModelInterface, \ArrayAccess +/** + * CardPayStatusStructureComfortPay Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CardPayStatusStructureComfortPay implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'cardPayStatusStructure_comfortPay'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'status' => '\Tatrapayplus\TatrapayplusApiClient\Model\ComfortPayStatus', - 'cid' => 'string', + 'cid' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'status' => null, - 'cid' => null, + 'cid' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'status' => false, - 'cid' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'status' => 'status', - 'cid' => 'cid', + 'cid' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'status' => 'setStatus', - 'cid' => 'setCid', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'status' => 'getStatus', - 'cid' => 'getCid', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('cid', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -139,34 +152,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'status' => 'status', + 'cid' => 'cid' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'status' => 'setStatus', + 'cid' => 'setCid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'cid' => 'getCid' + ]; /** * Array of attributes where the key is the local name, @@ -200,46 +225,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('cid', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -258,17 +288,29 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'cid', the character length must be smaller than or equal to 18."; } - if (!is_null($this->container['cid']) && !preg_match('/[0-9]{1,18}/', $this->container['cid'])) { + if (!is_null($this->container['cid']) && !preg_match("/[0-9]{1,18}/", $this->container['cid'])) { $invalidProperties[] = "invalid value for 'cid', must be conform to the pattern /[0-9]{1,18}/."; } return $invalidProperties; } + /** + * 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 status * - * @return ComfortPayStatus + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ComfortPayStatus */ public function getStatus() { @@ -278,14 +320,14 @@ public function getStatus() /** * Sets status * - * @param ComfortPayStatus $status status + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ComfortPayStatus $status status * * @return self */ public function setStatus($status) { if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); + throw new \InvalidArgumentException('non-nullable status cannot be null'); } $this->container['status'] = $status; @@ -312,26 +354,25 @@ public function getCid() public function setCid($cid) { if (is_null($cid)) { - throw new SanitizedInvalidArgumentException('non-nullable cid cannot be null'); + throw new \InvalidArgumentException('non-nullable cid cannot be null'); } - if (mb_strlen($cid) > 18) { - throw new SanitizedInvalidArgumentException('invalid length for $cid when calling CardPayStatusStructureComfortPay., must be smaller than or equal to 18.'); + if ((mb_strlen($cid) > 18)) { + throw new \InvalidArgumentException('invalid length for $cid when calling CardPayStatusStructureComfortPay., must be smaller than or equal to 18.'); } - if (!preg_match('/[0-9]{1,18}/', ObjectSerializer::toString($cid))) { - throw new SanitizedInvalidArgumentException('invalid value for $cid when calling CardPayStatusStructureComfortPay., must conform to the pattern /[0-9]{1,18}/.'); + if ((!preg_match("/[0-9]{1,18}/", ObjectSerializer::toString($cid)))) { + throw new \InvalidArgumentException("invalid value for \$cid when calling CardPayStatusStructureComfortPay., must conform to the pattern /[0-9]{1,18}/."); } $this->container['cid'] = $cid; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -341,7 +382,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -355,7 +396,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -371,7 +412,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -381,12 +422,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/CardPayUpdateInstruction.php b/lib/Model/CardPayUpdateInstruction.php old mode 100755 new mode 100644 index ad5f9bc..2cc22c3 --- a/lib/Model/CardPayUpdateInstruction.php +++ b/lib/Model/CardPayUpdateInstruction.php @@ -2,132 +2,149 @@ /** * CardPayUpdateInstruction * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class CardPayUpdateInstruction implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * CardPayUpdateInstruction Class Doc Comment + * + * @category Class + * @description CardPay update instruction. For CONFIRM_PRE_AUTHORIZATION, CHARGEBACK is amount mandatory. + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class CardPayUpdateInstruction implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const OPERATION_TYPE_CONFIRM_PRE_AUTHORIZATION = 'CONFIRM_PRE_AUTHORIZATION'; - public const OPERATION_TYPE_CANCEL_PRE_AUTHORIZATION = 'CANCEL_PRE_AUTHORIZATION'; - public const OPERATION_TYPE_CHARGEBACK = 'CHARGEBACK'; + /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'cardPayUpdateInstruction'; + /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'operation_type' => 'string', - 'amount' => 'string', + 'amount' => 'float' ]; + /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'operation_type' => null, - 'amount' => null, + 'amount' => null ]; + /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'operation_type' => false, - 'amount' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'operation_type' => 'operationType', - 'amount' => 'amount', + 'amount' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'operation_type' => 'setOperationType', - 'amount' => 'setAmount', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'operation_type' => 'getOperationType', - 'amount' => 'getAmount', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('operation_type', $data ?? [], null); - $this->setIfExists('amount', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -136,34 +153,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'operation_type' => 'operationType', + 'amount' => 'amount' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'operation_type' => 'setOperationType', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'operation_type' => 'getOperationType', + 'amount' => 'getAmount' + ]; /** * Array of attributes where the key is the local name, @@ -197,46 +226,68 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + public const OPERATION_TYPE_CONFIRM_PRE_AUTHORIZATION = 'CONFIRM_PRE_AUTHORIZATION'; + public const OPERATION_TYPE_CANCEL_PRE_AUTHORIZATION = 'CANCEL_PRE_AUTHORIZATION'; + public const OPERATION_TYPE_CHARGEBACK = 'CHARGEBACK'; + /** - * Array of nullable field names deliberately set to null + * Gets allowable values of the enum * - * @return bool[] + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array + public function getOperationTypeAllowableValues() { - return $this->openAPINullablesSetToNull; + return [ + self::OPERATION_TYPE_CONFIRM_PRE_AUTHORIZATION, + self::OPERATION_TYPE_CANCEL_PRE_AUTHORIZATION, + self::OPERATION_TYPE_CHARGEBACK, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() - { - return self::$openAPIModelName; - } + protected $container = []; /** - * Validate all the properties in the model - * return true if all passed + * Constructor * - * @return bool True if all properties are valid + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function valid() + public function __construct(?array $data = null) { - return count($this->listInvalidProperties()) === 0; + $this->setIfExists('operation_type', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -264,19 +315,17 @@ public function listInvalidProperties() } /** - * Gets allowable values of the enum + * Validate all the properties in the model + * return true if all passed * - * @return string[] + * @return bool True if all properties are valid */ - public function getOperationTypeAllowableValues() + public function valid() { - return [ - self::OPERATION_TYPE_CONFIRM_PRE_AUTHORIZATION, - self::OPERATION_TYPE_CANCEL_PRE_AUTHORIZATION, - self::OPERATION_TYPE_CHARGEBACK, - ]; + return count($this->listInvalidProperties()) === 0; } + /** * Gets operation_type * @@ -297,11 +346,17 @@ public function getOperationType() public function setOperationType($operation_type) { if (is_null($operation_type)) { - throw new SanitizedInvalidArgumentException('non-nullable operation_type cannot be null'); + throw new \InvalidArgumentException('non-nullable operation_type cannot be null'); } $allowedValues = $this->getOperationTypeAllowableValues(); if (!in_array($operation_type, $allowedValues, true)) { - throw new SanitizedInvalidArgumentException(sprintf("Invalid value '%s' for 'operation_type', must be one of '%s'", $operation_type, implode("', '", $allowedValues))); + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operation_type', must be one of '%s'", + $operation_type, + implode("', '", $allowedValues) + ) + ); } $this->container['operation_type'] = $operation_type; @@ -328,20 +383,20 @@ public function getAmount() public function setAmount($amount) { if (is_null($amount)) { - throw new SanitizedInvalidArgumentException('non-nullable amount cannot be null'); + throw new \InvalidArgumentException('non-nullable amount cannot be null'); } + $this->container['amount'] = $amount; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -351,7 +406,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -365,7 +420,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -381,7 +436,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -391,12 +446,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/ColorAttribute.php b/lib/Model/ColorAttribute.php old mode 100755 new mode 100644 index 0d51b0e..a1a6996 --- a/lib/Model/ColorAttribute.php +++ b/lib/Model/ColorAttribute.php @@ -2,135 +2,149 @@ /** * ColorAttribute * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class ColorAttribute implements ModelInterface, \ArrayAccess +/** + * ColorAttribute Class Doc Comment + * + * @category Class + * @description Color attributes for specific theme. Choose colour with sufficient contrast for the specific theme + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class ColorAttribute implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'colorAttribute'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'color_dark_mode' => 'string', - 'color_light_mode' => 'string', + 'color_light_mode' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'color_dark_mode' => null, - 'color_light_mode' => null, + 'color_light_mode' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'color_dark_mode' => false, - 'color_light_mode' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'color_dark_mode' => 'colorDarkMode', - 'color_light_mode' => 'colorLightMode', + 'color_light_mode' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'color_dark_mode' => 'setColorDarkMode', - 'color_light_mode' => 'setColorLightMode', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'color_dark_mode' => 'getColorDarkMode', - 'color_light_mode' => 'getColorLightMode', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('color_dark_mode', $data ?? [], null); - $this->setIfExists('color_light_mode', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -139,34 +153,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'color_dark_mode' => 'colorDarkMode', + 'color_light_mode' => 'colorLightMode' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'color_dark_mode' => 'setColorDarkMode', + 'color_light_mode' => 'setColorLightMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'color_dark_mode' => 'getColorDarkMode', + 'color_light_mode' => 'getColorLightMode' + ]; /** * Array of attributes where the key is the local name, @@ -200,46 +226,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('color_dark_mode', $data ?? [], null); + $this->setIfExists('color_light_mode', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -251,17 +282,29 @@ public function listInvalidProperties() { $invalidProperties = []; - if (!is_null($this->container['color_dark_mode']) && !preg_match('/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $this->container['color_dark_mode'])) { + if (!is_null($this->container['color_dark_mode']) && !preg_match("/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/", $this->container['color_dark_mode'])) { $invalidProperties[] = "invalid value for 'color_dark_mode', must be conform to the pattern /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/."; } - if (!is_null($this->container['color_light_mode']) && !preg_match('/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $this->container['color_light_mode'])) { + if (!is_null($this->container['color_light_mode']) && !preg_match("/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/", $this->container['color_light_mode'])) { $invalidProperties[] = "invalid value for 'color_light_mode', must be conform to the pattern /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/."; } return $invalidProperties; } + /** + * 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 color_dark_mode * @@ -282,11 +325,11 @@ public function getColorDarkMode() public function setColorDarkMode($color_dark_mode) { if (is_null($color_dark_mode)) { - throw new SanitizedInvalidArgumentException('non-nullable color_dark_mode cannot be null'); + throw new \InvalidArgumentException('non-nullable color_dark_mode cannot be null'); } - if (!preg_match('/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', ObjectSerializer::toString($color_dark_mode))) { - throw new SanitizedInvalidArgumentException('invalid value for $color_dark_mode when calling ColorAttribute., must conform to the pattern /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.'); + if ((!preg_match("/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/", ObjectSerializer::toString($color_dark_mode)))) { + throw new \InvalidArgumentException("invalid value for \$color_dark_mode when calling ColorAttribute., must conform to the pattern /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/."); } $this->container['color_dark_mode'] = $color_dark_mode; @@ -314,24 +357,23 @@ public function getColorLightMode() public function setColorLightMode($color_light_mode) { if (is_null($color_light_mode)) { - throw new SanitizedInvalidArgumentException('non-nullable color_light_mode cannot be null'); + throw new \InvalidArgumentException('non-nullable color_light_mode cannot be null'); } - if (!preg_match('/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', ObjectSerializer::toString($color_light_mode))) { - throw new SanitizedInvalidArgumentException('invalid value for $color_light_mode when calling ColorAttribute., must conform to the pattern /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.'); + if ((!preg_match("/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/", ObjectSerializer::toString($color_light_mode)))) { + throw new \InvalidArgumentException("invalid value for \$color_light_mode when calling ColorAttribute., must conform to the pattern /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/."); } $this->container['color_light_mode'] = $color_light_mode; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -341,7 +383,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -355,7 +397,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -371,7 +413,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -381,12 +423,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/ComfortPay.php b/lib/Model/ComfortPay.php old mode 100755 new mode 100644 index 81da9d9..6c8587d --- a/lib/Model/ComfortPay.php +++ b/lib/Model/ComfortPay.php @@ -2,126 +2,146 @@ /** * ComfortPay * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class ComfortPay implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * ComfortPay Class Doc Comment + * + * @category Class + * @description ComfortPay attributes + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class ComfortPay implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'comfortPay'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'card_identifier' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister', + 'card_identifier' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'card_identifier' => null, + 'card_identifier' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'card_identifier' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'card_identifier' => 'cardIdentifier', + 'card_identifier' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'card_identifier' => 'setCardIdentifier', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'card_identifier' => 'getCardIdentifier', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('card_identifier', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +150,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'card_identifier' => 'cardIdentifier' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'card_identifier' => 'setCardIdentifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'card_identifier' => 'getCardIdentifier' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +220,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('card_identifier', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -245,10 +278,22 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 card_identifier * - * @return CardIdentifierOrRegister|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister|null */ public function getCardIdentifier() { @@ -258,26 +303,25 @@ public function getCardIdentifier() /** * Sets card_identifier * - * @param CardIdentifierOrRegister|null $card_identifier card_identifier + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardIdentifierOrRegister|null $card_identifier card_identifier * * @return self */ public function setCardIdentifier($card_identifier) { if (is_null($card_identifier)) { - throw new SanitizedInvalidArgumentException('non-nullable card_identifier cannot be null'); + throw new \InvalidArgumentException('non-nullable card_identifier cannot be null'); } $this->container['card_identifier'] = $card_identifier; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -287,7 +331,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -301,7 +345,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -317,7 +361,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -327,12 +371,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/ComfortPayStatus.php b/lib/Model/ComfortPayStatus.php old mode 100755 new mode 100644 index 872d1cf..c995eb5 --- a/lib/Model/ComfortPayStatus.php +++ b/lib/Model/ComfortPayStatus.php @@ -2,13 +2,41 @@ /** * ComfortPayStatus * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +/** + * ComfortPayStatus Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ class ComfortPayStatus { /** @@ -20,14 +48,15 @@ class ComfortPayStatus /** * Gets allowable values of the enum - * * @return string[] */ public static function getAllowableEnumValues() { return [ self::OK, - self::FAIL, + self::FAIL ]; } } + + diff --git a/lib/Model/DirectTransactionData.php b/lib/Model/DirectTransactionData.php new file mode 100644 index 0000000..9b70bcd --- /dev/null +++ b/lib/Model/DirectTransactionData.php @@ -0,0 +1,452 @@ + + */ +class DirectTransactionData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'directTransactionData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reason_code' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode', + 'payment_authorization_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reason_code' => null, + 'payment_authorization_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason_code' => false, + 'payment_authorization_code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reason_code' => 'reasonCode', + 'payment_authorization_code' => 'paymentAuthorizationCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reason_code' => 'setReasonCode', + 'payment_authorization_code' => 'setPaymentAuthorizationCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reason_code' => 'getReasonCode', + 'payment_authorization_code' => 'getPaymentAuthorizationCode' + ]; + + /** + * 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::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('reason_code', $data ?? [], null); + $this->setIfExists('payment_authorization_code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['payment_authorization_code']) && !preg_match("/^[ 0-9A-Z]{6}$/", $this->container['payment_authorization_code'])) { + $invalidProperties[] = "invalid value for 'payment_authorization_code', must be conform to the pattern /^[ 0-9A-Z]{6}$/."; + } + + return $invalidProperties; + } + + /** + * 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 reason_code + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode|null + */ + public function getReasonCode() + { + return $this->container['reason_code']; + } + + /** + * Sets reason_code + * + * @param \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode|null $reason_code reason_code + * + * @return self + */ + public function setReasonCode($reason_code) + { + if (is_null($reason_code)) { + throw new \InvalidArgumentException('non-nullable reason_code cannot be null'); + } + $this->container['reason_code'] = $reason_code; + + return $this; + } + + /** + * Gets payment_authorization_code + * + * @return string|null + */ + public function getPaymentAuthorizationCode() + { + return $this->container['payment_authorization_code']; + } + + /** + * Sets payment_authorization_code + * + * @param string|null $payment_authorization_code Payment authorization code + * + * @return self + */ + public function setPaymentAuthorizationCode($payment_authorization_code) + { + if (is_null($payment_authorization_code)) { + throw new \InvalidArgumentException('non-nullable payment_authorization_code cannot be null'); + } + + if ((!preg_match("/^[ 0-9A-Z]{6}$/", ObjectSerializer::toString($payment_authorization_code)))) { + throw new \InvalidArgumentException("invalid value for \$payment_authorization_code when calling DirectTransactionData., must conform to the pattern /^[ 0-9A-Z]{6}$/."); + } + + $this->container['payment_authorization_code'] = $payment_authorization_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CardPayStatusStructureReasonCode.php b/lib/Model/DirectTransactionDataReasonCode.php old mode 100755 new mode 100644 similarity index 61% rename from lib/Model/CardPayStatusStructureReasonCode.php rename to lib/Model/DirectTransactionDataReasonCode.php index dd944d8..ca3dcd1 --- a/lib/Model/CardPayStatusStructureReasonCode.php +++ b/lib/Model/DirectTransactionDataReasonCode.php @@ -1,117 +1,192 @@ + */ +class DirectTransactionDataReasonCode implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'cardPayStatusStructure_reasonCode'; + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'directTransactionData_reasonCode'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ + ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ + ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ + ]; + /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to setter functions (for deserialization of responses) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $setters = [ - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to format mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - ]; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * If a nullable field gets set to null, insert it here + * Array of nullable properties * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + /** - * Associative array for storing property values + * Array of nullable field names deliberately set to null * - * @var mixed[] + * @return boolean[] */ - protected $container = []; + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } /** - * Constructor + * Setter - Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param boolean[] $openAPINullablesSetToNull */ - public function __construct(?array $data = null) + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** - * Array of property to type mappings. Used for (de)serialization + * Checks if a property is nullable * - * @return array + * @param string $property + * @return bool */ - public static function openAPITypes() + public static function isNullable(string $property): bool { - return self::$openAPITypes; + return self::openAPINullables()[$property] ?? false; } /** - * Array of property to format mappings. Used for (de)serialization + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - public static function openAPIFormats() + public function isNullableSetToNull(string $property): bool { - return self::$openAPIFormats; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + + ]; + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -144,46 +219,49 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -198,12 +276,23 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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; + } + /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -213,7 +302,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -227,7 +316,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -243,7 +332,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -253,52 +342,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + return ObjectSerializer::sanitizeForSerialization($this); } /** - * Checks if a property is nullable + * Gets the string presentation of the object * - * @param string $property - * - * @return bool + * @return string */ - public static function isNullable(string $property): bool + public function __toString() { - return self::openAPINullables()[$property] ?? false; + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } /** - * Array of nullable properties + * Gets a header-safe presentation of the object * - * @return array + * @return string */ - protected static function openAPINullables(): array + public function toHeaderValue() { - return self::$openAPINullables; + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/DirectTransactionIPSPData.php b/lib/Model/DirectTransactionIPSPData.php index 9984653..c01ee8c 100644 --- a/lib/Model/DirectTransactionIPSPData.php +++ b/lib/Model/DirectTransactionIPSPData.php @@ -2,149 +2,154 @@ /** * DirectTransactionIPSPData * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class DirectTransactionIPSPData implements ModelInterface, \ArrayAccess +/** + * DirectTransactionIPSPData Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class DirectTransactionIPSPData implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'directTransactionIPSPData'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'sub_merchant_id' => 'string', 'name' => 'string', 'location' => 'string', - 'country' => 'string', + 'country' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'sub_merchant_id' => null, 'name' => null, 'location' => null, - 'country' => null, + 'country' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'sub_merchant_id' => false, 'name' => false, 'location' => false, - 'country' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sub_merchant_id' => 'subMerchantId', - 'name' => 'name', - 'location' => 'location', - 'country' => 'country', + 'country' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sub_merchant_id' => 'setSubMerchantId', - 'name' => 'setName', - 'location' => 'setLocation', - 'country' => 'setCountry', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'sub_merchant_id' => 'getSubMerchantId', - 'name' => 'getName', - 'location' => 'getLocation', - 'country' => 'getCountry', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('sub_merchant_id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('location', $data ?? [], null); - $this->setIfExists('country', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -153,34 +158,52 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'sub_merchant_id' => 'subMerchantId', + 'name' => 'name', + 'location' => 'location', + 'country' => 'country' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'sub_merchant_id' => 'setSubMerchantId', + 'name' => 'setName', + 'location' => 'setLocation', + 'country' => 'setCountry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sub_merchant_id' => 'getSubMerchantId', + 'name' => 'getName', + 'location' => 'getLocation', + 'country' => 'getCountry' + ]; /** * Array of attributes where the key is the local name, @@ -214,46 +237,53 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('sub_merchant_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -265,25 +295,49 @@ public function listInvalidProperties() { $invalidProperties = []; - if (!preg_match('/^[0-9]*$/', $this->container['sub_merchant_id'])) { - $invalidProperties[] = "invalid value for 'sub_merchant_id', must be conform to the pattern /^[0-9]*$/."; + if ($this->container['sub_merchant_id'] === null) { + $invalidProperties[] = "'sub_merchant_id' can't be null"; + } + if (!preg_match("/^\\d{1,15}$/", $this->container['sub_merchant_id'])) { + $invalidProperties[] = "invalid value for 'sub_merchant_id', must be conform to the pattern /^\\d{1,15}$/."; } - if (!is_null($this->container['name']) && !preg_match("/^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/", $this->container['name'])) { - $invalidProperties[] = "invalid value for 'name', must be conform to the pattern /^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/."; + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if (!preg_match("/^[ 0-9a-zA-Z\\.:\/\\*-]{1,25}$/", $this->container['name'])) { + $invalidProperties[] = "invalid value for 'name', must be conform to the pattern /^[ 0-9a-zA-Z\\.:\/\\*-]{1,25}$/."; } - if (!is_null($this->container['location']) && !preg_match('/^[ 0-9a-zA-Z-]{1,13}$/', $this->container['location'])) { + if ($this->container['location'] === null) { + $invalidProperties[] = "'location' can't be null"; + } + if (!preg_match("/^[ 0-9a-zA-Z-]{1,13}$/", $this->container['location'])) { $invalidProperties[] = "invalid value for 'location', must be conform to the pattern /^[ 0-9a-zA-Z-]{1,13}$/."; } - if (!is_null($this->container['country']) && !preg_match('/^[A-Z]{2}$/', $this->container['country'])) { - $invalidProperties[] = "invalid value for 'country', must be conform to the pattern /^[A-Z]{2}$/."; + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + if (!preg_match("/[A-Z]{2}/", $this->container['country'])) { + $invalidProperties[] = "invalid value for 'country', must be conform to the pattern /[A-Z]{2}/."; } return $invalidProperties; } + /** + * 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 sub_merchant_id * @@ -304,11 +358,11 @@ public function getSubMerchantId() public function setSubMerchantId($sub_merchant_id) { if (is_null($sub_merchant_id)) { - throw new SanitizedInvalidArgumentException('non-nullable sub_merchant_id cannot be null'); + throw new \InvalidArgumentException('non-nullable sub_merchant_id cannot be null'); } - if (!preg_match('/^[0-9]*$/', ObjectSerializer::toString($sub_merchant_id))) { - throw new SanitizedInvalidArgumentException("invalid value for 'sub_merchant_id', must be conform to the pattern /^[0-9]*$/."); + if ((!preg_match("/^\\d{1,15}$/", ObjectSerializer::toString($sub_merchant_id)))) { + throw new \InvalidArgumentException("invalid value for \$sub_merchant_id when calling DirectTransactionIPSPData., must conform to the pattern /^\\d{1,15}$/."); } $this->container['sub_merchant_id'] = $sub_merchant_id; @@ -336,11 +390,11 @@ public function getName() public function setName($name) { if (is_null($name)) { - throw new SanitizedInvalidArgumentException('non-nullable name cannot be null'); + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - if (!preg_match("/^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/", ObjectSerializer::toString($name))) { - throw new SanitizedInvalidArgumentException("invalid value for 'name', must be conform to the pattern /^[ 0-9a-zA-Z?:()\/\\.,'+-]{1,25}$/."); + if ((!preg_match("/^[ 0-9a-zA-Z\\.:\/\\*-]{1,25}$/", ObjectSerializer::toString($name)))) { + throw new \InvalidArgumentException("invalid value for \$name when calling DirectTransactionIPSPData., must conform to the pattern /^[ 0-9a-zA-Z\\.:\/\\*-]{1,25}$/."); } $this->container['name'] = $name; @@ -351,7 +405,7 @@ public function setName($name) /** * Gets location * - * @return string|null + * @return string */ public function getLocation() { @@ -361,18 +415,18 @@ public function getLocation() /** * Sets location * - * @param string + * @param string $location location * * @return self */ public function setLocation($location) { if (is_null($location)) { - throw new SanitizedInvalidArgumentException('non-nullable location cannot be null'); + throw new \InvalidArgumentException('non-nullable location cannot be null'); } - if (!preg_match('/^[ 0-9a-zA-Z-]{1,13}$/', ObjectSerializer::toString($location))) { - throw new SanitizedInvalidArgumentException("invalid value for 'location', must be conform to the pattern /^[ 0-9a-zA-Z-]{1,13}$/."); + if ((!preg_match("/^[ 0-9a-zA-Z-]{1,13}$/", ObjectSerializer::toString($location)))) { + throw new \InvalidArgumentException("invalid value for \$location when calling DirectTransactionIPSPData., must conform to the pattern /^[ 0-9a-zA-Z-]{1,13}$/."); } $this->container['location'] = $location; @@ -393,31 +447,30 @@ public function getCountry() /** * Sets country * - * @param string + * @param string $country ISO 3166 ALPHA2 country code. * * @return self */ public function setCountry($country) { if (is_null($country)) { - throw new SanitizedInvalidArgumentException('non-nullable country cannot be null'); + throw new \InvalidArgumentException('non-nullable country cannot be null'); } - if (!preg_match('/^[A-Z]{2}$/', ObjectSerializer::toString($country))) { - throw new SanitizedInvalidArgumentException("invalid value for 'country', must be conform to the pattern /^[A-Z]{2}$/."); + if ((!preg_match("/[A-Z]{2}/", ObjectSerializer::toString($country)))) { + throw new \InvalidArgumentException("invalid value for \$country when calling DirectTransactionIPSPData., must conform to the pattern /[A-Z]{2}/."); } $this->container['country'] = $country; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -427,7 +480,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -441,7 +494,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -457,7 +510,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -467,12 +520,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/DirectTransactionStatus.php b/lib/Model/DirectTransactionStatus.php new file mode 100644 index 0000000..a193528 --- /dev/null +++ b/lib/Model/DirectTransactionStatus.php @@ -0,0 +1,65 @@ + + */ +class DirectTransactionTDSData implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'directTransactionTDSData'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'card_holder' => 'string', 'email' => 'string', 'phone' => 'string', 'billing_address' => '\Tatrapayplus\TatrapayplusApiClient\Model\Address', - 'shipping_address' => '\Tatrapayplus\TatrapayplusApiClient\Model\Address', + 'shipping_address' => '\Tatrapayplus\TatrapayplusApiClient\Model\Address' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'card_holder' => null, - 'email' => null, + 'email' => 'email', 'phone' => null, 'billing_address' => null, - 'shipping_address' => null, + 'shipping_address' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'card_holder' => true, - 'email' => true, - 'phone' => true, - 'billing_address' => true, - 'shipping_address' => true, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'card_holder' => 'cardHolder', - 'email' => 'email', - 'phone' => 'phone', - 'billing_address' => 'billingAddress', - 'shipping_address' => 'shippingAddress', + 'card_holder' => false, + 'email' => false, + 'phone' => false, + 'billing_address' => false, + 'shipping_address' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'card_holder' => 'setCardHolder', - 'email' => 'setEmail', - 'phone' => 'setPhone', - 'billing_address' => 'setBillingAddress', - 'shipping_address' => 'setShippingAddress', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'card_holder' => 'getCardHolder', - 'email' => 'getEmail', - 'phone' => 'getPhone', - 'billing_address' => 'getBillingAddress', - 'shipping_address' => 'getShippingAddress', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - if ($data['card_holder']) { - $data['card_holder'] = TatraPayPlusService::remove_diacritics($data['card_holder']); - } - $this->setIfExists('card_holder', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('phone', $data ?? [], null); - $this->setIfExists('billing_address', $data ?? [], null); - $this->setIfExists('shipping_address', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -164,34 +162,55 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'card_holder' => 'cardHolder', + 'email' => 'email', + 'phone' => 'phone', + 'billing_address' => 'billingAddress', + 'shipping_address' => 'shippingAddress' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'card_holder' => 'setCardHolder', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'billing_address' => 'setBillingAddress', + 'shipping_address' => 'setShippingAddress' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'card_holder' => 'getCardHolder', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'billing_address' => 'getBillingAddress', + 'shipping_address' => 'getShippingAddress' + ]; /** * Array of attributes where the key is the local name, @@ -225,46 +244,54 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('card_holder', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('billing_address', $data ?? [], null); + $this->setIfExists('shipping_address', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -276,17 +303,45 @@ public function listInvalidProperties() { $invalidProperties = []; - if (!preg_match('/^[ 0-9a-zA-Z.@_-]{2,45}$/', $this->container['card_holder'])) { + if (!is_null($this->container['card_holder']) && (mb_strlen($this->container['card_holder']) > 45)) { + $invalidProperties[] = "invalid value for 'card_holder', the character length must be smaller than or equal to 45."; + } + + if (!is_null($this->container['card_holder']) && (mb_strlen($this->container['card_holder']) < 2)) { + $invalidProperties[] = "invalid value for 'card_holder', the character length must be bigger than or equal to 2."; + } + + if (!is_null($this->container['card_holder']) && !preg_match("/^[ 0-9a-zA-Z.@_-]{2,45}$/", $this->container['card_holder'])) { $invalidProperties[] = "invalid value for 'card_holder', must be conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/."; } + if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) > 50)) { + $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 50."; + } + + if (!is_null($this->container['phone']) && !preg_match("/\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/", $this->container['phone'])) { + $invalidProperties[] = "invalid value for 'phone', must be conform to the pattern /\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/."; + } + return $invalidProperties; } + /** + * 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 card_holder * - * @return string + * @return string|null */ public function getCardHolder() { @@ -296,14 +351,23 @@ public function getCardHolder() /** * Sets card_holder * - * @param string $card_holder card_holder + * @param string|null $card_holder The card holder name. In case of Direct API either cardHolder or email is mandatory * * @return self */ public function setCardHolder($card_holder) { - if (!preg_match('/^[ 0-9a-zA-Z.@_-]{2,45}$/', ObjectSerializer::toString($card_holder))) { - throw new SanitizedInvalidArgumentException("invalid value for 'card_holder', must be conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/."); + if (is_null($card_holder)) { + throw new \InvalidArgumentException('non-nullable card_holder cannot be null'); + } + if ((mb_strlen($card_holder) > 45)) { + throw new \InvalidArgumentException('invalid length for $card_holder when calling DirectTransactionTDSData., must be smaller than or equal to 45.'); + } + if ((mb_strlen($card_holder) < 2)) { + throw new \InvalidArgumentException('invalid length for $card_holder when calling DirectTransactionTDSData., must be bigger than or equal to 2.'); + } + if ((!preg_match("/^[ 0-9a-zA-Z.@_-]{2,45}$/", ObjectSerializer::toString($card_holder)))) { + throw new \InvalidArgumentException("invalid value for \$card_holder when calling DirectTransactionTDSData., must conform to the pattern /^[ 0-9a-zA-Z.@_-]{2,45}$/."); } $this->container['card_holder'] = $card_holder; @@ -314,7 +378,7 @@ public function setCardHolder($card_holder) /** * Gets email * - * @return string + * @return string|null */ public function getEmail() { @@ -324,12 +388,19 @@ public function getEmail() /** * Sets email * - * @param string $email email + * @param string|null $email Conditionally mandatory. In case of TatraPayPlus payment initiation - It is mandatory only if the phone attribute is not provided. If the email is not provided, the user will not receive the cardPay notification and payLater will ask for the email in the app. In case of Direct API either cardHolder or email is mandatory * * @return self */ public function setEmail($email) { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + if ((mb_strlen($email) > 50)) { + throw new \InvalidArgumentException('invalid length for $email when calling DirectTransactionTDSData., must be smaller than or equal to 50.'); + } + $this->container['email'] = $email; return $this; @@ -348,12 +419,20 @@ public function getPhone() /** * Sets phone * - * @param string + * @param string|null $phone Conditionally mandatory. In case of TatraPayPlus payment initiation - It is mandatory only if the email attribute is not provided. * * @return self */ public function setPhone($phone) { + if (is_null($phone)) { + throw new \InvalidArgumentException('non-nullable phone cannot be null'); + } + + if ((!preg_match("/\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/", ObjectSerializer::toString($phone)))) { + throw new \InvalidArgumentException("invalid value for \$phone when calling DirectTransactionTDSData., must conform to the pattern /\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/."); + } + $this->container['phone'] = $phone; return $this; @@ -362,7 +441,7 @@ public function setPhone($phone) /** * Gets billing_address * - * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address|null */ public function getBillingAddress() { @@ -372,12 +451,15 @@ public function getBillingAddress() /** * Sets billing_address * - * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address|null $billing_address billing_address * * @return self */ public function setBillingAddress($billing_address) { + if (is_null($billing_address)) { + throw new \InvalidArgumentException('non-nullable billing_address cannot be null'); + } $this->container['billing_address'] = $billing_address; return $this; @@ -386,7 +468,7 @@ public function setBillingAddress($billing_address) /** * Gets shipping_address * - * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Address|null */ public function getShippingAddress() { @@ -396,23 +478,25 @@ public function getShippingAddress() /** * Sets shipping_address * - * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Address|null $shipping_address shipping_address * * @return self */ public function setShippingAddress($shipping_address) { + if (is_null($shipping_address)) { + throw new \InvalidArgumentException('non-nullable shipping_address cannot be null'); + } $this->container['shipping_address'] = $shipping_address; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -422,7 +506,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -436,7 +520,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -452,7 +536,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -462,12 +546,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/DirectTransactionTaskStatusResponse.php b/lib/Model/DirectTransactionTaskStatusResponse.php new file mode 100644 index 0000000..7ead754 --- /dev/null +++ b/lib/Model/DirectTransactionTaskStatusResponse.php @@ -0,0 +1,477 @@ + + */ +class DirectTransactionTaskStatusResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'directTransactionTaskStatusResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transaction_id' => 'string', + 'status' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionStatus', + 'transaction_data' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transaction_id' => '$uuid', + 'status' => null, + 'transaction_data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'transaction_id' => false, + 'status' => false, + 'transaction_data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transaction_id' => 'transactionId', + 'status' => 'status', + 'transaction_data' => 'transactionData' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transaction_id' => 'setTransactionId', + 'status' => 'setStatus', + 'transaction_data' => 'setTransactionData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transaction_id' => 'getTransactionId', + 'status' => 'getStatus', + 'transaction_data' => 'getTransactionData' + ]; + + /** + * 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::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transaction_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('transaction_data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * 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 transaction_id + * + * @return string|null + */ + public function getTransactionId() + { + return $this->container['transaction_id']; + } + + /** + * Sets transaction_id + * + * @param string|null $transaction_id This identification of the transaction, available only in state OK and FAIL + * + * @return self + */ + public function setTransactionId($transaction_id) + { + if (is_null($transaction_id)) { + throw new \InvalidArgumentException('non-nullable transaction_id cannot be null'); + } + $this->container['transaction_id'] = $transaction_id; + + return $this; + } + + /** + * Gets status + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionStatus|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionStatus|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets transaction_data + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionData|null + */ + public function getTransactionData() + { + return $this->container['transaction_data']; + } + + /** + * Sets transaction_data + * + * @param \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionData|null $transaction_data transaction_data + * + * @return self + */ + public function setTransactionData($transaction_data) + { + if (is_null($transaction_data)) { + throw new \InvalidArgumentException('non-nullable transaction_data cannot be null'); + } + $this->container['transaction_data'] = $transaction_data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/E2e.php b/lib/Model/E2e.php old mode 100755 new mode 100644 index ea4eb30..c733111 --- a/lib/Model/E2e.php +++ b/lib/Model/E2e.php @@ -2,142 +2,152 @@ /** * E2e * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class E2e implements ModelInterface, \ArrayAccess +/** + * E2e Class Doc Comment + * + * @category Class + * @description EndToEndId or paymentSymbols + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class E2e implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'e2e'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'variable_symbol' => 'string', 'specific_symbol' => 'string', - 'constant_symbol' => 'string', + 'constant_symbol' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'variable_symbol' => null, 'specific_symbol' => null, - 'constant_symbol' => null, + 'constant_symbol' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'variable_symbol' => false, 'specific_symbol' => false, - 'constant_symbol' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'variable_symbol' => 'variableSymbol', - 'specific_symbol' => 'specificSymbol', - 'constant_symbol' => 'constantSymbol', + 'constant_symbol' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'variable_symbol' => 'setVariableSymbol', - 'specific_symbol' => 'setSpecificSymbol', - 'constant_symbol' => 'setConstantSymbol', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'variable_symbol' => 'getVariableSymbol', - 'specific_symbol' => 'getSpecificSymbol', - 'constant_symbol' => 'getConstantSymbol', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('variable_symbol', $data ?? [], null); - $this->setIfExists('specific_symbol', $data ?? [], null); - $this->setIfExists('constant_symbol', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -146,34 +156,49 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'variable_symbol' => 'variableSymbol', + 'specific_symbol' => 'specificSymbol', + 'constant_symbol' => 'constantSymbol' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'variable_symbol' => 'setVariableSymbol', + 'specific_symbol' => 'setSpecificSymbol', + 'constant_symbol' => 'setConstantSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'variable_symbol' => 'getVariableSymbol', + 'specific_symbol' => 'getSpecificSymbol', + 'constant_symbol' => 'getConstantSymbol' + ]; /** * Array of attributes where the key is the local name, @@ -207,46 +232,52 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('variable_symbol', $data ?? [], null); + $this->setIfExists('specific_symbol', $data ?? [], null); + $this->setIfExists('constant_symbol', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,21 +292,33 @@ public function listInvalidProperties() if ($this->container['variable_symbol'] === null) { $invalidProperties[] = "'variable_symbol' can't be null"; } - if (!preg_match('/^[0-9]{1,10}$/', $this->container['variable_symbol'])) { + if (!preg_match("/^[0-9]{1,10}$/", $this->container['variable_symbol'])) { $invalidProperties[] = "invalid value for 'variable_symbol', must be conform to the pattern /^[0-9]{1,10}$/."; } - if (!is_null($this->container['specific_symbol']) && !preg_match('/^[0-9]{1,10}$/', $this->container['specific_symbol'])) { + if (!is_null($this->container['specific_symbol']) && !preg_match("/^[0-9]{1,10}$/", $this->container['specific_symbol'])) { $invalidProperties[] = "invalid value for 'specific_symbol', must be conform to the pattern /^[0-9]{1,10}$/."; } - if (!is_null($this->container['constant_symbol']) && !preg_match('/^[0-9]{1,4}$/', $this->container['constant_symbol'])) { + if (!is_null($this->container['constant_symbol']) && !preg_match("/^[0-9]{1,4}$/", $this->container['constant_symbol'])) { $invalidProperties[] = "invalid value for 'constant_symbol', must be conform to the pattern /^[0-9]{1,4}$/."; } return $invalidProperties; } + /** + * 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 variable_symbol * @@ -296,11 +339,11 @@ public function getVariableSymbol() public function setVariableSymbol($variable_symbol) { if (is_null($variable_symbol)) { - throw new SanitizedInvalidArgumentException('non-nullable variable_symbol cannot be null'); + throw new \InvalidArgumentException('non-nullable variable_symbol cannot be null'); } - if (!preg_match('/^[0-9]{1,10}$/', ObjectSerializer::toString($variable_symbol))) { - throw new SanitizedInvalidArgumentException('invalid value for $variable_symbol when calling E2e., must conform to the pattern /^[0-9]{1,10}$/.'); + if ((!preg_match("/^[0-9]{1,10}$/", ObjectSerializer::toString($variable_symbol)))) { + throw new \InvalidArgumentException("invalid value for \$variable_symbol when calling E2e., must conform to the pattern /^[0-9]{1,10}$/."); } $this->container['variable_symbol'] = $variable_symbol; @@ -328,11 +371,11 @@ public function getSpecificSymbol() public function setSpecificSymbol($specific_symbol) { if (is_null($specific_symbol)) { - throw new SanitizedInvalidArgumentException('non-nullable specific_symbol cannot be null'); + throw new \InvalidArgumentException('non-nullable specific_symbol cannot be null'); } - if (!preg_match('/^[0-9]{1,10}$/', ObjectSerializer::toString($specific_symbol))) { - throw new SanitizedInvalidArgumentException('invalid value for $specific_symbol when calling E2e., must conform to the pattern /^[0-9]{1,10}$/.'); + if ((!preg_match("/^[0-9]{1,10}$/", ObjectSerializer::toString($specific_symbol)))) { + throw new \InvalidArgumentException("invalid value for \$specific_symbol when calling E2e., must conform to the pattern /^[0-9]{1,10}$/."); } $this->container['specific_symbol'] = $specific_symbol; @@ -360,24 +403,23 @@ public function getConstantSymbol() public function setConstantSymbol($constant_symbol) { if (is_null($constant_symbol)) { - throw new SanitizedInvalidArgumentException('non-nullable constant_symbol cannot be null'); + throw new \InvalidArgumentException('non-nullable constant_symbol cannot be null'); } - if (!preg_match('/^[0-9]{1,4}$/', ObjectSerializer::toString($constant_symbol))) { - throw new SanitizedInvalidArgumentException('invalid value for $constant_symbol when calling E2e., must conform to the pattern /^[0-9]{1,4}$/.'); + if ((!preg_match("/^[0-9]{1,4}$/", ObjectSerializer::toString($constant_symbol)))) { + throw new \InvalidArgumentException("invalid value for \$constant_symbol when calling E2e., must conform to the pattern /^[0-9]{1,4}$/."); } $this->container['constant_symbol'] = $constant_symbol; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -387,7 +429,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -401,7 +443,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -417,7 +459,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -427,12 +469,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/InitiateDirectTransactionRequest.php b/lib/Model/InitiateDirectTransactionRequest.php old mode 100755 new mode 100644 index bc608b4..a5503c3 --- a/lib/Model/InitiateDirectTransactionRequest.php +++ b/lib/Model/InitiateDirectTransactionRequest.php @@ -2,162 +2,161 @@ /** * InitiateDirectTransactionRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class InitiateDirectTransactionRequest implements ModelInterface, \ArrayAccess +/** + * InitiateDirectTransactionRequest Class Doc Comment + * + * @category Class + * @description Body for direct transaction initiation + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class InitiateDirectTransactionRequest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'initiateDirectTransactionRequest'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'amount' => '\Tatrapayplus\TatrapayplusApiClient\Model\Amount', 'end_to_end' => '\Tatrapayplus\TatrapayplusApiClient\Model\E2e', 'is_pre_authorization' => 'bool', 'tds_data' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionTDSData', 'ipsp_data' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionIPSPData', - 'token' => '\Tatrapayplus\TatrapayplusApiClient\Model\Token', + 'token' => '\Tatrapayplus\TatrapayplusApiClient\Model\Token' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'amount' => null, 'end_to_end' => null, 'is_pre_authorization' => null, 'tds_data' => null, 'ipsp_data' => null, - 'token' => null, + 'token' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'amount' => false, 'end_to_end' => false, - 'is_pre_authorization' => true, + 'is_pre_authorization' => false, 'tds_data' => false, - 'ipsp_data' => true, - 'token' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'amount' => 'amount', - 'end_to_end' => 'endToEnd', - 'is_pre_authorization' => 'isPreAuthorization', - 'tds_data' => 'tdsData', - 'ipsp_data' => 'ipspData', - 'token' => 'token', + 'ipsp_data' => false, + 'token' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'amount' => 'setAmount', - 'end_to_end' => 'setEndToEnd', - 'is_pre_authorization' => 'setIsPreAuthorization', - 'tds_data' => 'setTdsData', - 'ipsp_data' => 'setIpspData', - 'token' => 'setToken', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'amount' => 'getAmount', - 'end_to_end' => 'getEndToEnd', - 'is_pre_authorization' => 'getIsPreAuthorization', - 'tds_data' => 'getTdsData', - 'ipsp_data' => 'getIpspData', - 'token' => 'getToken', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('amount', $data ?? [], null); - $this->setIfExists('end_to_end', $data ?? [], null); - $this->setIfExists('is_pre_authorization', $data ?? [], null); - $this->setIfExists('tds_data', $data ?? [], null); - $this->setIfExists('ipsp_data', $data ?? [], null); - $this->setIfExists('token', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -166,34 +165,58 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'amount' => 'amount', + 'end_to_end' => 'endToEnd', + 'is_pre_authorization' => 'isPreAuthorization', + 'tds_data' => 'tdsData', + 'ipsp_data' => 'ipspData', + 'token' => 'token' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'amount' => 'setAmount', + 'end_to_end' => 'setEndToEnd', + 'is_pre_authorization' => 'setIsPreAuthorization', + 'tds_data' => 'setTdsData', + 'ipsp_data' => 'setIpspData', + 'token' => 'setToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'end_to_end' => 'getEndToEnd', + 'is_pre_authorization' => 'getIsPreAuthorization', + 'tds_data' => 'getTdsData', + 'ipsp_data' => 'getIpspData', + 'token' => 'getToken' + ]; /** * Array of attributes where the key is the local name, @@ -227,46 +250,55 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('end_to_end', $data ?? [], null); + $this->setIfExists('is_pre_authorization', $data ?? [], null); + $this->setIfExists('tds_data', $data ?? [], null); + $this->setIfExists('ipsp_data', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -290,14 +322,25 @@ public function listInvalidProperties() if ($this->container['token'] === null) { $invalidProperties[] = "'token' can't be null"; } - return $invalidProperties; } + /** + * 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 amount * - * @return Amount + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Amount */ public function getAmount() { @@ -307,14 +350,14 @@ public function getAmount() /** * Sets amount * - * @param Amount $amount amount + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Amount $amount amount * * @return self */ public function setAmount($amount) { if (is_null($amount)) { - throw new SanitizedInvalidArgumentException('non-nullable amount cannot be null'); + throw new \InvalidArgumentException('non-nullable amount cannot be null'); } $this->container['amount'] = $amount; @@ -324,7 +367,7 @@ public function setAmount($amount) /** * Gets end_to_end * - * @return E2e + * @return \Tatrapayplus\TatrapayplusApiClient\Model\E2e */ public function getEndToEnd() { @@ -334,14 +377,14 @@ public function getEndToEnd() /** * Sets end_to_end * - * @param E2e $end_to_end end_to_end + * @param \Tatrapayplus\TatrapayplusApiClient\Model\E2e $end_to_end end_to_end * * @return self */ public function setEndToEnd($end_to_end) { if (is_null($end_to_end)) { - throw new SanitizedInvalidArgumentException('non-nullable end_to_end cannot be null'); + throw new \InvalidArgumentException('non-nullable end_to_end cannot be null'); } $this->container['end_to_end'] = $end_to_end; @@ -351,7 +394,7 @@ public function setEndToEnd($end_to_end) /** * Gets is_pre_authorization * - * @return bool + * @return bool|null */ public function getIsPreAuthorization() { @@ -361,12 +404,15 @@ public function getIsPreAuthorization() /** * Sets is_pre_authorization * - * @param bool $is_pre_authorization is_pre_authorization + * @param bool|null $is_pre_authorization If true - pre-authorization transaction * * @return self */ public function setIsPreAuthorization($is_pre_authorization) { + if (is_null($is_pre_authorization)) { + throw new \InvalidArgumentException('non-nullable is_pre_authorization cannot be null'); + } $this->container['is_pre_authorization'] = $is_pre_authorization; return $this; @@ -375,7 +421,7 @@ public function setIsPreAuthorization($is_pre_authorization) /** * Gets tds_data * - * @return DirectTransactionTDSData + * @return \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionTDSData */ public function getTdsData() { @@ -385,14 +431,14 @@ public function getTdsData() /** * Sets tds_data * - * @param DirectTransactionTDSData $tds_data tds_data + * @param \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionTDSData $tds_data tds_data * * @return self */ public function setTdsData($tds_data) { if (is_null($tds_data)) { - throw new SanitizedInvalidArgumentException('non-nullable tds_data cannot be null'); + throw new \InvalidArgumentException('non-nullable tds_data cannot be null'); } $this->container['tds_data'] = $tds_data; @@ -402,7 +448,7 @@ public function setTdsData($tds_data) /** * Gets ipsp_data * - * @return DirectTransactionIPSPData + * @return \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionIPSPData|null */ public function getIpspData() { @@ -412,12 +458,15 @@ public function getIpspData() /** * Sets ipsp_data * - * @param DirectTransactionIPSPData $ipsp_data tds_data + * @param \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionIPSPData|null $ipsp_data ipsp_data * * @return self */ public function setIpspData($ipsp_data) { + if (is_null($ipsp_data)) { + throw new \InvalidArgumentException('non-nullable ipsp_data cannot be null'); + } $this->container['ipsp_data'] = $ipsp_data; return $this; @@ -426,7 +475,7 @@ public function setIpspData($ipsp_data) /** * Gets token * - * @return Token + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Token */ public function getToken() { @@ -436,26 +485,25 @@ public function getToken() /** * Sets token * - * @param Token $token token + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Token $token token * * @return self */ public function setToken($token) { if (is_null($token)) { - throw new SanitizedInvalidArgumentException('non-nullable token cannot be null'); + throw new \InvalidArgumentException('non-nullable token cannot be null'); } $this->container['token'] = $token; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -465,7 +513,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -479,7 +527,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -495,7 +543,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -505,12 +553,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/InitiateDirectTransactionResponse.php b/lib/Model/InitiateDirectTransactionResponse.php old mode 100755 new mode 100644 index 2d31f8e..a2733e2 --- a/lib/Model/InitiateDirectTransactionResponse.php +++ b/lib/Model/InitiateDirectTransactionResponse.php @@ -2,133 +2,148 @@ /** * InitiateDirectTransactionResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class InitiateDirectTransactionResponse implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * InitiateDirectTransactionResponse Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class InitiateDirectTransactionResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'initiateDirectTransactionResponse'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'payment_id' => 'string', - 'redirect_form_html' => 'string', + 'redirect_form_html' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'payment_id' => '$uuid', - 'redirect_form_html' => null, + 'redirect_form_html' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'payment_id' => false, - 'redirect_form_html' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'payment_id' => 'paymentId', - 'redirect_form_html' => 'redirectFormHtml', + 'redirect_form_html' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'payment_id' => 'setPaymentId', - 'redirect_form_html' => 'setRedirectFormHtml', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'payment_id' => 'getPaymentId', - 'redirect_form_html' => 'getRedirectFormHtml', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('payment_id', $data ?? [], null); - $this->setIfExists('redirect_form_html', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +152,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'payment_id' => 'paymentId', + 'redirect_form_html' => 'redirectFormHtml' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'payment_id' => 'setPaymentId', + 'redirect_form_html' => 'setRedirectFormHtml' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_id' => 'getPaymentId', + 'redirect_form_html' => 'getRedirectFormHtml' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +225,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('payment_id', $data ?? [], null); + $this->setIfExists('redirect_form_html', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -252,10 +284,25 @@ public function listInvalidProperties() if ($this->container['payment_id'] === null) { $invalidProperties[] = "'payment_id' can't be null"; } + if (!is_null($this->container['redirect_form_html']) && (mb_strlen($this->container['redirect_form_html']) > 300000)) { + $invalidProperties[] = "invalid value for 'redirect_form_html', the character length must be smaller than or equal to 300000."; + } return $invalidProperties; } + /** + * 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 payment_id * @@ -276,7 +323,7 @@ public function getPaymentId() public function setPaymentId($payment_id) { if (is_null($payment_id)) { - throw new SanitizedInvalidArgumentException('non-nullable payment_id cannot be null'); + throw new \InvalidArgumentException('non-nullable payment_id cannot be null'); } $this->container['payment_id'] = $payment_id; @@ -296,26 +343,29 @@ public function getRedirectFormHtml() /** * Sets redirect_form_html * - * @param string|null redirect_form_html + * @param string|null $redirect_form_html HTML form. Only for status TDS_AUTH_REQUIRED * * @return self */ public function setRedirectFormHtml($redirect_form_html) { if (is_null($redirect_form_html)) { - throw new SanitizedInvalidArgumentException('non-nullable redirect_form_html cannot be null'); + throw new \InvalidArgumentException('non-nullable redirect_form_html cannot be null'); } + if ((mb_strlen($redirect_form_html) > 300000)) { + throw new \InvalidArgumentException('invalid length for $redirect_form_html when calling InitiateDirectTransactionResponse., must be smaller than or equal to 300000.'); + } + $this->container['redirect_form_html'] = $redirect_form_html; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -325,7 +375,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -339,7 +389,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -355,7 +405,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -365,12 +415,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/InitiatePaymentRequest.php b/lib/Model/InitiatePaymentRequest.php old mode 100755 new mode 100644 index 4c30221..74046bc --- a/lib/Model/InitiatePaymentRequest.php +++ b/lib/Model/InitiatePaymentRequest.php @@ -2,154 +2,158 @@ /** * InitiatePaymentRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class InitiatePaymentRequest implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * InitiatePaymentRequest Class Doc Comment + * + * @category Class + * @description Body for payment initiation + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class InitiatePaymentRequest implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'initiatePaymentRequest'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'base_payment' => '\Tatrapayplus\TatrapayplusApiClient\Model\BasePayment', 'user_data' => '\Tatrapayplus\TatrapayplusApiClient\Model\UserData', 'bank_transfer' => '\Tatrapayplus\TatrapayplusApiClient\Model\BankTransfer', 'card_detail' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardDetail', - 'pay_later' => '\Tatrapayplus\TatrapayplusApiClient\Model\PayLater', + 'pay_later' => '\Tatrapayplus\TatrapayplusApiClient\Model\PayLater' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'base_payment' => null, 'user_data' => null, 'bank_transfer' => null, 'card_detail' => null, - 'pay_later' => null, + 'pay_later' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'base_payment' => false, 'user_data' => false, 'bank_transfer' => false, 'card_detail' => false, - 'pay_later' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'base_payment' => 'basePayment', - 'user_data' => 'userData', - 'bank_transfer' => 'bankTransfer', - 'card_detail' => 'cardDetail', - 'pay_later' => 'payLater', + 'pay_later' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'base_payment' => 'setBasePayment', - 'user_data' => 'setUserData', - 'bank_transfer' => 'setBankTransfer', - 'card_detail' => 'setCardDetail', - 'pay_later' => 'setPayLater', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'base_payment' => 'getBasePayment', - 'user_data' => 'getUserData', - 'bank_transfer' => 'getBankTransfer', - 'card_detail' => 'getCardDetail', - 'pay_later' => 'getPayLater', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('base_payment', $data ?? [], null); - $this->setIfExists('user_data', $data ?? [], null); - $this->setIfExists('bank_transfer', $data ?? [], null); - $this->setIfExists('card_detail', $data ?? [], null); - $this->setIfExists('pay_later', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -158,34 +162,55 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'base_payment' => 'basePayment', + 'user_data' => 'userData', + 'bank_transfer' => 'bankTransfer', + 'card_detail' => 'cardDetail', + 'pay_later' => 'payLater' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'base_payment' => 'setBasePayment', + 'user_data' => 'setUserData', + 'bank_transfer' => 'setBankTransfer', + 'card_detail' => 'setCardDetail', + 'pay_later' => 'setPayLater' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'base_payment' => 'getBasePayment', + 'user_data' => 'getUserData', + 'bank_transfer' => 'getBankTransfer', + 'card_detail' => 'getCardDetail', + 'pay_later' => 'getPayLater' + ]; /** * Array of attributes where the key is the local name, @@ -219,46 +244,54 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('base_payment', $data ?? [], null); + $this->setIfExists('user_data', $data ?? [], null); + $this->setIfExists('bank_transfer', $data ?? [], null); + $this->setIfExists('card_detail', $data ?? [], null); + $this->setIfExists('pay_later', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -273,14 +306,25 @@ public function listInvalidProperties() if ($this->container['base_payment'] === null) { $invalidProperties[] = "'base_payment' can't be null"; } - return $invalidProperties; } + /** + * 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 base_payment * - * @return BasePayment + * @return \Tatrapayplus\TatrapayplusApiClient\Model\BasePayment */ public function getBasePayment() { @@ -290,14 +334,14 @@ public function getBasePayment() /** * Sets base_payment * - * @param BasePayment $base_payment base_payment + * @param \Tatrapayplus\TatrapayplusApiClient\Model\BasePayment $base_payment base_payment * * @return self */ public function setBasePayment($base_payment) { if (is_null($base_payment)) { - throw new SanitizedInvalidArgumentException('non-nullable base_payment cannot be null'); + throw new \InvalidArgumentException('non-nullable base_payment cannot be null'); } $this->container['base_payment'] = $base_payment; @@ -307,7 +351,7 @@ public function setBasePayment($base_payment) /** * Gets user_data * - * @return UserData|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\UserData|null */ public function getUserData() { @@ -317,14 +361,14 @@ public function getUserData() /** * Sets user_data * - * @param UserData|null $user_data user_data + * @param \Tatrapayplus\TatrapayplusApiClient\Model\UserData|null $user_data user_data * * @return self */ public function setUserData($user_data) { if (is_null($user_data)) { - throw new SanitizedInvalidArgumentException('non-nullable user_data cannot be null'); + throw new \InvalidArgumentException('non-nullable user_data cannot be null'); } $this->container['user_data'] = $user_data; @@ -334,7 +378,7 @@ public function setUserData($user_data) /** * Gets bank_transfer * - * @return BankTransfer|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\BankTransfer|null */ public function getBankTransfer() { @@ -344,14 +388,14 @@ public function getBankTransfer() /** * Sets bank_transfer * - * @param BankTransfer|null $bank_transfer bank_transfer + * @param \Tatrapayplus\TatrapayplusApiClient\Model\BankTransfer|null $bank_transfer bank_transfer * * @return self */ public function setBankTransfer($bank_transfer) { if (is_null($bank_transfer)) { - throw new SanitizedInvalidArgumentException('non-nullable bank_transfer cannot be null'); + throw new \InvalidArgumentException('non-nullable bank_transfer cannot be null'); } $this->container['bank_transfer'] = $bank_transfer; @@ -361,7 +405,7 @@ public function setBankTransfer($bank_transfer) /** * Gets card_detail * - * @return CardDetail|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardDetail|null */ public function getCardDetail() { @@ -371,14 +415,14 @@ public function getCardDetail() /** * Sets card_detail * - * @param CardDetail|null $card_detail card_detail + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardDetail|null $card_detail card_detail * * @return self */ public function setCardDetail($card_detail) { if (is_null($card_detail)) { - throw new SanitizedInvalidArgumentException('non-nullable card_detail cannot be null'); + throw new \InvalidArgumentException('non-nullable card_detail cannot be null'); } $this->container['card_detail'] = $card_detail; @@ -388,7 +432,7 @@ public function setCardDetail($card_detail) /** * Gets pay_later * - * @return PayLater|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\PayLater|null */ public function getPayLater() { @@ -398,26 +442,25 @@ public function getPayLater() /** * Sets pay_later * - * @param PayLater|null $pay_later pay_later + * @param \Tatrapayplus\TatrapayplusApiClient\Model\PayLater|null $pay_later pay_later * * @return self */ public function setPayLater($pay_later) { if (is_null($pay_later)) { - throw new SanitizedInvalidArgumentException('non-nullable pay_later cannot be null'); + throw new \InvalidArgumentException('non-nullable pay_later cannot be null'); } $this->container['pay_later'] = $pay_later; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -427,7 +470,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -441,7 +484,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -457,7 +500,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -467,12 +510,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/InitiatePaymentResponse.php b/lib/Model/InitiatePaymentResponse.php old mode 100755 new mode 100644 index 1001787..3bebb24 --- a/lib/Model/InitiatePaymentResponse.php +++ b/lib/Model/InitiatePaymentResponse.php @@ -2,140 +2,151 @@ /** * InitiatePaymentResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class InitiatePaymentResponse implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * InitiatePaymentResponse Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class InitiatePaymentResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'initiatePaymentResponse'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'payment_id' => 'string', 'tatra_pay_plus_url' => 'string', - 'available_payment_methods' => '\Tatrapayplus\TatrapayplusApiClient\Model\AvailablePaymentMethod[]', + 'available_payment_methods' => '\Tatrapayplus\TatrapayplusApiClient\Model\AvailablePaymentMethod[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'payment_id' => '$uuid', 'tatra_pay_plus_url' => '$url', - 'available_payment_methods' => null, + 'available_payment_methods' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'payment_id' => false, 'tatra_pay_plus_url' => false, - 'available_payment_methods' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'payment_id' => 'paymentId', - 'tatra_pay_plus_url' => 'tatraPayPlusUrl', - 'available_payment_methods' => 'availablePaymentMethods', + 'available_payment_methods' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'payment_id' => 'setPaymentId', - 'tatra_pay_plus_url' => 'setTatraPayPlusUrl', - 'available_payment_methods' => 'setAvailablePaymentMethods', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'payment_id' => 'getPaymentId', - 'tatra_pay_plus_url' => 'getTatraPayPlusUrl', - 'available_payment_methods' => 'getAvailablePaymentMethods', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('payment_id', $data ?? [], null); - $this->setIfExists('tatra_pay_plus_url', $data ?? [], null); - $this->setIfExists('available_payment_methods', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -144,34 +155,49 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'payment_id' => 'paymentId', + 'tatra_pay_plus_url' => 'tatraPayPlusUrl', + 'available_payment_methods' => 'availablePaymentMethods' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'payment_id' => 'setPaymentId', + 'tatra_pay_plus_url' => 'setTatraPayPlusUrl', + 'available_payment_methods' => 'setAvailablePaymentMethods' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_id' => 'getPaymentId', + 'tatra_pay_plus_url' => 'getTatraPayPlusUrl', + 'available_payment_methods' => 'getAvailablePaymentMethods' + ]; /** * Array of attributes where the key is the local name, @@ -205,46 +231,52 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('payment_id', $data ?? [], null); + $this->setIfExists('tatra_pay_plus_url', $data ?? [], null); + $this->setIfExists('available_payment_methods', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -259,10 +291,21 @@ public function listInvalidProperties() if ($this->container['payment_id'] === null) { $invalidProperties[] = "'payment_id' can't be null"; } - return $invalidProperties; } + /** + * 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 payment_id * @@ -283,7 +326,7 @@ public function getPaymentId() public function setPaymentId($payment_id) { if (is_null($payment_id)) { - throw new SanitizedInvalidArgumentException('non-nullable payment_id cannot be null'); + throw new \InvalidArgumentException('non-nullable payment_id cannot be null'); } $this->container['payment_id'] = $payment_id; @@ -310,7 +353,7 @@ public function getTatraPayPlusUrl() public function setTatraPayPlusUrl($tatra_pay_plus_url) { if (is_null($tatra_pay_plus_url)) { - throw new SanitizedInvalidArgumentException('non-nullable tatra_pay_plus_url cannot be null'); + throw new \InvalidArgumentException('non-nullable tatra_pay_plus_url cannot be null'); } $this->container['tatra_pay_plus_url'] = $tatra_pay_plus_url; @@ -330,26 +373,25 @@ public function getAvailablePaymentMethods() /** * Sets available_payment_methods * - * @param \Tatrapayplus\TatrapayplusApiClient\Model\AvailablePaymentMethod[]|null $available_payment_methods list of availibility of each possible methods + * @param \Tatrapayplus\TatrapayplusApiClient\Model\AvailablePaymentMethod[]|null $available_payment_methods List of availibility of each possible methods. * * @return self */ public function setAvailablePaymentMethods($available_payment_methods) { if (is_null($available_payment_methods)) { - throw new SanitizedInvalidArgumentException('non-nullable available_payment_methods cannot be null'); + throw new \InvalidArgumentException('non-nullable available_payment_methods cannot be null'); } $this->container['available_payment_methods'] = $available_payment_methods; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -359,7 +401,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -373,7 +415,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -389,7 +431,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -399,12 +441,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/ItemDetail.php b/lib/Model/ItemDetail.php old mode 100755 new mode 100644 index 1d7e2bc..749bb31 --- a/lib/Model/ItemDetail.php +++ b/lib/Model/ItemDetail.php @@ -2,133 +2,148 @@ /** * ItemDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class ItemDetail implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * ItemDetail Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class ItemDetail implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'itemDetail'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'item_detail_sk' => '\Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit', - 'item_detail_en' => '\Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit', + 'item_detail_en' => '\Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'item_detail_sk' => null, - 'item_detail_en' => null, + 'item_detail_en' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'item_detail_sk' => false, - 'item_detail_en' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'item_detail_sk' => 'itemDetailSK', - 'item_detail_en' => 'itemDetailEN', + 'item_detail_en' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'item_detail_sk' => 'setItemDetailSk', - 'item_detail_en' => 'setItemDetailEn', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'item_detail_sk' => 'getItemDetailSk', - 'item_detail_en' => 'getItemDetailEn', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('item_detail_sk', $data ?? [], null); - $this->setIfExists('item_detail_en', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +152,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'item_detail_sk' => 'itemDetailSK', + 'item_detail_en' => 'itemDetailEN' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'item_detail_sk' => 'setItemDetailSk', + 'item_detail_en' => 'setItemDetailEn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'item_detail_sk' => 'getItemDetailSk', + 'item_detail_en' => 'getItemDetailEn' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +225,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('item_detail_sk', $data ?? [], null); + $this->setIfExists('item_detail_en', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -252,14 +284,25 @@ public function listInvalidProperties() if ($this->container['item_detail_sk'] === null) { $invalidProperties[] = "'item_detail_sk' can't be null"; } - return $invalidProperties; } + /** + * 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 item_detail_sk * - * @return ItemDetailLangUnit + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit */ public function getItemDetailSk() { @@ -269,14 +312,14 @@ public function getItemDetailSk() /** * Sets item_detail_sk * - * @param ItemDetailLangUnit $item_detail_sk item_detail_sk + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit $item_detail_sk item_detail_sk * * @return self */ public function setItemDetailSk($item_detail_sk) { if (is_null($item_detail_sk)) { - throw new SanitizedInvalidArgumentException('non-nullable item_detail_sk cannot be null'); + throw new \InvalidArgumentException('non-nullable item_detail_sk cannot be null'); } $this->container['item_detail_sk'] = $item_detail_sk; @@ -286,7 +329,7 @@ public function setItemDetailSk($item_detail_sk) /** * Gets item_detail_en * - * @return ItemDetailLangUnit|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit|null */ public function getItemDetailEn() { @@ -296,26 +339,25 @@ public function getItemDetailEn() /** * Sets item_detail_en * - * @param ItemDetailLangUnit|null $item_detail_en item_detail_en + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit|null $item_detail_en item_detail_en * * @return self */ public function setItemDetailEn($item_detail_en) { if (is_null($item_detail_en)) { - throw new SanitizedInvalidArgumentException('non-nullable item_detail_en cannot be null'); + throw new \InvalidArgumentException('non-nullable item_detail_en cannot be null'); } $this->container['item_detail_en'] = $item_detail_en; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -325,7 +367,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -339,7 +381,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -355,7 +397,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -365,12 +407,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/ItemDetailLangUnit.php b/lib/Model/ItemDetailLangUnit.php old mode 100755 new mode 100644 index 28c813e..4fda584 --- a/lib/Model/ItemDetailLangUnit.php +++ b/lib/Model/ItemDetailLangUnit.php @@ -2,133 +2,148 @@ /** * ItemDetailLangUnit * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class ItemDetailLangUnit implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * ItemDetailLangUnit Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class ItemDetailLangUnit implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'itemDetailLangUnit'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'item_name' => 'string', - 'item_description' => 'string', + 'item_description' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'item_name' => null, - 'item_description' => null, + 'item_description' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'item_name' => false, - 'item_description' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'item_name' => 'itemName', - 'item_description' => 'itemDescription', + 'item_description' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'item_name' => 'setItemName', - 'item_description' => 'setItemDescription', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'item_name' => 'getItemName', - 'item_description' => 'getItemDescription', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('item_name', $data ?? [], null); - $this->setIfExists('item_description', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +152,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'item_name' => 'itemName', + 'item_description' => 'itemDescription' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'item_name' => 'setItemName', + 'item_description' => 'setItemDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'item_name' => 'getItemName', + 'item_description' => 'getItemDescription' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +225,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('item_name', $data ?? [], null); + $this->setIfExists('item_description', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -252,11 +284,11 @@ public function listInvalidProperties() if ($this->container['item_name'] === null) { $invalidProperties[] = "'item_name' can't be null"; } - if (mb_strlen($this->container['item_name']) > 255) { + if ((mb_strlen($this->container['item_name']) > 255)) { $invalidProperties[] = "invalid value for 'item_name', the character length must be smaller than or equal to 255."; } - if (mb_strlen($this->container['item_name']) < 1) { + if ((mb_strlen($this->container['item_name']) < 1)) { $invalidProperties[] = "invalid value for 'item_name', the character length must be bigger than or equal to 1."; } @@ -271,6 +303,18 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 item_name * @@ -291,13 +335,13 @@ public function getItemName() public function setItemName($item_name) { if (is_null($item_name)) { - throw new SanitizedInvalidArgumentException('non-nullable item_name cannot be null'); + throw new \InvalidArgumentException('non-nullable item_name cannot be null'); } - if (mb_strlen($item_name) > 255) { - throw new SanitizedInvalidArgumentException('invalid length for $item_name when calling ItemDetailLangUnit., must be smaller than or equal to 255.'); + if ((mb_strlen($item_name) > 255)) { + throw new \InvalidArgumentException('invalid length for $item_name when calling ItemDetailLangUnit., must be smaller than or equal to 255.'); } - if (mb_strlen($item_name) < 1) { - throw new SanitizedInvalidArgumentException('invalid length for $item_name when calling ItemDetailLangUnit., must be bigger than or equal to 1.'); + if ((mb_strlen($item_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $item_name when calling ItemDetailLangUnit., must be bigger than or equal to 1.'); } $this->container['item_name'] = $item_name; @@ -325,26 +369,25 @@ public function getItemDescription() public function setItemDescription($item_description) { if (is_null($item_description)) { - throw new SanitizedInvalidArgumentException('non-nullable item_description cannot be null'); + throw new \InvalidArgumentException('non-nullable item_description cannot be null'); } - if (mb_strlen($item_description) > 1000) { - throw new SanitizedInvalidArgumentException('invalid length for $item_description when calling ItemDetailLangUnit., must be smaller than or equal to 1000.'); + if ((mb_strlen($item_description) > 1000)) { + throw new \InvalidArgumentException('invalid length for $item_description when calling ItemDetailLangUnit., must be smaller than or equal to 1000.'); } - if (mb_strlen($item_description) < 1) { - throw new SanitizedInvalidArgumentException('invalid length for $item_description when calling ItemDetailLangUnit., must be bigger than or equal to 1.'); + if ((mb_strlen($item_description) < 1)) { + throw new \InvalidArgumentException('invalid length for $item_description when calling ItemDetailLangUnit., must be bigger than or equal to 1.'); } $this->container['item_description'] = $item_description; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -354,7 +397,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -368,7 +411,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -384,7 +427,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -394,12 +437,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/Model400ErrorBody.php b/lib/Model/Model400ErrorBody.php old mode 100755 new mode 100644 index 182b5be..345785c --- a/lib/Model/Model400ErrorBody.php +++ b/lib/Model/Model400ErrorBody.php @@ -2,151 +2,151 @@ /** * Model400ErrorBody * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class Model400ErrorBody implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * Model400ErrorBody Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class Model400ErrorBody implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; - public const ERROR_CODE_NO_CONTRACT = 'NO_CONTRACT'; - public const ERROR_CODE_ILLEGAL_ARGUMENT = 'ILLEGAL_ARGUMENT'; - public const ERROR_CODE_TOT_AMNT_LOW = 'TOT_AMNT_LOW'; - public const ERROR_CODE_TOT_AMNT_MISMATCH = 'TOT_AMNT_MISMATCH'; - public const ERROR_CODE_PAYMENT_NOT_FOUND = 'PAYMENT_NOT_FOUND'; - public const ERROR_CODE_NOT_ALLOWED_OPER = 'NOT_ALLOWED_OPER'; - public const ERROR_CODE_DUPLICATE_CALL = 'DUPLICATE_CALL'; - public const ERROR_CODE_PA_AMOUNT_EXCEEDED = 'PA_AMOUNT_EXCEEDED'; - public const ERROR_CODE_PA_NOT_FOUND = 'PA_NOT_FOUND'; - public const ERROR_CODE_PA_ERROR = 'PA_ERROR'; - public const ERROR_CODE_CB_AMOUNT_EXCEEDED = 'CB_AMOUNT_EXCEEDED'; - public const ERROR_CODE_CB_NOT_FOUND = 'CB_NOT_FOUND'; - public const ERROR_CODE_CB_TOO_OLD = 'CB_TOO_OLD'; - public const ERROR_CODE_CB_ERROR = 'CB_ERROR'; - public const ERROR_CODE_NO_AVAIL_PAY_METH = 'NO_AVAIL_PAY_METH'; + /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = '400_errorBody'; + /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'error_code' => 'string', 'error_description' => 'string', - 'available_payment_methods' => '\Tatrapayplus\TatrapayplusApiClient\Model\AvailablePaymentMethod[]', + 'available_payment_methods' => '\Tatrapayplus\TatrapayplusApiClient\Model\AvailablePaymentMethod[]' ]; + /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'error_code' => null, 'error_description' => null, - 'available_payment_methods' => null, + 'available_payment_methods' => null ]; + /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'error_code' => false, 'error_description' => false, - 'available_payment_methods' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'error_code' => 'errorCode', - 'error_description' => 'errorDescription', - 'available_payment_methods' => 'availablePaymentMethods', + 'available_payment_methods' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'error_code' => 'setErrorCode', - 'error_description' => 'setErrorDescription', - 'available_payment_methods' => 'setAvailablePaymentMethods', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'error_code' => 'getErrorCode', - 'error_description' => 'getErrorDescription', - 'available_payment_methods' => 'getAvailablePaymentMethods', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('error_code', $data ?? [], null); - $this->setIfExists('error_description', $data ?? [], null); - $this->setIfExists('available_payment_methods', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -155,34 +155,49 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'error_code' => 'errorCode', + 'error_description' => 'errorDescription', + 'available_payment_methods' => 'availablePaymentMethods' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'error_description' => 'setErrorDescription', + 'available_payment_methods' => 'setAvailablePaymentMethods' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'error_description' => 'getErrorDescription', + 'available_payment_methods' => 'getAvailablePaymentMethods' + ]; /** * Array of attributes where the key is the local name, @@ -216,46 +231,93 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + public const ERROR_CODE_NO_CONTRACT = 'NO_CONTRACT'; + public const ERROR_CODE_ILLEGAL_ARGUMENT = 'ILLEGAL_ARGUMENT'; + public const ERROR_CODE_TOT_AMNT_LOW = 'TOT_AMNT_LOW'; + public const ERROR_CODE_TOT_AMNT_MISMATCH = 'TOT_AMNT_MISMATCH'; + public const ERROR_CODE_PAYMENT_NOT_FOUND = 'PAYMENT_NOT_FOUND'; + public const ERROR_CODE_NOT_ALLOWED_OPER = 'NOT_ALLOWED_OPER'; + public const ERROR_CODE_DUPLICATE_CALL = 'DUPLICATE_CALL'; + public const ERROR_CODE_PA_AMOUNT_EXCEEDED = 'PA_AMOUNT_EXCEEDED'; + public const ERROR_CODE_PA_NOT_FOUND = 'PA_NOT_FOUND'; + public const ERROR_CODE_PA_ERROR = 'PA_ERROR'; + public const ERROR_CODE_CB_AMOUNT_EXCEEDED = 'CB_AMOUNT_EXCEEDED'; + public const ERROR_CODE_CB_NOT_FOUND = 'CB_NOT_FOUND'; + public const ERROR_CODE_CB_TOO_OLD = 'CB_TOO_OLD'; + public const ERROR_CODE_CB_ERROR = 'CB_ERROR'; + public const ERROR_CODE_NO_AVAIL_PAY_METH = 'NO_AVAIL_PAY_METH'; + /** - * Array of nullable field names deliberately set to null + * Gets allowable values of the enum * - * @return bool[] + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array + public function getErrorCodeAllowableValues() { - return $this->openAPINullablesSetToNull; + return [ + self::ERROR_CODE_NO_CONTRACT, + self::ERROR_CODE_ILLEGAL_ARGUMENT, + self::ERROR_CODE_TOT_AMNT_LOW, + self::ERROR_CODE_TOT_AMNT_MISMATCH, + self::ERROR_CODE_PAYMENT_NOT_FOUND, + self::ERROR_CODE_NOT_ALLOWED_OPER, + self::ERROR_CODE_DUPLICATE_CALL, + self::ERROR_CODE_PA_AMOUNT_EXCEEDED, + self::ERROR_CODE_PA_NOT_FOUND, + self::ERROR_CODE_PA_ERROR, + self::ERROR_CODE_CB_AMOUNT_EXCEEDED, + self::ERROR_CODE_CB_NOT_FOUND, + self::ERROR_CODE_CB_TOO_OLD, + self::ERROR_CODE_CB_ERROR, + self::ERROR_CODE_NO_AVAIL_PAY_METH, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() - { - return self::$openAPIModelName; - } + protected $container = []; /** - * Validate all the properties in the model - * return true if all passed + * Constructor * - * @return bool True if all properties are valid + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function valid() + public function __construct(?array $data = null) { - return count($this->listInvalidProperties()) === 0; + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('error_description', $data ?? [], null); + $this->setIfExists('available_payment_methods', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -280,39 +342,25 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'error_code', the character length must be smaller than or equal to 20."; } - if (!is_null($this->container['error_description']) && (mb_strlen($this->container['error_description']) > 3000)) { - $invalidProperties[] = "invalid value for 'error_description', the character length must be smaller than or equal to 3000."; + if (!is_null($this->container['error_description']) && (mb_strlen($this->container['error_description']) > 1024)) { + $invalidProperties[] = "invalid value for 'error_description', the character length must be smaller than or equal to 1024."; } return $invalidProperties; } /** - * Gets allowable values of the enum + * Validate all the properties in the model + * return true if all passed * - * @return string[] + * @return bool True if all properties are valid */ - public function getErrorCodeAllowableValues() + public function valid() { - return [ - self::ERROR_CODE_NO_CONTRACT, - self::ERROR_CODE_ILLEGAL_ARGUMENT, - self::ERROR_CODE_TOT_AMNT_LOW, - self::ERROR_CODE_TOT_AMNT_MISMATCH, - self::ERROR_CODE_PAYMENT_NOT_FOUND, - self::ERROR_CODE_NOT_ALLOWED_OPER, - self::ERROR_CODE_DUPLICATE_CALL, - self::ERROR_CODE_PA_AMOUNT_EXCEEDED, - self::ERROR_CODE_PA_NOT_FOUND, - self::ERROR_CODE_PA_ERROR, - self::ERROR_CODE_CB_AMOUNT_EXCEEDED, - self::ERROR_CODE_CB_NOT_FOUND, - self::ERROR_CODE_CB_TOO_OLD, - self::ERROR_CODE_CB_ERROR, - self::ERROR_CODE_NO_AVAIL_PAY_METH, - ]; + return count($this->listInvalidProperties()) === 0; } + /** * Gets error_code * @@ -333,14 +381,20 @@ public function getErrorCode() public function setErrorCode($error_code) { if (is_null($error_code)) { - throw new SanitizedInvalidArgumentException('non-nullable error_code cannot be null'); + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); } $allowedValues = $this->getErrorCodeAllowableValues(); if (!in_array($error_code, $allowedValues, true)) { - throw new SanitizedInvalidArgumentException(sprintf("Invalid value '%s' for 'error_code', must be one of '%s'", $error_code, implode("', '", $allowedValues))); + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); } - if (mb_strlen($error_code) > 20) { - throw new SanitizedInvalidArgumentException('invalid length for $error_code when calling Model400ErrorBody., must be smaller than or equal to 20.'); + if ((mb_strlen($error_code) > 20)) { + throw new \InvalidArgumentException('invalid length for $error_code when calling Model400ErrorBody., must be smaller than or equal to 20.'); } $this->container['error_code'] = $error_code; @@ -368,10 +422,10 @@ public function getErrorDescription() public function setErrorDescription($error_description) { if (is_null($error_description)) { - throw new SanitizedInvalidArgumentException('non-nullable error_description cannot be null'); + throw new \InvalidArgumentException('non-nullable error_description cannot be null'); } - if (mb_strlen($error_description) > 3000) { - throw new SanitizedInvalidArgumentException('invalid length for $error_description when calling Model400ErrorBody., must be smaller than or equal to 3000.'); + if ((mb_strlen($error_description) > 1024)) { + throw new \InvalidArgumentException('invalid length for $error_description when calling Model400ErrorBody., must be smaller than or equal to 1024.'); } $this->container['error_description'] = $error_description; @@ -399,19 +453,18 @@ public function getAvailablePaymentMethods() public function setAvailablePaymentMethods($available_payment_methods) { if (is_null($available_payment_methods)) { - throw new SanitizedInvalidArgumentException('non-nullable available_payment_methods cannot be null'); + throw new \InvalidArgumentException('non-nullable available_payment_methods cannot be null'); } $this->container['available_payment_methods'] = $available_payment_methods; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -421,7 +474,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -435,7 +488,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -451,7 +504,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -461,12 +514,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/Model40xErrorBody.php b/lib/Model/Model40xErrorBody.php new file mode 100644 index 0000000..ec29606 --- /dev/null +++ b/lib/Model/Model40xErrorBody.php @@ -0,0 +1,500 @@ + + */ +class Model40xErrorBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '40x_errorBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error_code' => 'string', + 'error_description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error_code' => null, + 'error_description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error_code' => false, + 'error_description' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error_code' => 'errorCode', + 'error_description' => 'errorDescription' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error_code' => 'setErrorCode', + 'error_description' => 'setErrorDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error_code' => 'getErrorCode', + 'error_description' => 'getErrorDescription' + ]; + + /** + * 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::$openAPIModelName; + } + + public const ERROR_CODE_NOT_ALLOWED_OPER = 'NOT_ALLOWED_OPER'; + public const ERROR_CODE_TOKEN_UNKNOWN = 'TOKEN_UNKNOWN'; + public const ERROR_CODE_TOKEN_INVALID = 'TOKEN_INVALID'; + public const ERROR_CODE_TOKEN_EXPIRED = 'TOKEN_EXPIRED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getErrorCodeAllowableValues() + { + return [ + self::ERROR_CODE_NOT_ALLOWED_OPER, + self::ERROR_CODE_TOKEN_UNKNOWN, + self::ERROR_CODE_TOKEN_INVALID, + self::ERROR_CODE_TOKEN_EXPIRED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('error_description', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error_code'] === null) { + $invalidProperties[] = "'error_code' can't be null"; + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!is_null($this->container['error_code']) && !in_array($this->container['error_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'error_code', must be one of '%s'", + $this->container['error_code'], + implode("', '", $allowedValues) + ); + } + + if ((mb_strlen($this->container['error_code']) > 20)) { + $invalidProperties[] = "invalid value for 'error_code', the character length must be smaller than or equal to 20."; + } + + if (!is_null($this->container['error_description']) && (mb_strlen($this->container['error_description']) > 1024)) { + $invalidProperties[] = "invalid value for 'error_description', the character length must be smaller than or equal to 1024."; + } + + return $invalidProperties; + } + + /** + * 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 error_code + * + * @return string + */ + public function getErrorCode() + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string $error_code error_code + * + * @return self + */ + public function setErrorCode($error_code) + { + if (is_null($error_code)) { + throw new \InvalidArgumentException('non-nullable error_code cannot be null'); + } + $allowedValues = $this->getErrorCodeAllowableValues(); + if (!in_array($error_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'error_code', must be one of '%s'", + $error_code, + implode("', '", $allowedValues) + ) + ); + } + if ((mb_strlen($error_code) > 20)) { + throw new \InvalidArgumentException('invalid length for $error_code when calling Model40xErrorBody., must be smaller than or equal to 20.'); + } + + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets error_description + * + * @return string|null + */ + public function getErrorDescription() + { + return $this->container['error_description']; + } + + /** + * Sets error_description + * + * @param string|null $error_description error_description + * + * @return self + */ + public function setErrorDescription($error_description) + { + if (is_null($error_description)) { + throw new \InvalidArgumentException('non-nullable error_description cannot be null'); + } + if ((mb_strlen($error_description) > 1024)) { + throw new \InvalidArgumentException('invalid length for $error_description when calling Model40xErrorBody., must be smaller than or equal to 1024.'); + } + + $this->container['error_description'] = $error_description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php old mode 100755 new mode 100644 index d18b190..0f355b4 --- a/lib/Model/ModelInterface.php +++ b/lib/Model/ModelInterface.php @@ -2,19 +2,47 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class - * + * @package Tatrapayplus\TatrapayplusApiClient\Model * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * @see https://openapi-generator.tech + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +/** + * Interface abstracting model access. + * + * @package Tatrapayplus\TatrapayplusApiClient\Model + * @author OpenAPI Generator team + */ interface ModelInterface { + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(); + /** * Array of property to type mappings. Used for (de)serialization * @@ -50,22 +78,6 @@ public static function setters(); */ public static function getters(); - /** - * Checks if a property is nullable - * - * @param string $property - * - * @return bool - */ - public static function isNullable(string $property): bool; - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName(); - /** * Show all the invalid properties with reasons. * @@ -82,10 +94,17 @@ public function listInvalidProperties(); public function valid(); /** - * Checks if a nullable property is set to null. + * Checks if a property is nullable * * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. * + * @param string $property * @return bool */ public function isNullableSetToNull(string $property): bool; diff --git a/lib/Model/Order.php b/lib/Model/Order.php old mode 100755 new mode 100644 index c408729..0ce74ab --- a/lib/Model/Order.php +++ b/lib/Model/Order.php @@ -2,147 +2,155 @@ /** * Order * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class Order implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * Order Class Doc Comment + * + * @category Class + * @description Order detail informations + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class Order implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'order'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'order_no' => 'string', 'order_items' => '\Tatrapayplus\TatrapayplusApiClient\Model\OrderItem[]', 'preferred_loan_duration' => 'int', - 'down_payment' => 'float', + 'down_payment' => 'float' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'order_no' => null, 'order_items' => null, 'preferred_loan_duration' => 'int64', - 'down_payment' => 'double', + 'down_payment' => 'double' ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'order_no' => false, 'order_items' => false, 'preferred_loan_duration' => false, - 'down_payment' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'order_no' => 'orderNo', - 'order_items' => 'orderItems', - 'preferred_loan_duration' => 'preferredLoanDuration', - 'down_payment' => 'downPayment', + 'down_payment' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'order_no' => 'setOrderNo', - 'order_items' => 'setOrderItems', - 'preferred_loan_duration' => 'setPreferredLoanDuration', - 'down_payment' => 'setDownPayment', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'order_no' => 'getOrderNo', - 'order_items' => 'getOrderItems', - 'preferred_loan_duration' => 'getPreferredLoanDuration', - 'down_payment' => 'getDownPayment', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('order_no', $data ?? [], null); - $this->setIfExists('order_items', $data ?? [], null); - $this->setIfExists('preferred_loan_duration', $data ?? [], null); - $this->setIfExists('down_payment', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -151,34 +159,52 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'order_no' => 'orderNo', + 'order_items' => 'orderItems', + 'preferred_loan_duration' => 'preferredLoanDuration', + 'down_payment' => 'downPayment' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'order_no' => 'setOrderNo', + 'order_items' => 'setOrderItems', + 'preferred_loan_duration' => 'setPreferredLoanDuration', + 'down_payment' => 'setDownPayment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order_no' => 'getOrderNo', + 'order_items' => 'getOrderItems', + 'preferred_loan_duration' => 'getPreferredLoanDuration', + 'down_payment' => 'getDownPayment' + ]; /** * Array of attributes where the key is the local name, @@ -212,46 +238,53 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('order_no', $data ?? [], null); + $this->setIfExists('order_items', $data ?? [], null); + $this->setIfExists('preferred_loan_duration', $data ?? [], null); + $this->setIfExists('down_payment', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -266,28 +299,40 @@ public function listInvalidProperties() if ($this->container['order_no'] === null) { $invalidProperties[] = "'order_no' can't be null"; } - if (mb_strlen($this->container['order_no']) > 100) { + if ((mb_strlen($this->container['order_no']) > 100)) { $invalidProperties[] = "invalid value for 'order_no', the character length must be smaller than or equal to 100."; } - if (mb_strlen($this->container['order_no']) < 1) { + if ((mb_strlen($this->container['order_no']) < 1)) { $invalidProperties[] = "invalid value for 'order_no', the character length must be bigger than or equal to 1."; } if ($this->container['order_items'] === null) { $invalidProperties[] = "'order_items' can't be null"; } - if (count($this->container['order_items']) > 1000) { + if ((count($this->container['order_items']) > 1000)) { $invalidProperties[] = "invalid value for 'order_items', number of items must be less than or equal to 1000."; } - if (count($this->container['order_items']) < 1) { + if ((count($this->container['order_items']) < 1)) { $invalidProperties[] = "invalid value for 'order_items', number of items must be greater than or equal to 1."; } return $invalidProperties; } + /** + * 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 order_no * @@ -308,13 +353,13 @@ public function getOrderNo() public function setOrderNo($order_no) { if (is_null($order_no)) { - throw new SanitizedInvalidArgumentException('non-nullable order_no cannot be null'); + throw new \InvalidArgumentException('non-nullable order_no cannot be null'); } - if (mb_strlen($order_no) > 100) { - throw new SanitizedInvalidArgumentException('invalid length for $order_no when calling Order., must be smaller than or equal to 100.'); + if ((mb_strlen($order_no) > 100)) { + throw new \InvalidArgumentException('invalid length for $order_no when calling Order., must be smaller than or equal to 100.'); } - if (mb_strlen($order_no) < 1) { - throw new SanitizedInvalidArgumentException('invalid length for $order_no when calling Order., must be bigger than or equal to 1.'); + if ((mb_strlen($order_no) < 1)) { + throw new \InvalidArgumentException('invalid length for $order_no when calling Order., must be bigger than or equal to 1.'); } $this->container['order_no'] = $order_no; @@ -342,14 +387,14 @@ public function getOrderItems() public function setOrderItems($order_items) { if (is_null($order_items)) { - throw new SanitizedInvalidArgumentException('non-nullable order_items cannot be null'); + throw new \InvalidArgumentException('non-nullable order_items cannot be null'); } - if (count($order_items) > 1000) { - throw new SanitizedInvalidArgumentException('invalid value for $order_items when calling Order., number of items must be less than or equal to 1000.'); + if ((count($order_items) > 1000)) { + throw new \InvalidArgumentException('invalid value for $order_items when calling Order., number of items must be less than or equal to 1000.'); } - if (count($order_items) < 1) { - throw new SanitizedInvalidArgumentException('invalid length for $order_items when calling Order., number of items must be greater than or equal to 1.'); + if ((count($order_items) < 1)) { + throw new \InvalidArgumentException('invalid length for $order_items when calling Order., number of items must be greater than or equal to 1.'); } $this->container['order_items'] = $order_items; @@ -376,7 +421,7 @@ public function getPreferredLoanDuration() public function setPreferredLoanDuration($preferred_loan_duration) { if (is_null($preferred_loan_duration)) { - throw new SanitizedInvalidArgumentException('non-nullable preferred_loan_duration cannot be null'); + throw new \InvalidArgumentException('non-nullable preferred_loan_duration cannot be null'); } $this->container['preferred_loan_duration'] = $preferred_loan_duration; @@ -403,19 +448,18 @@ public function getDownPayment() public function setDownPayment($down_payment) { if (is_null($down_payment)) { - throw new SanitizedInvalidArgumentException('non-nullable down_payment cannot be null'); + throw new \InvalidArgumentException('non-nullable down_payment cannot be null'); } $this->container['down_payment'] = $down_payment; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -425,7 +469,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -439,7 +483,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -455,7 +499,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -465,12 +509,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/OrderItem.php b/lib/Model/OrderItem.php old mode 100755 new mode 100644 index 78bd758..6401016 --- a/lib/Model/OrderItem.php +++ b/lib/Model/OrderItem.php @@ -2,154 +2,157 @@ /** * OrderItem * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class OrderItem implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * OrderItem Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class OrderItem implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'orderItem'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'quantity' => 'int', 'total_item_price' => 'float', 'item_detail' => '\Tatrapayplus\TatrapayplusApiClient\Model\ItemDetail', 'item_info_url' => 'string', - 'item_image' => 'string', + 'item_image' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'quantity' => 'int64', 'total_item_price' => 'double', 'item_detail' => null, 'item_info_url' => 'uri', - 'item_image' => null, + 'item_image' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'quantity' => false, 'total_item_price' => false, 'item_detail' => false, 'item_info_url' => false, - 'item_image' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'quantity' => 'quantity', - 'total_item_price' => 'totalItemPrice', - 'item_detail' => 'itemDetail', - 'item_info_url' => 'itemInfoURL', - 'item_image' => 'itemImage', + 'item_image' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'quantity' => 'setQuantity', - 'total_item_price' => 'setTotalItemPrice', - 'item_detail' => 'setItemDetail', - 'item_info_url' => 'setItemInfoUrl', - 'item_image' => 'setItemImage', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'quantity' => 'getQuantity', - 'total_item_price' => 'getTotalItemPrice', - 'item_detail' => 'getItemDetail', - 'item_info_url' => 'getItemInfoUrl', - 'item_image' => 'getItemImage', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('quantity', $data ?? [], null); - $this->setIfExists('total_item_price', $data ?? [], null); - $this->setIfExists('item_detail', $data ?? [], null); - $this->setIfExists('item_info_url', $data ?? [], null); - $this->setIfExists('item_image', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -158,34 +161,55 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'quantity' => 'quantity', + 'total_item_price' => 'totalItemPrice', + 'item_detail' => 'itemDetail', + 'item_info_url' => 'itemInfoURL', + 'item_image' => 'itemImage' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'quantity' => 'setQuantity', + 'total_item_price' => 'setTotalItemPrice', + 'item_detail' => 'setItemDetail', + 'item_info_url' => 'setItemInfoUrl', + 'item_image' => 'setItemImage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'total_item_price' => 'getTotalItemPrice', + 'item_detail' => 'getItemDetail', + 'item_info_url' => 'getItemInfoUrl', + 'item_image' => 'getItemImage' + ]; /** * Array of attributes where the key is the local name, @@ -219,46 +243,54 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('total_item_price', $data ?? [], null); + $this->setIfExists('item_detail', $data ?? [], null); + $this->setIfExists('item_info_url', $data ?? [], null); + $this->setIfExists('item_image', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -286,6 +318,18 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 quantity * @@ -306,7 +350,7 @@ public function getQuantity() public function setQuantity($quantity) { if (is_null($quantity)) { - throw new SanitizedInvalidArgumentException('non-nullable quantity cannot be null'); + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); } $this->container['quantity'] = $quantity; @@ -333,7 +377,7 @@ public function getTotalItemPrice() public function setTotalItemPrice($total_item_price) { if (is_null($total_item_price)) { - throw new SanitizedInvalidArgumentException('non-nullable total_item_price cannot be null'); + throw new \InvalidArgumentException('non-nullable total_item_price cannot be null'); } $this->container['total_item_price'] = $total_item_price; @@ -343,7 +387,7 @@ public function setTotalItemPrice($total_item_price) /** * Gets item_detail * - * @return ItemDetail + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ItemDetail */ public function getItemDetail() { @@ -353,14 +397,14 @@ public function getItemDetail() /** * Sets item_detail * - * @param ItemDetail $item_detail item_detail + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ItemDetail $item_detail item_detail * * @return self */ public function setItemDetail($item_detail) { if (is_null($item_detail)) { - throw new SanitizedInvalidArgumentException('non-nullable item_detail cannot be null'); + throw new \InvalidArgumentException('non-nullable item_detail cannot be null'); } $this->container['item_detail'] = $item_detail; @@ -387,7 +431,7 @@ public function getItemInfoUrl() public function setItemInfoUrl($item_info_url) { if (is_null($item_info_url)) { - throw new SanitizedInvalidArgumentException('non-nullable item_info_url cannot be null'); + throw new \InvalidArgumentException('non-nullable item_info_url cannot be null'); } $this->container['item_info_url'] = $item_info_url; @@ -414,23 +458,22 @@ public function getItemImage() public function setItemImage($item_image) { if (is_null($item_image)) { - throw new SanitizedInvalidArgumentException('non-nullable item_image cannot be null'); + throw new \InvalidArgumentException('non-nullable item_image cannot be null'); } - if (mb_strlen($item_image) > 1000000) { - throw new SanitizedInvalidArgumentException('invalid length for $item_image when calling OrderItem., must be smaller than or equal to 1000000.'); + if ((mb_strlen($item_image) > 1000000)) { + throw new \InvalidArgumentException('invalid length for $item_image when calling OrderItem., must be smaller than or equal to 1000000.'); } $this->container['item_image'] = $item_image; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -440,7 +483,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -454,7 +497,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -470,7 +513,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -480,12 +523,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/PayLater.php b/lib/Model/PayLater.php old mode 100755 new mode 100644 index 3639f1e..6d4cac4 --- a/lib/Model/PayLater.php +++ b/lib/Model/PayLater.php @@ -2,133 +2,148 @@ /** * PayLater * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class PayLater implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * PayLater Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class PayLater implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'payLater'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'order' => '\Tatrapayplus\TatrapayplusApiClient\Model\Order', - 'capacity_info' => '\Tatrapayplus\TatrapayplusApiClient\Model\CapacityInfo', + 'capacity_info' => '\Tatrapayplus\TatrapayplusApiClient\Model\CapacityInfo' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'order' => null, - 'capacity_info' => null, + 'capacity_info' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'order' => false, - 'capacity_info' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'order' => 'order', - 'capacity_info' => 'capacityInfo', + 'capacity_info' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'order' => 'setOrder', - 'capacity_info' => 'setCapacityInfo', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'order' => 'getOrder', - 'capacity_info' => 'getCapacityInfo', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('order', $data ?? [], null); - $this->setIfExists('capacity_info', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +152,46 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'order' => 'order', + 'capacity_info' => 'capacityInfo' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'order' => 'setOrder', + 'capacity_info' => 'setCapacityInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'capacity_info' => 'getCapacityInfo' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +225,51 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('capacity_info', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -252,14 +284,25 @@ public function listInvalidProperties() if ($this->container['order'] === null) { $invalidProperties[] = "'order' can't be null"; } - return $invalidProperties; } + /** + * 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 order * - * @return Order + * @return \Tatrapayplus\TatrapayplusApiClient\Model\Order */ public function getOrder() { @@ -269,14 +312,14 @@ public function getOrder() /** * Sets order * - * @param Order $order order + * @param \Tatrapayplus\TatrapayplusApiClient\Model\Order $order order * * @return self */ public function setOrder($order) { if (is_null($order)) { - throw new SanitizedInvalidArgumentException('non-nullable order cannot be null'); + throw new \InvalidArgumentException('non-nullable order cannot be null'); } $this->container['order'] = $order; @@ -286,7 +329,7 @@ public function setOrder($order) /** * Gets capacity_info * - * @return CapacityInfo|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CapacityInfo|null */ public function getCapacityInfo() { @@ -296,26 +339,25 @@ public function getCapacityInfo() /** * Sets capacity_info * - * @param CapacityInfo|null $capacity_info capacity_info + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CapacityInfo|null $capacity_info capacity_info * * @return self */ public function setCapacityInfo($capacity_info) { if (is_null($capacity_info)) { - throw new SanitizedInvalidArgumentException('non-nullable capacity_info cannot be null'); + throw new \InvalidArgumentException('non-nullable capacity_info cannot be null'); } $this->container['capacity_info'] = $capacity_info; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -325,7 +367,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -339,7 +381,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -355,7 +397,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -365,12 +407,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/PayLaterStatus.php b/lib/Model/PayLaterStatus.php old mode 100755 new mode 100644 index c7a0166..6bb681d --- a/lib/Model/PayLaterStatus.php +++ b/lib/Model/PayLaterStatus.php @@ -2,13 +2,42 @@ /** * PayLaterStatus * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +/** + * PayLaterStatus Class Doc Comment + * + * @category Class + * @description Finance application status + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ class PayLaterStatus { /** @@ -27,16 +56,9 @@ class PayLaterStatus public const CANCELED = 'CANCELED'; public const EXPIRED = 'EXPIRED'; - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; /** * Gets allowable values of the enum - * * @return string[] */ public static function getAllowableEnumValues() @@ -48,37 +70,9 @@ public static function getAllowableEnumValues() self::LOAN_APPLICATION_FINISHED, self::LOAN_DISBURSED, self::CANCELED, - self::EXPIRED, + self::EXPIRED ]; } +} - public static function getAcceptedStatuses() - { - return [ - self::LOAN_DISBURSED, - ]; - } - - public static function getRejectedStatuses() - { - return [ - self::CANCELED, - self::EXPIRED, - ]; - } - - public function getStatus() - { - return $this->container['status']; - } - - public function setStatus($status) - { - if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); - } - $this->container['status'] = $status; - return $this; - } -} diff --git a/lib/Model/PaymentIntentCancelResponse.php b/lib/Model/PaymentIntentCancelResponse.php old mode 100755 new mode 100644 index 5a0b074..ab211c1 --- a/lib/Model/PaymentIntentCancelResponse.php +++ b/lib/Model/PaymentIntentCancelResponse.php @@ -2,126 +2,146 @@ /** * PaymentIntentCancelResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class PaymentIntentCancelResponse implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * PaymentIntentCancelResponse Class Doc Comment + * + * @category Class + * @description **TatraPayPlus cancel response. ** + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class PaymentIntentCancelResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'paymentIntentCancelResponse'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'selected_payment_method' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod', + 'selected_payment_method' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'selected_payment_method' => null, + 'selected_payment_method' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'selected_payment_method' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'selected_payment_method' => 'selectedPaymentMethod', + 'selected_payment_method' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'selected_payment_method' => 'setSelectedPaymentMethod', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'selected_payment_method' => 'getSelectedPaymentMethod', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('selected_payment_method', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +150,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'selected_payment_method' => 'selectedPaymentMethod' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'selected_payment_method' => 'setSelectedPaymentMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'selected_payment_method' => 'getSelectedPaymentMethod' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +220,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('selected_payment_method', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -245,10 +278,22 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 selected_payment_method * - * @return PaymentMethod|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod|null */ public function getSelectedPaymentMethod() { @@ -258,26 +303,25 @@ public function getSelectedPaymentMethod() /** * Sets selected_payment_method * - * @param PaymentMethod|null $selected_payment_method selected_payment_method + * @param \Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod|null $selected_payment_method selected_payment_method * * @return self */ public function setSelectedPaymentMethod($selected_payment_method) { if (is_null($selected_payment_method)) { - throw new SanitizedInvalidArgumentException('non-nullable selected_payment_method cannot be null'); + throw new \InvalidArgumentException('non-nullable selected_payment_method cannot be null'); } $this->container['selected_payment_method'] = $selected_payment_method; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -287,7 +331,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -301,7 +345,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -317,7 +361,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -327,12 +371,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/PaymentIntentStatusResponse.php b/lib/Model/PaymentIntentStatusResponse.php old mode 100755 new mode 100644 index 33b4446..b5bc3fc --- a/lib/Model/PaymentIntentStatusResponse.php +++ b/lib/Model/PaymentIntentStatusResponse.php @@ -328,7 +328,7 @@ public function getAuthorizationStatusAllowableValues() public function setSelectedPaymentMethod($selected_payment_method) { if (is_null($selected_payment_method)) { - throw new SanitizedInvalidArgumentException('non-nullable selected_payment_method cannot be null'); + throw new InvalidArgumentException('non-nullable selected_payment_method cannot be null'); } $this->container['selected_payment_method'] = $selected_payment_method; @@ -355,11 +355,11 @@ public function getAuthorizationStatus() public function setAuthorizationStatus($authorization_status) { if (is_null($authorization_status)) { - throw new SanitizedInvalidArgumentException('non-nullable authorization_status cannot be null'); + throw new InvalidArgumentException('non-nullable authorization_status cannot be null'); } $allowedValues = $this->getAuthorizationStatusAllowableValues(); if (!in_array($authorization_status, $allowedValues, true)) { - throw new SanitizedInvalidArgumentException(sprintf("Invalid value '%s' for 'authorization_status', must be one of '%s'", $authorization_status, implode("', '", $allowedValues))); + throw new InvalidArgumentException(sprintf("Invalid value '%s' for 'authorization_status', must be one of '%s'", $authorization_status, implode("', '", $allowedValues))); } $this->container['authorization_status'] = $authorization_status; @@ -386,7 +386,7 @@ public function getStatus() public function setStatus($status) { if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); + throw new InvalidArgumentException('non-nullable status cannot be null'); } $selected_method = $this->getSelectedPaymentMethod(); diff --git a/lib/Model/PaymentIntentUpdateResponseStatus.php b/lib/Model/PaymentIntentStatusResponseStatus.php old mode 100755 new mode 100644 similarity index 62% rename from lib/Model/PaymentIntentUpdateResponseStatus.php rename to lib/Model/PaymentIntentStatusResponseStatus.php index e885baf..3a49a4f --- a/lib/Model/PaymentIntentUpdateResponseStatus.php +++ b/lib/Model/PaymentIntentStatusResponseStatus.php @@ -1,52 +1,80 @@ + */ +class PaymentIntentStatusResponseStatus implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'paymentIntentUpdateResponse_status'; + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'paymentIntentStatusResponse_status'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'status' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatus', 'currency' => 'string', - 'amount' => 'string', + 'amount' => 'float', 'pre_authorization' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount', 'charge_back' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount', 'comfort_pay' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureComfortPay', 'masked_card_number' => 'string', - 'reason_code' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureReasonCode', + 'reason_code' => '\Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode', + 'payment_authorization_code' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'status' => null, 'currency' => null, @@ -56,13 +84,14 @@ class PaymentIntentUpdateResponseStatus implements ModelInterface, \ArrayAccess 'comfort_pay' => null, 'masked_card_number' => null, 'reason_code' => null, + 'payment_authorization_code' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'status' => false, 'currency' => false, @@ -72,107 +101,70 @@ class PaymentIntentUpdateResponseStatus implements ModelInterface, \ArrayAccess 'comfort_pay' => false, 'masked_card_number' => false, 'reason_code' => false, + 'payment_authorization_code' => false ]; + /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'status' => 'status', - 'currency' => 'currency', - 'amount' => 'amount', - 'pre_authorization' => 'preAuthorization', - 'charge_back' => 'chargeBack', - 'comfort_pay' => 'comfortPay', - 'masked_card_number' => 'maskedCardNumber', - 'reason_code' => 'reasonCode', - ]; - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'status' => 'setStatus', - 'currency' => 'setCurrency', - 'amount' => 'setAmount', - 'pre_authorization' => 'setPreAuthorization', - 'charge_back' => 'setChargeBack', - 'comfort_pay' => 'setComfortPay', - 'masked_card_number' => 'setMaskedCardNumber', - 'reason_code' => 'setReasonCode', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'status' => 'getStatus', - 'currency' => 'getCurrency', - 'amount' => 'getAmount', - 'pre_authorization' => 'getPreAuthorization', - 'charge_back' => 'getChargeBack', - 'comfort_pay' => 'getComfortPay', - 'masked_card_number' => 'getMaskedCardNumber', - 'reason_code' => 'getReasonCode', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('currency', $data ?? [], null); - $this->setIfExists('amount', $data ?? [], null); - $this->setIfExists('pre_authorization', $data ?? [], null); - $this->setIfExists('charge_back', $data ?? [], null); - $this->setIfExists('comfort_pay', $data ?? [], null); - $this->setIfExists('masked_card_number', $data ?? [], null); - $this->setIfExists('reason_code', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -181,34 +173,67 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'status' => 'status', + 'currency' => 'currency', + 'amount' => 'amount', + 'pre_authorization' => 'preAuthorization', + 'charge_back' => 'chargeBack', + 'comfort_pay' => 'comfortPay', + 'masked_card_number' => 'maskedCardNumber', + 'reason_code' => 'reasonCode', + 'payment_authorization_code' => 'paymentAuthorizationCode' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'status' => 'setStatus', + 'currency' => 'setCurrency', + 'amount' => 'setAmount', + 'pre_authorization' => 'setPreAuthorization', + 'charge_back' => 'setChargeBack', + 'comfort_pay' => 'setComfortPay', + 'masked_card_number' => 'setMaskedCardNumber', + 'reason_code' => 'setReasonCode', + 'payment_authorization_code' => 'setPaymentAuthorizationCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'currency' => 'getCurrency', + 'amount' => 'getAmount', + 'pre_authorization' => 'getPreAuthorization', + 'charge_back' => 'getChargeBack', + 'comfort_pay' => 'getComfortPay', + 'masked_card_number' => 'getMaskedCardNumber', + 'reason_code' => 'getReasonCode', + 'payment_authorization_code' => 'getPaymentAuthorizationCode' + ]; /** * Array of attributes where the key is the local name, @@ -242,46 +267,58 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('pre_authorization', $data ?? [], null); + $this->setIfExists('charge_back', $data ?? [], null); + $this->setIfExists('comfort_pay', $data ?? [], null); + $this->setIfExists('masked_card_number', $data ?? [], null); + $this->setIfExists('reason_code', $data ?? [], null); + $this->setIfExists('payment_authorization_code', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -299,7 +336,7 @@ public function listInvalidProperties() if ($this->container['currency'] === null) { $invalidProperties[] = "'currency' can't be null"; } - if (!preg_match('/[A-Z]{3}/', $this->container['currency'])) { + if (!preg_match("/[A-Z]{3}/", $this->container['currency'])) { $invalidProperties[] = "invalid value for 'currency', must be conform to the pattern /[A-Z]{3}/."; } @@ -307,13 +344,29 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'masked_card_number', the character length must be smaller than or equal to 19."; } + if (!is_null($this->container['payment_authorization_code']) && !preg_match("/^[ 0-9A-Z]{6}$/", $this->container['payment_authorization_code'])) { + $invalidProperties[] = "invalid value for 'payment_authorization_code', must be conform to the pattern /^[ 0-9A-Z]{6}$/."; + } + return $invalidProperties; } + /** + * 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 status * - * @return CardPayStatus + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatus */ public function getStatus() { @@ -323,14 +376,14 @@ public function getStatus() /** * Sets status * - * @param CardPayStatus $status status + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatus $status status * * @return self */ public function setStatus($status) { if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); + throw new \InvalidArgumentException('non-nullable status cannot be null'); } $this->container['status'] = $status; @@ -350,18 +403,18 @@ public function getCurrency() /** * Sets currency * - * @param string $currency ISO 4217 Alpha 3 currency code + * @param string $currency ISO 4217 Alpha 3 currency code. * * @return self */ public function setCurrency($currency) { if (is_null($currency)) { - throw new SanitizedInvalidArgumentException('non-nullable currency cannot be null'); + throw new \InvalidArgumentException('non-nullable currency cannot be null'); } - if (!preg_match('/[A-Z]{3}/', ObjectSerializer::toString($currency))) { - throw new SanitizedInvalidArgumentException('invalid value for $currency when calling PaymentIntentUpdateResponseStatus., must conform to the pattern /[A-Z]{3}/.'); + if ((!preg_match("/[A-Z]{3}/", ObjectSerializer::toString($currency)))) { + throw new \InvalidArgumentException("invalid value for \$currency when calling PaymentIntentStatusResponseStatus., must conform to the pattern /[A-Z]{3}/."); } $this->container['currency'] = $currency; @@ -389,9 +442,10 @@ public function getAmount() public function setAmount($amount) { if (is_null($amount)) { - throw new SanitizedInvalidArgumentException('non-nullable amount cannot be null'); + throw new \InvalidArgumentException('non-nullable amount cannot be null'); } + $this->container['amount'] = $amount; return $this; @@ -400,7 +454,7 @@ public function setAmount($amount) /** * Gets pre_authorization * - * @return CardPayAmount|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null */ public function getPreAuthorization() { @@ -410,14 +464,14 @@ public function getPreAuthorization() /** * Sets pre_authorization * - * @param CardPayAmount|null $pre_authorization pre_authorization + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null $pre_authorization pre_authorization * * @return self */ public function setPreAuthorization($pre_authorization) { if (is_null($pre_authorization)) { - throw new SanitizedInvalidArgumentException('non-nullable pre_authorization cannot be null'); + throw new \InvalidArgumentException('non-nullable pre_authorization cannot be null'); } $this->container['pre_authorization'] = $pre_authorization; @@ -427,7 +481,7 @@ public function setPreAuthorization($pre_authorization) /** * Gets charge_back * - * @return CardPayAmount|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null */ public function getChargeBack() { @@ -437,14 +491,14 @@ public function getChargeBack() /** * Sets charge_back * - * @param CardPayAmount|null $charge_back charge_back + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayAmount|null $charge_back charge_back * * @return self */ public function setChargeBack($charge_back) { if (is_null($charge_back)) { - throw new SanitizedInvalidArgumentException('non-nullable charge_back cannot be null'); + throw new \InvalidArgumentException('non-nullable charge_back cannot be null'); } $this->container['charge_back'] = $charge_back; @@ -454,7 +508,7 @@ public function setChargeBack($charge_back) /** * Gets comfort_pay * - * @return CardPayStatusStructureComfortPay|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureComfortPay|null */ public function getComfortPay() { @@ -464,14 +518,14 @@ public function getComfortPay() /** * Sets comfort_pay * - * @param CardPayStatusStructureComfortPay|null $comfort_pay comfort_pay + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructureComfortPay|null $comfort_pay comfort_pay * * @return self */ public function setComfortPay($comfort_pay) { if (is_null($comfort_pay)) { - throw new SanitizedInvalidArgumentException('non-nullable comfort_pay cannot be null'); + throw new \InvalidArgumentException('non-nullable comfort_pay cannot be null'); } $this->container['comfort_pay'] = $comfort_pay; @@ -491,17 +545,17 @@ public function getMaskedCardNumber() /** * Sets masked_card_number * - * @param string|null $masked_card_number masked card number + * @param string|null $masked_card_number Masked card number. * * @return self */ public function setMaskedCardNumber($masked_card_number) { if (is_null($masked_card_number)) { - throw new SanitizedInvalidArgumentException('non-nullable masked_card_number cannot be null'); + throw new \InvalidArgumentException('non-nullable masked_card_number cannot be null'); } - if (mb_strlen($masked_card_number) > 19) { - throw new SanitizedInvalidArgumentException('invalid length for $masked_card_number when calling PaymentIntentUpdateResponseStatus., must be smaller than or equal to 19.'); + if ((mb_strlen($masked_card_number) > 19)) { + throw new \InvalidArgumentException('invalid length for $masked_card_number when calling PaymentIntentStatusResponseStatus., must be smaller than or equal to 19.'); } $this->container['masked_card_number'] = $masked_card_number; @@ -512,7 +566,7 @@ public function setMaskedCardNumber($masked_card_number) /** * Gets reason_code * - * @return CardPayStatusStructureReasonCode|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode|null */ public function getReasonCode() { @@ -522,26 +576,57 @@ public function getReasonCode() /** * Sets reason_code * - * @param CardPayStatusStructureReasonCode|null $reason_code reason_code + * @param \Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionDataReasonCode|null $reason_code reason_code * * @return self */ public function setReasonCode($reason_code) { if (is_null($reason_code)) { - throw new SanitizedInvalidArgumentException('non-nullable reason_code cannot be null'); + throw new \InvalidArgumentException('non-nullable reason_code cannot be null'); } $this->container['reason_code'] = $reason_code; return $this; } + /** + * Gets payment_authorization_code + * + * @return string|null + */ + public function getPaymentAuthorizationCode() + { + return $this->container['payment_authorization_code']; + } + + /** + * Sets payment_authorization_code + * + * @param string|null $payment_authorization_code Payment authorization code + * + * @return self + */ + public function setPaymentAuthorizationCode($payment_authorization_code) + { + if (is_null($payment_authorization_code)) { + throw new \InvalidArgumentException('non-nullable payment_authorization_code cannot be null'); + } + + if ((!preg_match("/^[ 0-9A-Z]{6}$/", ObjectSerializer::toString($payment_authorization_code)))) { + throw new \InvalidArgumentException("invalid value for \$payment_authorization_code when calling PaymentIntentStatusResponseStatus., must conform to the pattern /^[ 0-9A-Z]{6}$/."); + } + + $this->container['payment_authorization_code'] = $payment_authorization_code; + + return $this; + } /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -551,7 +636,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -565,7 +650,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -581,7 +666,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -591,12 +676,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/PaymentIntentUpdateResponse.php b/lib/Model/PaymentIntentUpdateResponse.php old mode 100755 new mode 100644 index 9c8cc32..29a976b --- a/lib/Model/PaymentIntentUpdateResponse.php +++ b/lib/Model/PaymentIntentUpdateResponse.php @@ -2,126 +2,146 @@ /** * PaymentIntentUpdateResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class PaymentIntentUpdateResponse implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * PaymentIntentUpdateResponse Class Doc Comment + * + * @category Class + * @description **TatraPayPlus payment update response. ** | selectedPaymentMethod | attribute supported | | ---------------- | ------------| | BANK_TRANSFER | N/A | | CARD_PAY | cardPayStatusStructure | | PAY_LATER | N/A | + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class PaymentIntentUpdateResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'paymentIntentUpdateResponse'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'status' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentUpdateResponseStatus', + 'status' => '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructure' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'status' => null, + 'status' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'status' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'status' => 'status', + 'status' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'status' => 'setStatus', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'status' => 'getStatus', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('status', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +150,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'status' => 'status' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +220,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('status', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -245,10 +278,22 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 status * - * @return PaymentIntentUpdateResponseStatus|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructure|null */ public function getStatus() { @@ -258,26 +303,25 @@ public function getStatus() /** * Sets status * - * @param PaymentIntentUpdateResponseStatus|null $status status + * @param \Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructure|null $status status * * @return self */ public function setStatus($status) { if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); + throw new \InvalidArgumentException('non-nullable status cannot be null'); } $this->container['status'] = $status; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -287,7 +331,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -301,7 +345,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -317,7 +361,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -327,12 +371,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/PaymentMethod.php b/lib/Model/PaymentMethod.php old mode 100755 new mode 100644 diff --git a/lib/Model/PaymentMethodRules.php b/lib/Model/PaymentMethodRules.php index 36343bb..2b96e2f 100755 --- a/lib/Model/PaymentMethodRules.php +++ b/lib/Model/PaymentMethodRules.php @@ -297,7 +297,7 @@ public function getPaymentMethod() public function setPaymentMethod($paymentMethod) { if (is_null($paymentMethod)) { - throw new SanitizedInvalidArgumentException('non-nullable paymentMethod cannot be null'); + throw new InvalidArgumentException('non-nullable paymentMethod cannot be null'); } $this->container['paymentMethod'] = $paymentMethod; @@ -324,7 +324,7 @@ public function getAmountRangeRule() public function setAmountRangeRule($amount_range_rule) { if (is_null($amount_range_rule)) { - throw new SanitizedInvalidArgumentException('non-nullable amount_range_rule cannot be null'); + throw new InvalidArgumentException('non-nullable amount_range_rule cannot be null'); } $this->container['amount_range_rule'] = $amount_range_rule; @@ -351,7 +351,7 @@ public function getSupportedCurrency() public function setSupportedCurrency($supported_currency) { if (is_null($supported_currency)) { - throw new SanitizedInvalidArgumentException('non-nullable supported_currency cannot be null'); + throw new InvalidArgumentException('non-nullable supported_currency cannot be null'); } $this->container['supported_currency'] = $supported_currency; @@ -402,7 +402,7 @@ public function getAllowedBankProviders() public function setAllowedBankProviders($allowed_bank_providers) { if (is_null($allowed_bank_providers)) { - throw new SanitizedInvalidArgumentException('non-nullable allowed_bank_providers cannot be null'); + throw new InvalidArgumentException('non-nullable allowed_bank_providers cannot be null'); } $this->container['allowed_bank_providers'] = $allowed_bank_providers; diff --git a/lib/Model/PaymentMethodsListResponse.php b/lib/Model/PaymentMethodsListResponse.php old mode 100755 new mode 100644 index f100593..f7e601a --- a/lib/Model/PaymentMethodsListResponse.php +++ b/lib/Model/PaymentMethodsListResponse.php @@ -2,126 +2,146 @@ /** * PaymentMethodsListResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class PaymentMethodsListResponse implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * PaymentMethodsListResponse Class Doc Comment + * + * @category Class + * @description TatraPayPlus methods list, in case BANK_TRANSFER method is allowed for client,allowedBankProviders will be also provided + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class PaymentMethodsListResponse implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'paymentMethodsListResponse'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'payment_methods' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethodRules[]', + 'payment_methods' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethodRules[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'payment_methods' => null, + 'payment_methods' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'payment_methods' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'payment_methods' => 'paymentMethods', + 'payment_methods' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'payment_methods' => 'setPaymentMethods', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'payment_methods' => 'getPaymentMethods', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('payment_methods', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +150,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'payment_methods' => 'paymentMethods' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'payment_methods' => 'setPaymentMethods' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payment_methods' => 'getPaymentMethods' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +220,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('payment_methods', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -245,10 +278,21 @@ public function listInvalidProperties() if ($this->container['payment_methods'] === null) { $invalidProperties[] = "'payment_methods' can't be null"; } - return $invalidProperties; } + /** + * 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 payment_methods * @@ -269,19 +313,18 @@ public function getPaymentMethods() public function setPaymentMethods($payment_methods) { if (is_null($payment_methods)) { - throw new SanitizedInvalidArgumentException('non-nullable payment_methods cannot be null'); + throw new \InvalidArgumentException('non-nullable payment_methods cannot be null'); } $this->container['payment_methods'] = $payment_methods; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -291,7 +334,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -305,7 +348,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -321,7 +364,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -331,12 +374,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/PaymentSymbols.php b/lib/Model/PaymentSymbols.php old mode 100755 new mode 100644 index f431051..5bf8d24 --- a/lib/Model/PaymentSymbols.php +++ b/lib/Model/PaymentSymbols.php @@ -2,142 +2,151 @@ /** * PaymentSymbols * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class PaymentSymbols implements ModelInterface, \ArrayAccess +/** + * PaymentSymbols Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class PaymentSymbols implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'paymentSymbols'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'variable_symbol' => 'string', 'specific_symbol' => 'string', - 'constant_symbol' => 'string', + 'constant_symbol' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'variable_symbol' => null, 'specific_symbol' => null, - 'constant_symbol' => null, + 'constant_symbol' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'variable_symbol' => false, 'specific_symbol' => false, - 'constant_symbol' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'variable_symbol' => 'variableSymbol', - 'specific_symbol' => 'specificSymbol', - 'constant_symbol' => 'constantSymbol', + 'constant_symbol' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'variable_symbol' => 'setVariableSymbol', - 'specific_symbol' => 'setSpecificSymbol', - 'constant_symbol' => 'setConstantSymbol', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'variable_symbol' => 'getVariableSymbol', - 'specific_symbol' => 'getSpecificSymbol', - 'constant_symbol' => 'getConstantSymbol', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('variable_symbol', $data ?? [], null); - $this->setIfExists('specific_symbol', $data ?? [], null); - $this->setIfExists('constant_symbol', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -146,34 +155,49 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'variable_symbol' => 'variableSymbol', + 'specific_symbol' => 'specificSymbol', + 'constant_symbol' => 'constantSymbol' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'variable_symbol' => 'setVariableSymbol', + 'specific_symbol' => 'setSpecificSymbol', + 'constant_symbol' => 'setConstantSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'variable_symbol' => 'getVariableSymbol', + 'specific_symbol' => 'getSpecificSymbol', + 'constant_symbol' => 'getConstantSymbol' + ]; /** * Array of attributes where the key is the local name, @@ -207,46 +231,52 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('variable_symbol', $data ?? [], null); + $this->setIfExists('specific_symbol', $data ?? [], null); + $this->setIfExists('constant_symbol', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,21 +291,33 @@ public function listInvalidProperties() if ($this->container['variable_symbol'] === null) { $invalidProperties[] = "'variable_symbol' can't be null"; } - if (!preg_match('/^[0-9]{1,10}$/', $this->container['variable_symbol'])) { + if (!preg_match("/^[0-9]{1,10}$/", $this->container['variable_symbol'])) { $invalidProperties[] = "invalid value for 'variable_symbol', must be conform to the pattern /^[0-9]{1,10}$/."; } - if (!is_null($this->container['specific_symbol']) && !preg_match('/^[0-9]{1,10}$/', $this->container['specific_symbol'])) { + if (!is_null($this->container['specific_symbol']) && !preg_match("/^[0-9]{1,10}$/", $this->container['specific_symbol'])) { $invalidProperties[] = "invalid value for 'specific_symbol', must be conform to the pattern /^[0-9]{1,10}$/."; } - if (!is_null($this->container['constant_symbol']) && !preg_match('/^[0-9]{1,4}$/', $this->container['constant_symbol'])) { + if (!is_null($this->container['constant_symbol']) && !preg_match("/^[0-9]{1,4}$/", $this->container['constant_symbol'])) { $invalidProperties[] = "invalid value for 'constant_symbol', must be conform to the pattern /^[0-9]{1,4}$/."; } return $invalidProperties; } + /** + * 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 variable_symbol * @@ -296,11 +338,11 @@ public function getVariableSymbol() public function setVariableSymbol($variable_symbol) { if (is_null($variable_symbol)) { - throw new SanitizedInvalidArgumentException('non-nullable variable_symbol cannot be null'); + throw new \InvalidArgumentException('non-nullable variable_symbol cannot be null'); } - if (!preg_match('/^[0-9]{1,10}$/', ObjectSerializer::toString($variable_symbol))) { - throw new SanitizedInvalidArgumentException('invalid value for $variable_symbol when calling PaymentSymbols., must conform to the pattern /^[0-9]{1,10}$/.'); + if ((!preg_match("/^[0-9]{1,10}$/", ObjectSerializer::toString($variable_symbol)))) { + throw new \InvalidArgumentException("invalid value for \$variable_symbol when calling PaymentSymbols., must conform to the pattern /^[0-9]{1,10}$/."); } $this->container['variable_symbol'] = $variable_symbol; @@ -328,11 +370,11 @@ public function getSpecificSymbol() public function setSpecificSymbol($specific_symbol) { if (is_null($specific_symbol)) { - throw new SanitizedInvalidArgumentException('non-nullable specific_symbol cannot be null'); + throw new \InvalidArgumentException('non-nullable specific_symbol cannot be null'); } - if (!preg_match('/^[0-9]{1,10}$/', ObjectSerializer::toString($specific_symbol))) { - throw new SanitizedInvalidArgumentException('invalid value for $specific_symbol when calling PaymentSymbols., must conform to the pattern /^[0-9]{1,10}$/.'); + if ((!preg_match("/^[0-9]{1,10}$/", ObjectSerializer::toString($specific_symbol)))) { + throw new \InvalidArgumentException("invalid value for \$specific_symbol when calling PaymentSymbols., must conform to the pattern /^[0-9]{1,10}$/."); } $this->container['specific_symbol'] = $specific_symbol; @@ -360,24 +402,23 @@ public function getConstantSymbol() public function setConstantSymbol($constant_symbol) { if (is_null($constant_symbol)) { - throw new SanitizedInvalidArgumentException('non-nullable constant_symbol cannot be null'); + throw new \InvalidArgumentException('non-nullable constant_symbol cannot be null'); } - if (!preg_match('/^[0-9]{1,4}$/', ObjectSerializer::toString($constant_symbol))) { - throw new SanitizedInvalidArgumentException('invalid value for $constant_symbol when calling PaymentSymbols., must conform to the pattern /^[0-9]{1,4}$/.'); + if ((!preg_match("/^[0-9]{1,4}$/", ObjectSerializer::toString($constant_symbol)))) { + throw new \InvalidArgumentException("invalid value for \$constant_symbol when calling PaymentSymbols., must conform to the pattern /^[0-9]{1,4}$/."); } $this->container['constant_symbol'] = $constant_symbol; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -387,7 +428,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -401,7 +442,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -417,7 +458,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -427,12 +468,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/Provider.php b/lib/Model/Provider.php old mode 100755 new mode 100644 index a4c63fa..7d556b7 --- a/lib/Model/Provider.php +++ b/lib/Model/Provider.php @@ -2,149 +2,155 @@ /** * Provider * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class Provider implements ModelInterface, \ArrayAccess +/** + * Provider Class Doc Comment + * + * @category Class + * @description Data provider + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class Provider implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'provider'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'country_code' => 'string', 'provider_name' => 'string', 'provider_code' => 'string', - 'swift_code' => 'string', + 'swift_code' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'country_code' => null, 'provider_name' => null, 'provider_code' => null, - 'swift_code' => null, + 'swift_code' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'country_code' => false, 'provider_name' => false, 'provider_code' => false, - 'swift_code' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'country_code' => 'countryCode', - 'provider_name' => 'providerName', - 'provider_code' => 'providerCode', - 'swift_code' => 'swiftCode', + 'swift_code' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'country_code' => 'setCountryCode', - 'provider_name' => 'setProviderName', - 'provider_code' => 'setProviderCode', - 'swift_code' => 'setSwiftCode', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'country_code' => 'getCountryCode', - 'provider_name' => 'getProviderName', - 'provider_code' => 'getProviderCode', - 'swift_code' => 'getSwiftCode', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('country_code', $data ?? [], null); - $this->setIfExists('provider_name', $data ?? [], null); - $this->setIfExists('provider_code', $data ?? [], null); - $this->setIfExists('swift_code', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -153,34 +159,52 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'country_code' => 'countryCode', + 'provider_name' => 'providerName', + 'provider_code' => 'providerCode', + 'swift_code' => 'swiftCode' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'country_code' => 'setCountryCode', + 'provider_name' => 'setProviderName', + 'provider_code' => 'setProviderCode', + 'swift_code' => 'setSwiftCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country_code' => 'getCountryCode', + 'provider_name' => 'getProviderName', + 'provider_code' => 'getProviderCode', + 'swift_code' => 'getSwiftCode' + ]; /** * Array of attributes where the key is the local name, @@ -214,46 +238,53 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('country_code', $data ?? [], null); + $this->setIfExists('provider_name', $data ?? [], null); + $this->setIfExists('provider_code', $data ?? [], null); + $this->setIfExists('swift_code', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -268,34 +299,46 @@ public function listInvalidProperties() if ($this->container['country_code'] === null) { $invalidProperties[] = "'country_code' can't be null"; } - if (!preg_match('/[A-Z]{2}/', $this->container['country_code'])) { + if (!preg_match("/[A-Z]{2}/", $this->container['country_code'])) { $invalidProperties[] = "invalid value for 'country_code', must be conform to the pattern /[A-Z]{2}/."; } if ($this->container['provider_name'] === null) { $invalidProperties[] = "'provider_name' can't be null"; } - if (mb_strlen($this->container['provider_name']) > 500) { + if ((mb_strlen($this->container['provider_name']) > 500)) { $invalidProperties[] = "invalid value for 'provider_name', the character length must be smaller than or equal to 500."; } if ($this->container['provider_code'] === null) { $invalidProperties[] = "'provider_code' can't be null"; } - if (mb_strlen($this->container['provider_code']) > 50) { + if ((mb_strlen($this->container['provider_code']) > 50)) { $invalidProperties[] = "invalid value for 'provider_code', the character length must be smaller than or equal to 50."; } if ($this->container['swift_code'] === null) { $invalidProperties[] = "'swift_code' can't be null"; } - if (!preg_match('/[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/', $this->container['swift_code'])) { + if (!preg_match("/[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/", $this->container['swift_code'])) { $invalidProperties[] = "invalid value for 'swift_code', must be conform to the pattern /[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/."; } return $invalidProperties; } + /** + * 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 country_code * @@ -309,18 +352,18 @@ public function getCountryCode() /** * Sets country_code * - * @param string $country_code ISO 3166 ALPHA2 country code + * @param string $country_code ISO 3166 ALPHA2 country code. * * @return self */ public function setCountryCode($country_code) { if (is_null($country_code)) { - throw new SanitizedInvalidArgumentException('non-nullable country_code cannot be null'); + throw new \InvalidArgumentException('non-nullable country_code cannot be null'); } - if (!preg_match('/[A-Z]{2}/', ObjectSerializer::toString($country_code))) { - throw new SanitizedInvalidArgumentException('invalid value for $country_code when calling Provider., must conform to the pattern /[A-Z]{2}/.'); + if ((!preg_match("/[A-Z]{2}/", ObjectSerializer::toString($country_code)))) { + throw new \InvalidArgumentException("invalid value for \$country_code when calling Provider., must conform to the pattern /[A-Z]{2}/."); } $this->container['country_code'] = $country_code; @@ -348,10 +391,10 @@ public function getProviderName() public function setProviderName($provider_name) { if (is_null($provider_name)) { - throw new SanitizedInvalidArgumentException('non-nullable provider_name cannot be null'); + throw new \InvalidArgumentException('non-nullable provider_name cannot be null'); } - if (mb_strlen($provider_name) > 500) { - throw new SanitizedInvalidArgumentException('invalid length for $provider_name when calling Provider., must be smaller than or equal to 500.'); + if ((mb_strlen($provider_name) > 500)) { + throw new \InvalidArgumentException('invalid length for $provider_name when calling Provider., must be smaller than or equal to 500.'); } $this->container['provider_name'] = $provider_name; @@ -379,10 +422,10 @@ public function getProviderCode() public function setProviderCode($provider_code) { if (is_null($provider_code)) { - throw new SanitizedInvalidArgumentException('non-nullable provider_code cannot be null'); + throw new \InvalidArgumentException('non-nullable provider_code cannot be null'); } - if (mb_strlen($provider_code) > 50) { - throw new SanitizedInvalidArgumentException('invalid length for $provider_code when calling Provider., must be smaller than or equal to 50.'); + if ((mb_strlen($provider_code) > 50)) { + throw new \InvalidArgumentException('invalid length for $provider_code when calling Provider., must be smaller than or equal to 50.'); } $this->container['provider_code'] = $provider_code; @@ -410,24 +453,23 @@ public function getSwiftCode() public function setSwiftCode($swift_code) { if (is_null($swift_code)) { - throw new SanitizedInvalidArgumentException('non-nullable swift_code cannot be null'); + throw new \InvalidArgumentException('non-nullable swift_code cannot be null'); } - if (!preg_match('/[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/', ObjectSerializer::toString($swift_code))) { - throw new SanitizedInvalidArgumentException('invalid value for $swift_code when calling Provider., must conform to the pattern /[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/.'); + if ((!preg_match("/[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/", ObjectSerializer::toString($swift_code)))) { + throw new \InvalidArgumentException("invalid value for \$swift_code when calling Provider., must conform to the pattern /[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/."); } $this->container['swift_code'] = $swift_code; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -437,7 +479,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -451,7 +493,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -467,7 +509,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -477,12 +519,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/QRStatus.php b/lib/Model/QRStatus.php index 6f34a07..fdb1166 100644 --- a/lib/Model/QRStatus.php +++ b/lib/Model/QRStatus.php @@ -58,7 +58,7 @@ public function getStatus() public function setStatus($status) { if (is_null($status)) { - throw new SanitizedInvalidArgumentException('non-nullable status cannot be null'); + throw new InvalidArgumentException('non-nullable status cannot be null'); } $this->container['status'] = $status; diff --git a/lib/Model/RegisterForComfortPayObj.php b/lib/Model/RegisterForComfortPayObj.php old mode 100755 new mode 100644 index 160593f..80c9ced --- a/lib/Model/RegisterForComfortPayObj.php +++ b/lib/Model/RegisterForComfortPayObj.php @@ -2,126 +2,145 @@ /** * RegisterForComfortPayObj * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class RegisterForComfortPayObj implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * RegisterForComfortPayObj Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class RegisterForComfortPayObj implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'registerForComfortPayObj'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'register_for_comfort_pay' => 'bool', + 'register_for_comfort_pay' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'register_for_comfort_pay' => null, + 'register_for_comfort_pay' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'register_for_comfort_pay' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'register_for_comfort_pay' => 'registerForComfortPay', + 'register_for_comfort_pay' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'register_for_comfort_pay' => 'setRegisterForComfortPay', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'register_for_comfort_pay' => 'getRegisterForComfortPay', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('register_for_comfort_pay', $data ?? [], false); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +149,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'register_for_comfort_pay' => 'registerForComfortPay' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'register_for_comfort_pay' => 'setRegisterForComfortPay' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'register_for_comfort_pay' => 'getRegisterForComfortPay' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +219,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('register_for_comfort_pay', $data ?? [], false); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -245,6 +277,18 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 register_for_comfort_pay * @@ -265,19 +309,18 @@ public function getRegisterForComfortPay() public function setRegisterForComfortPay($register_for_comfort_pay) { if (is_null($register_for_comfort_pay)) { - throw new SanitizedInvalidArgumentException('non-nullable register_for_comfort_pay cannot be null'); + throw new \InvalidArgumentException('non-nullable register_for_comfort_pay cannot be null'); } $this->container['register_for_comfort_pay'] = $register_for_comfort_pay; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -287,7 +330,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -301,7 +344,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -317,7 +360,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -327,12 +370,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/SanitizedInvalidArgumentException.php b/lib/Model/SanitizedInvalidArgumentException.php deleted file mode 100644 index fa23668..0000000 --- a/lib/Model/SanitizedInvalidArgumentException.php +++ /dev/null @@ -1,15 +0,0 @@ - + */ +class SignedCardIdObj implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'signedCardIdObj'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'signed_card_id' => 'string', + 'signed_card_id' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'signed_card_id' => null, + 'signed_card_id' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'signed_card_id' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'signed_card_id' => 'signedCardId', + 'signed_card_id' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'signed_card_id' => 'setSignedCardId', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'signed_card_id' => 'getSignedCardId', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('signed_card_id', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -130,34 +149,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'signed_card_id' => 'signedCardId' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'signed_card_id' => 'setSignedCardId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'signed_card_id' => 'getSignedCardId' + ]; /** * Array of attributes where the key is the local name, @@ -191,46 +219,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('signed_card_id', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +281,18 @@ public function listInvalidProperties() return $invalidProperties; } + /** + * 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 signed_card_id * @@ -269,23 +313,22 @@ public function getSignedCardId() public function setSignedCardId($signed_card_id) { if (is_null($signed_card_id)) { - throw new SanitizedInvalidArgumentException('non-nullable signed_card_id cannot be null'); + throw new \InvalidArgumentException('non-nullable signed_card_id cannot be null'); } - if (mb_strlen($signed_card_id) > 1024) { - throw new SanitizedInvalidArgumentException('invalid length for $signed_card_id when calling SignedCardIdObj., must be smaller than or equal to 1024.'); + if ((mb_strlen($signed_card_id) > 1024)) { + throw new \InvalidArgumentException('invalid length for $signed_card_id when calling SignedCardIdObj., must be smaller than or equal to 1024.'); } $this->container['signed_card_id'] = $signed_card_id; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -295,7 +338,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -309,7 +352,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -325,7 +368,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -335,12 +378,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/Status.php b/lib/Model/Status.php old mode 100755 new mode 100644 index bf133c0..0c8f329 --- a/lib/Model/Status.php +++ b/lib/Model/Status.php @@ -2,13 +2,42 @@ /** * Status * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +/** + * Status Class Doc Comment + * + * @category Class + * @description Status of calculation + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ class Status { /** @@ -24,7 +53,6 @@ class Status /** * Gets allowable values of the enum - * * @return string[] */ public static function getAllowableEnumValues() @@ -33,7 +61,9 @@ public static function getAllowableEnumValues() self::OFFER, self::NO_OFFER, self::OPEN, - self::PROCESSING, + self::PROCESSING ]; } } + + diff --git a/lib/Model/Token.php b/lib/Model/Token.php index f2e31df..050e5dc 100644 --- a/lib/Model/Token.php +++ b/lib/Model/Token.php @@ -2,133 +2,145 @@ /** * Token * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -class Token implements ModelInterface, \ArrayAccess +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; + +/** + * Token Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class Token implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'token'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ - 'google_pay_token' => 'string', - 'apple_pay_token' => '\Tatrapayplus\TatrapayplusApiClient\Model\ApplePayToken', + 'token' => '\Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenToken' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ - 'google_pay_token' => null, - 'apple_pay_token' => null, + 'token' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ - 'google_pay_token' => false, - 'apple_pay_token' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'google_pay_token' => 'googlePayToken', - 'apple_pay_token' => 'applePayToken', + 'token' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'google_pay_token' => 'setGooglePayToken', - 'apple_pay_token' => 'setApplePayToken', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'google_pay_token' => 'getGooglePayToken', - 'apple_pay_token' => 'getApplePayToken', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('google_pay_token', $data ?? [], null); - $this->setIfExists('apple_pay_token', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -137,34 +149,43 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'token' => 'token' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'token' => 'setToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'token' => 'getToken' + ]; /** * Array of attributes where the key is the local name, @@ -198,46 +219,50 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('token', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -253,59 +278,49 @@ public function listInvalidProperties() } /** - * Gets google_pay_token + * Validate all the properties in the model + * return true if all passed * - * @return string + * @return bool True if all properties are valid */ - public function getGooglePayToken() + public function valid() { - return $this->container['google_pay_token']; + return count($this->listInvalidProperties()) === 0; } - /** - * Sets google_pay_token - * - * @param string $google_pay_token google_pay_token - * - * @return self - */ - public function setGooglePayToken($google_pay_token) - { - $this->container['google_pay_token'] = $google_pay_token; - - return $this; - } /** - * Gets apple_pay_token + * Gets token * - * @return ApplePayToken + * @return \Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenToken|null */ - public function getApplePayToken() + public function getToken() { - return $this->container['apple_pay_token']; + return $this->container['token']; } /** - * Sets apple_pay_token + * Sets token * - * @param ApplePayToken|null $apple_pay_token apple_pay_token + * @param \Tatrapayplus\TatrapayplusApiClient\Model\ApplePayTokenToken|null $token token * * @return self */ - public function setApplePayToken($apple_pay_token) + public function setToken($token) { - $this->container['apple_pay_token'] = $apple_pay_token; + if (is_null($token)) { + throw new \InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -315,7 +330,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -329,7 +344,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -345,7 +360,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -355,12 +370,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/TokenSuccessResponseType.php b/lib/Model/TokenSuccessResponseType.php index 8ea2fdc..b33da85 100755 --- a/lib/Model/TokenSuccessResponseType.php +++ b/lib/Model/TokenSuccessResponseType.php @@ -338,7 +338,7 @@ public function getAccessToken() public function setAccessToken($access_token) { if (is_null($access_token)) { - throw new SanitizedInvalidArgumentException('non-nullable access_token cannot be null'); + throw new InvalidArgumentException('non-nullable access_token cannot be null'); } $this->container['access_token'] = $access_token; @@ -365,7 +365,7 @@ public function getRefreshToken() public function setRefreshToken($refresh_token) { if (is_null($refresh_token)) { - throw new SanitizedInvalidArgumentException('non-nullable refresh_token cannot be null'); + throw new InvalidArgumentException('non-nullable refresh_token cannot be null'); } $this->container['refresh_token'] = $refresh_token; @@ -392,7 +392,7 @@ public function getExpiresIn() public function setExpiresIn($expires_in) { if (is_null($expires_in)) { - throw new SanitizedInvalidArgumentException('non-nullable expires_in cannot be null'); + throw new InvalidArgumentException('non-nullable expires_in cannot be null'); } $this->container['expires_in'] = $expires_in; @@ -419,7 +419,7 @@ public function getTokenType() public function setTokenType($token_type) { if (is_null($token_type)) { - throw new SanitizedInvalidArgumentException('non-nullable token_type cannot be null'); + throw new InvalidArgumentException('non-nullable token_type cannot be null'); } $this->container['token_type'] = $token_type; @@ -446,11 +446,11 @@ public function getScope() public function setScope($scope) { if (is_null($scope)) { - throw new SanitizedInvalidArgumentException('non-nullable scope cannot be null'); + throw new InvalidArgumentException('non-nullable scope cannot be null'); } $allowedValues = $this->getScopeAllowableValues(); if (!in_array($scope, $allowedValues, true)) { - throw new SanitizedInvalidArgumentException(sprintf("Invalid value '%s' for 'scope', must be one of '%s'", $scope, implode("', '", $allowedValues))); + throw new InvalidArgumentException(sprintf("Invalid value '%s' for 'scope', must be one of '%s'", $scope, implode("', '", $allowedValues))); } $this->container['scope'] = $scope; diff --git a/lib/Model/UserData.php b/lib/Model/UserData.php old mode 100755 new mode 100644 index 887bf00..10693e5 --- a/lib/Model/UserData.php +++ b/lib/Model/UserData.php @@ -2,161 +2,157 @@ /** * UserData * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class UserData implements ModelInterface, \ArrayAccess +/** + * UserData Class Doc Comment + * + * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class UserData implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'userData'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'external_applicant_id' => 'string', 'first_name' => 'string', 'last_name' => 'string', 'email' => 'string', - 'phone' => 'string', + 'phone' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'external_applicant_id' => null, 'first_name' => null, 'last_name' => null, 'email' => 'email', - 'phone' => null, + 'phone' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'external_applicant_id' => false, 'first_name' => false, 'last_name' => false, 'email' => false, - 'phone' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'external_applicant_id' => 'externalApplicantId', - 'first_name' => 'firstName', - 'last_name' => 'lastName', - 'email' => 'email', - 'phone' => 'phone', + 'phone' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'external_applicant_id' => 'setExternalApplicantId', - 'first_name' => 'setFirstName', - 'last_name' => 'setLastName', - 'email' => 'setEmail', - 'phone' => 'setPhone', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'external_applicant_id' => 'getExternalApplicantId', - 'first_name' => 'getFirstName', - 'last_name' => 'getLastName', - 'email' => 'getEmail', - 'phone' => 'getPhone', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('external_applicant_id', $data ?? [], null); - $this->setIfExists('first_name', $data ?? [], null); - $this->setIfExists('last_name', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('phone', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if(!array_key_exists($variableName, $fields)) { - $this->container[$variableName] = $defaultValue; - return; - } - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $value = $fields[$variableName] ?? $defaultValue; - call_user_func( array($this, $this->setters()[$variableName]), $value ); + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -165,34 +161,55 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'external_applicant_id' => 'externalApplicantId', + 'first_name' => 'firstName', + 'last_name' => 'lastName', + 'email' => 'email', + 'phone' => 'phone' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'external_applicant_id' => 'setExternalApplicantId', + 'first_name' => 'setFirstName', + 'last_name' => 'setLastName', + 'email' => 'setEmail', + 'phone' => 'setPhone' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'external_applicant_id' => 'getExternalApplicantId', + 'first_name' => 'getFirstName', + 'last_name' => 'getLastName', + 'email' => 'getEmail', + 'phone' => 'getPhone' + ]; /** * Array of attributes where the key is the local name, @@ -226,46 +243,54 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + /** - * Array of nullable field names deliberately set to null + * Associative array for storing property values * - * @return bool[] + * @var mixed[] */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } + protected $container = []; /** - * The original name of the model. + * Constructor * - * @return string + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function getModelName() + public function __construct(?array $data = null) { - return self::$openAPIModelName; + $this->setIfExists('external_applicant_id', $data ?? [], null); + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); } /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return count($this->listInvalidProperties()) === 0; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -288,44 +313,56 @@ public function listInvalidProperties() if ($this->container['first_name'] === null) { $invalidProperties[] = "'first_name' can't be null"; } - if (mb_strlen($this->container['first_name']) > 30) { + if ((mb_strlen($this->container['first_name']) > 30)) { $invalidProperties[] = "invalid value for 'first_name', the character length must be smaller than or equal to 30."; } - if (mb_strlen($this->container['first_name']) < 1) { + if ((mb_strlen($this->container['first_name']) < 1)) { $invalidProperties[] = "invalid value for 'first_name', the character length must be bigger than or equal to 1."; } - if (!preg_match('/^[a-zA-Z0-9À-ž ]{1,30}$/', $this->container['first_name'])) { - $invalidProperties[] = "invalid value for 'first_name', must be conform to the pattern /^[a-zA-Z0-9À-ž ]{1,30}$/."; + if (!preg_match("/^[a-zA-Z0-9À-ž ]{1,30}$/", $this->container['first_name'])) { + $invalidProperties[] = "invalid value for 'first_name', must be conform to the pattern /^[a-zA-Z0-9À-ž ]{1,30}$/."; } if ($this->container['last_name'] === null) { $invalidProperties[] = "'last_name' can't be null"; } - if (mb_strlen($this->container['last_name']) > 30) { + if ((mb_strlen($this->container['last_name']) > 30)) { $invalidProperties[] = "invalid value for 'last_name', the character length must be smaller than or equal to 30."; } - if (mb_strlen($this->container['last_name']) < 1) { + if ((mb_strlen($this->container['last_name']) < 1)) { $invalidProperties[] = "invalid value for 'last_name', the character length must be bigger than or equal to 1."; } - if (!preg_match('/^[a-zA-Z0-9À-ž ]{1,30}$/', $this->container['last_name'])) { - $invalidProperties[] = "invalid value for 'last_name', must be conform to the pattern /^[a-zA-Z0-9À-ž ]{1,30}$/."; + if (!preg_match("/^[a-zA-Z0-9À-ž ]{1,30}$/", $this->container['last_name'])) { + $invalidProperties[] = "invalid value for 'last_name', must be conform to the pattern /^[a-zA-Z0-9À-ž ]{1,30}$/."; } if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) > 50)) { $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 50."; } - if (!is_null($this->container['phone']) && !preg_match('/\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/', $this->container['phone'])) { + if (!is_null($this->container['phone']) && !preg_match("/\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/", $this->container['phone'])) { $invalidProperties[] = "invalid value for 'phone', must be conform to the pattern /\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/."; } return $invalidProperties; } + /** + * 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 external_applicant_id * @@ -346,13 +383,13 @@ public function getExternalApplicantId() public function setExternalApplicantId($external_applicant_id) { if (is_null($external_applicant_id)) { - throw new SanitizedInvalidArgumentException('non-nullable external_applicant_id cannot be null'); + throw new \InvalidArgumentException('non-nullable external_applicant_id cannot be null'); } - if (mb_strlen($external_applicant_id) > 255) { - throw new SanitizedInvalidArgumentException('invalid length for $external_applicant_id when calling UserData., must be smaller than or equal to 255.'); + if ((mb_strlen($external_applicant_id) > 255)) { + throw new \InvalidArgumentException('invalid length for $external_applicant_id when calling UserData., must be smaller than or equal to 255.'); } - if (mb_strlen($external_applicant_id) < 1) { - throw new SanitizedInvalidArgumentException('invalid length for $external_applicant_id when calling UserData., must be bigger than or equal to 1.'); + if ((mb_strlen($external_applicant_id) < 1)) { + throw new \InvalidArgumentException('invalid length for $external_applicant_id when calling UserData., must be bigger than or equal to 1.'); } $this->container['external_applicant_id'] = $external_applicant_id; @@ -380,15 +417,17 @@ public function getFirstName() public function setFirstName($first_name) { if (is_null($first_name)) { - throw new SanitizedInvalidArgumentException('non-nullable first_name cannot be null'); + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); + } + if ((mb_strlen($first_name) > 30)) { + throw new \InvalidArgumentException('invalid length for $first_name when calling UserData., must be smaller than or equal to 30.'); } - if (mb_strlen($first_name) > 30) { - throw new SanitizedInvalidArgumentException('invalid length for $first_name when calling UserData., must be smaller than or equal to 30.'); + if ((mb_strlen($first_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $first_name when calling UserData., must be bigger than or equal to 1.'); } - if (mb_strlen($first_name) < 1) { - throw new SanitizedInvalidArgumentException('invalid length for $first_name when calling UserData., must be bigger than or equal to 1.'); + if ((!preg_match("/^[a-zA-Z0-9À-ž ]{1,30}$/", ObjectSerializer::toString($first_name)))) { + throw new \InvalidArgumentException("invalid value for \$first_name when calling UserData., must conform to the pattern /^[a-zA-Z0-9À-ž ]{1,30}$/."); } - $first_name = preg_replace('/[^a-zA-Z0-9À-ž ]+/', '', ObjectSerializer::toString($first_name)); $this->container['first_name'] = $first_name; @@ -415,15 +454,17 @@ public function getLastName() public function setLastName($last_name) { if (is_null($last_name)) { - throw new SanitizedInvalidArgumentException('non-nullable last_name cannot be null'); + throw new \InvalidArgumentException('non-nullable last_name cannot be null'); } - if (mb_strlen($last_name) > 30) { - throw new SanitizedInvalidArgumentException('invalid length for $last_name when calling UserData., must be smaller than or equal to 30.'); + if ((mb_strlen($last_name) > 30)) { + throw new \InvalidArgumentException('invalid length for $last_name when calling UserData., must be smaller than or equal to 30.'); } - if (mb_strlen($last_name) < 1) { - throw new SanitizedInvalidArgumentException('invalid length for $last_name when calling UserData., must be bigger than or equal to 1.'); + if ((mb_strlen($last_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $last_name when calling UserData., must be bigger than or equal to 1.'); + } + if ((!preg_match("/^[a-zA-Z0-9À-ž ]{1,30}$/", ObjectSerializer::toString($last_name)))) { + throw new \InvalidArgumentException("invalid value for \$last_name when calling UserData., must conform to the pattern /^[a-zA-Z0-9À-ž ]{1,30}$/."); } - $last_name = preg_replace('/[^a-zA-Z0-9À-ž ]+/', '', ObjectSerializer::toString($last_name)); $this->container['last_name'] = $last_name; @@ -443,17 +484,17 @@ public function getEmail() /** * Sets email * - * @param string|null $email Conditionally mandatory.It is mandatory only if the phone attribute is not provided. If the email is not provided, the user will not receive the cardPay notification and payLater will ask for the email in the app. + * @param string|null $email Conditionally mandatory. In case of TatraPayPlus payment initiation - It is mandatory only if the phone attribute is not provided. If the email is not provided, the user will not receive the cardPay notification and payLater will ask for the email in the app. In case of Direct API either cardHolder or email is mandatory * * @return self */ public function setEmail($email) { if (is_null($email)) { - throw new SanitizedInvalidArgumentException('non-nullable email cannot be null'); + throw new \InvalidArgumentException('non-nullable email cannot be null'); } - if (mb_strlen($email) > 50) { - throw new SanitizedInvalidArgumentException('invalid length for $email when calling UserData., must be smaller than or equal to 50.'); + if ((mb_strlen($email) > 50)) { + throw new \InvalidArgumentException('invalid length for $email when calling UserData., must be smaller than or equal to 50.'); } $this->container['email'] = $email; @@ -474,31 +515,30 @@ public function getPhone() /** * Sets phone * - * @param string|null $phone Conditionally mandatory.It is mandatory only if the email attribute is not provided. + * @param string|null $phone Conditionally mandatory. In case of TatraPayPlus payment initiation - It is mandatory only if the email attribute is not provided. * * @return self */ public function setPhone($phone) { if (is_null($phone)) { - throw new SanitizedInvalidArgumentException('non-nullable phone cannot be null'); + throw new \InvalidArgumentException('non-nullable phone cannot be null'); } - if (!preg_match('/\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/', ObjectSerializer::toString($phone))) { - throw new SanitizedInvalidArgumentException('invalid value for $phone when calling UserData., must conform to the pattern /\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/.'); + if ((!preg_match("/\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/", ObjectSerializer::toString($phone)))) { + throw new \InvalidArgumentException("invalid value for \$phone when calling UserData., must conform to the pattern /\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$/."); } $this->container['phone'] = $phone; return $this; } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -508,7 +548,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -522,7 +562,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -538,7 +578,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -548,12 +588,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index 71ccbe2..b02bfbd 100755 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -9,9 +9,9 @@ namespace Tatrapayplus\TatrapayplusApiClient; +use InvalidArgumentException; use Tatrapayplus\TatrapayplusApiClient\Api\TatraPayPlusAPIApi; use Tatrapayplus\TatrapayplusApiClient\Model\ModelInterface; -use Tatrapayplus\TatrapayplusApiClient\Model\SanitizedInvalidArgumentException; class ObjectSerializer { @@ -378,7 +378,7 @@ public static function deserialize($data, $class, $httpHeaders = null) $data = is_string($data) ? TatraPayPlusAPIApi::json_decode($data) : $data; if (!is_array($data)) { - throw new SanitizedInvalidArgumentException("Invalid array '$class'"); + throw new InvalidArgumentException("Invalid array '$class'"); } $subClass = substr($class, 0, -2); @@ -549,7 +549,7 @@ public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): } elseif ($encoding === PHP_QUERY_RFC1738) { $encoder = 'urlencode'; } else { - throw new SanitizedInvalidArgumentException('Invalid type'); + throw new InvalidArgumentException('Invalid type'); } $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() diff --git a/lib/TatraPayPlusService.php b/lib/TatraPayPlusService.php index f348598..1becc76 100644 --- a/lib/TatraPayPlusService.php +++ b/lib/TatraPayPlusService.php @@ -2,8 +2,38 @@ namespace Tatrapayplus\TatrapayplusApiClient; +use Tatrapayplus\TatrapayplusApiClient\Model\BankTransferStatus; +use Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatus; +use Tatrapayplus\TatrapayplusApiClient\Model\InitiateDirectTransactionRequest; +use Tatrapayplus\TatrapayplusApiClient\Model\PayLaterStatus; +use Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod; +use Tatrapayplus\TatrapayplusApiClient\Model\QRStatus; + class TatraPayPlusService { + public const SIMPLE_STATUS_ACCEPTED = 'ACCEPTED'; + public const SIMPLE_STATUS_PENDING = 'PENDING'; + public const SIMPLE_STATUS_REJECTED = 'REJECTED'; + + public const SIMPLE_STATUS_MAP = array( + PaymentMethod::PAY_LATER => array( + self::SIMPLE_STATUS_ACCEPTED => [PayLaterStatus::LOAN_APPLICATION_FINISHED, PayLaterStatus::LOAN_DISBURSED], + self::SIMPLE_STATUS_REJECTED => [PayLaterStatus::CANCELED, PayLaterStatus::EXPIRED], + ), + PaymentMethod::CARD_PAY => array( + self::SIMPLE_STATUS_ACCEPTED => [CardPayStatus::OK, CardPayStatus::CB], + self::SIMPLE_STATUS_REJECTED => [CardPayStatus::FAIL], + ), + PaymentMethod::BANK_TRANSFER => array( + self::SIMPLE_STATUS_ACCEPTED => [BankTransferStatus::ACCC, BankTransferStatus::ACSC], + self::SIMPLE_STATUS_REJECTED => [BankTransferStatus::CANC, BankTransferStatus::RJCT], + ), + PaymentMethod::QR_PAY => array( + self::SIMPLE_STATUS_ACCEPTED => [QRStatus::ACCC], + self::SIMPLE_STATUS_REJECTED => [QRStatus::EXPIRED], + ), + ); + public static function remove_diacritics($string) { $pattern = '/[^0-9a-zA-Z.@_ -]/'; @@ -154,4 +184,42 @@ public static function generate_signed_card_id_from_cid($cid, $public_key_conten return $signedData; } + + public static function map_simple_status($status_response) + { + $status_to_return = self::SIMPLE_STATUS_PENDING; + + $status_response_object = $status_response['object']; + $selected_method = $status_response_object->getSelectedPaymentMethod(); + $status_to_map = $status_response_object->getStatus(); + + if (!array_key_exists($selected_method, self::SIMPLE_STATUS_MAP) || is_null($status_to_map)) { + return $status_to_return; + } + + if (!is_string($status_to_map)) { + $status_to_map = $status_to_map->getStatus(); + } + + foreach (self::SIMPLE_STATUS_MAP[$selected_method] as $simple_status => $gateway_statuses) { + if (in_array($status_to_map, $gateway_statuses)) { + $status_to_return = $simple_status; + break; + } + } + return $status_to_return; + } + + public static function remove_card_holder_diacritics($initiate_payment_request) + { + if ($initiate_payment_request instanceof InitiateDirectTransactionRequest) { + $card_detail = $initiate_payment_request->getTdsData(); + $card_detail->setCardHolder(self::remove_diacritics($card_detail->getCardHolder())); + } else { + $card_detail = $initiate_payment_request->getCardDetail(); + $card_detail->setCardHolder(self::remove_diacritics($card_detail->getCardHolder())); + } + + return $initiate_payment_request; + } } diff --git a/openapi_generator_config.json b/openapi_generator_config.json new file mode 100644 index 0000000..34f72bd --- /dev/null +++ b/openapi_generator_config.json @@ -0,0 +1,7 @@ +{ + "apiPackage": "Tatrapayplus", + "invokerPackage": "Tatrapayplus\\TatrapayplusApiClient", + "developerOrganization": "SmartBase", + "developerOrganizationUrl": "https://github.com/SmartBase-SK", + "hideGenerationTimestamp" : true +} \ No newline at end of file diff --git a/tatrapayplus_api_sandbox.json b/tatrapayplus_api_sandbox.json new file mode 100644 index 0000000..1b5c9c3 --- /dev/null +++ b/tatrapayplus_api_sandbox.json @@ -0,0 +1,2252 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "TatraPayPlus API", + "version": "0.0.1_2024-05-27v1" + }, + "servers": [ + { + "url": "https://api.tatrabanka.sk/tatrapayplus/sandbox", + "description": "TatraPayPlus API sandbox" + } + ], + "paths": { + "/v1/payments": { + "post": { + "summary": "Initiate payment intent", + "description": "Initiate payment intent", + "operationId": "initiatePayment", + "tags": [ + "TatraPayPlus API" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-Request-ID" + }, + { + "$ref": "#/components/parameters/IP-Address" + }, + { + "$ref": "#/components/parameters/Redirect-URI" + }, + { + "$ref": "#/components/parameters/Preferred-Method" + }, + { + "$ref": "#/components/parameters/Accept-Language" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/initiatePaymentBody" + }, + "responses": { + "201": { + "$ref": "#/components/responses/OK_201_InitiatePaymentResponse" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + } + }, + "/v1/payments/methods": { + "get": { + "summary": "Payment methods list", + "description": "Payment methods list", + "operationId": "getMethods", + "tags": [ + "TatraPayPlus API", + "TatraPayPlus DirectAPI" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-Request-ID" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/OK_200_PaymentMethodsList" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + } + }, + "/v1/payments/{payment-id}/status": { + "get": { + "summary": "Payment intent status.", + "description": "Payment intent status", + "operationId": "getPaymentIntentStatus", + "tags": [ + "TatraPayPlus API", + "TatraPayPlus DirectAPI" + ], + "parameters": [ + { + "$ref": "#/components/parameters/Payment-id" + }, + { + "$ref": "#/components/parameters/X-Request-ID" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/OK_200_PaymentIntentStatus" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + } + }, + "/v1/payments/{payment-id}": { + "patch": { + "summary": "Update payment intent", + "description": "Update payment intent. Only available for payments initiated by the CARD_PAY, DIRECT_API method.", + "operationId": "updatePaymentIntent", + "tags": [ + "TatraPayPlus API", + "TatraPayPlus DirectAPI" + ], + "parameters": [ + { + "$ref": "#/components/parameters/Payment-id" + }, + { + "$ref": "#/components/parameters/X-Request-ID" + }, + { + "$ref": "#/components/parameters/Idempotency-Key" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/updatePaymentBody" + }, + "responses": { + "200": { + "$ref": "#/components/responses/OK_200_PaymentIntentUpdate" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + }, + "delete": { + "summary": "Cancel payment intent.", + "description": "Cancel payment intent. Available in general if authorizationStatus is NEW. This method is also available for payments initiated by the PAY_LATER payment method, but only if the status is CUSTOMER_CREATION_IN_PROGRESS.", + "operationId": "cancelPaymentIntent", + "tags": [ + "TatraPayPlus API" + ], + "parameters": [ + { + "$ref": "#/components/parameters/Payment-id" + }, + { + "$ref": "#/components/parameters/X-Request-ID" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/OK_200_PaymentIntentCancelation" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + } + }, + "/v1/payments-direct": { + "post": { + "summary": "Create direct transaction request", + "description": "After obtaining the token from the Google Pay API or Apple Pay API, you need to send the token along with other payment details to the TatraPayPlus API.", + "operationId": "createDirectTransactionRequest", + "tags": [ + "TatraPayPlus DirectAPI" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-Request-ID" + }, + { + "$ref": "#/components/parameters/IP-Address" + }, + { + "$ref": "#/components/parameters/Redirect-URI" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/initiateDirectTransaction" + }, + "responses": { + "200": { + "$ref": "#/components/responses/OK_201_InitiateDirectAPITransactionResponse" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + } + }, + "/v1/appearances": { + "post": { + "summary": "Set appearance parameters for TatraPayPlus", + "description": "Set appearance parameters for TatraPayPlus", + "operationId": "setAppearance", + "tags": [ + "TatraPayPlus Appearance API" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-Request-ID" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/appearanceBody" + }, + "responses": { + "201": { + "$ref": "#/components/responses/OK_201_Appearance_created" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + } + }, + "/v1/appearances/logo": { + "post": { + "summary": "Set logo for TatraPayPlus", + "description": "Logo appearance request body. Logo must follow these rules:\nMaxLength: 256px\nMaxHeight: 64px\n", + "operationId": "setLogo", + "tags": [ + "TatraPayPlus Appearance API" + ], + "parameters": [ + { + "$ref": "#/components/parameters/X-Request-ID" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/logoBody" + }, + "responses": { + "201": { + "$ref": "#/components/responses/OK_201_Logo_created" + }, + "400": { + "$ref": "#/components/responses/BAD_REQUEST_400" + }, + "401": { + "$ref": "#/components/responses/UNAUTHORIZED_401" + }, + "403": { + "$ref": "#/components/responses/FORBIDDEN_403" + }, + "404": { + "$ref": "#/components/responses/NOT_FOUND_404" + }, + "405": { + "$ref": "#/components/responses/METHOD_NOT_ALLOWED_405" + }, + "406": { + "$ref": "#/components/responses/NOT_ACCEPTABLE_406" + }, + "408": { + "$ref": "#/components/responses/REQUEST_TIMEOUT_408" + }, + "409": { + "$ref": "#/components/responses/CONFLICT_409" + }, + "415": { + "$ref": "#/components/responses/UNSUPPORTED_MEDIA_TYPE_415" + }, + "429": { + "$ref": "#/components/responses/TOO_MANY_REQUESTS_429" + }, + "500": { + "$ref": "#/components/responses/INTERNAL_SERVER_ERROR_500" + }, + "503": { + "$ref": "#/components/responses/SERVICE_UNAVAILABLE_503" + } + } + } + } + }, + "components": { + "securitySchemes": { + "oAuth2ClientCredentials": { + "type": "oauth2", + "description": "See https://datatracker.ietf.org/doc/html/rfc6749#section-4.4", + "flows": { + "clientCredentials": { + "tokenUrl": "https://api.tatrabanka.sk/tatrapayplus/sandbox/auth/oauth/v2/token", + "scopes": { + "TATRAPAYPLUS": "access to TatraPay Plus API" + } + } + } + } + }, + "schemas": { + "paymentIntentUpdateResponse": { + "description": "\n**TatraPayPlus payment update response. **\n\n| selectedPaymentMethod | attribute supported |\n| ---------------- | ------------|\n| BANK_TRANSFER | N/A |\n| CARD_PAY | cardPayStatusStructure |\n| PAY_LATER | N/A |\n", + "type": "object", + "properties": { + "status": { + "oneOf": [ + { + "$ref": "#/components/schemas/cardPayStatusStructure" + } + ] + } + } + }, + "paymentIntentCancelResponse": { + "description": "\n**TatraPayPlus cancel response. **\n", + "type": "object", + "properties": { + "selectedPaymentMethod": { + "$ref": "#/components/schemas/paymentMethod" + } + } + }, + "paymentIntentStatusResponse": { + "description": "\n**TatraPayPlus status response. For each payment method will be sent specific status structure**\n\n| selectedPaymentMethod | status structure | description|\n| ---------------- | ------------| ------------|\n| BANK_TRANSFER | bankTransferStatus ||\n| QR_PAY | bankTransferStatus | Only ACCC is provided. Status will be provided as soon as amount is in target account |\n| CARD_PAY | cardPayStatusStructure ||\n| PAY_LATER | payLaterStatus ||\n| DIRECT_API | cardPayStatusStructure ||\n", + "type": "object", + "required": [ + "authorizationStatus" + ], + "properties": { + "selectedPaymentMethod": { + "$ref": "#/components/schemas/paymentMethod" + }, + "authorizationStatus": { + "type": "string", + "enum": [ + "NEW", + "PAY_METHOD_SELECTED", + "AUTH_DONE", + "AUTH_FAILED", + "EXPIRED", + "CANCELLED_BY_TPP", + "CANCELLED_BY_USER" + ], + "description": "Status of payment intent authorization progress. Be aware, It doesnt indicate payment status! To get payment status see attribute status." + }, + "status": { + "oneOf": [ + { + "$ref": "#/components/schemas/cardPayStatusStructure" + }, + { + "$ref": "#/components/schemas/bankTransferStatus" + }, + { + "$ref": "#/components/schemas/payLaterStatus" + } + ] + } + } + }, + "paymentMethodsListResponse": { + "description": "TatraPayPlus methods list, in case BANK_TRANSFER method is allowed for client,allowedBankProviders will be also provided", + "type": "object", + "required": [ + "paymentMethods" + ], + "properties": { + "paymentMethods": { + "$ref": "#/components/schemas/paymentMethods" + } + } + }, + "appearanceLogoRequest": { + "type": "object", + "description": "The logo image.", + "required": [ + "logoImage" + ], + "properties": { + "logoImage": { + "type": "string", + "description": "base64 Encoded image. MaxLength - 256px MaxHeight - 64px, Max size 1MB(base64 encoded string). Supported formats are SVG, JPEG, PNG", + "maxLength": 1000000, + "format": "byte" + } + } + }, + "appearanceRequest": { + "type": "object", + "description": "Attributes that can be customised", + "properties": { + "theme": { + "type": "string", + "enum": [ + "DARK", + "LIGHT", + "SYSTEM" + ], + "default": "SYSTEM" + }, + "tintOnAccent": { + "$ref": "#/components/schemas/colorAttribute" + }, + "tintAccent": { + "$ref": "#/components/schemas/colorAttribute" + }, + "surfaceAccent": { + "$ref": "#/components/schemas/colorAttribute" + } + } + }, + "colorAttribute": { + "type": "object", + "description": "Color attributes for specific theme. Choose colour with sufficient contrast for the specific theme", + "properties": { + "colorDarkMode": { + "$ref": "#/components/schemas/color" + }, + "colorLightMode": { + "$ref": "#/components/schemas/color" + } + } + }, + "color": { + "type": "string", + "description": "Hexadecimal value of the color", + "pattern": "^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$" + }, + "udpatePaymentRequest": { + "$ref": "#/components/schemas/cardPayUpdateInstruction" + }, + "cardPayUpdateInstruction": { + "description": "CardPay update instruction. For CONFIRM_PRE_AUTHORIZATION, CHARGEBACK is amount mandatory.", + "type": "object", + "required": [ + "operationType" + ], + "properties": { + "operationType": { + "type": "string", + "enum": [ + "CONFIRM_PRE_AUTHORIZATION", + "CANCEL_PRE_AUTHORIZATION", + "CHARGEBACK" + ] + }, + "amount": { + "$ref": "#/components/schemas/amountValue" + } + } + }, + "initiateDirectTransactionRequest": { + "description": "Body for direct transaction initiation", + "type": "object", + "required": [ + "amount", + "endToEnd", + "tdsData", + "token" + ], + "properties": { + "amount": { + "$ref": "#/components/schemas/amount" + }, + "endToEnd": { + "$ref": "#/components/schemas/e2e" + }, + "isPreAuthorization": { + "description": "If true - pre-authorization transaction", + "type": "boolean" + }, + "tdsData": { + "$ref": "#/components/schemas/directTransactionTDSData" + }, + "ipspData": { + "$ref": "#/components/schemas/directTransactionIPSPData" + }, + "token": { + "$ref": "#/components/schemas/token" + } + } + }, + "initiatePaymentRequest": { + "description": "Body for payment initiation", + "type": "object", + "required": [ + "basePayment" + ], + "properties": { + "basePayment": { + "$ref": "#/components/schemas/basePayment" + }, + "userData": { + "$ref": "#/components/schemas/userData" + }, + "bankTransfer": { + "$ref": "#/components/schemas/bankTransfer" + }, + "cardDetail": { + "$ref": "#/components/schemas/cardDetail" + }, + "payLater": { + "$ref": "#/components/schemas/payLater" + } + } + }, + "initiatePaymentResponse": { + "type": "object", + "required": [ + "paymentId" + ], + "properties": { + "paymentId": { + "$ref": "#/components/schemas/paymentId" + }, + "tatraPayPlusUrl": { + "$ref": "#/components/schemas/tatraPayPlusUrl" + }, + "availablePaymentMethods": { + "type": "array", + "description": "List of availibility of each possible methods.", + "items": { + "$ref": "#/components/schemas/availablePaymentMethod" + } + } + } + }, + "directTransactionTaskStatusResponse": { + "type": "object", + "properties": { + "transactionId": { + "$ref": "#/components/schemas/transactionId" + }, + "status": { + "$ref": "#/components/schemas/directTransactionStatus" + }, + "transactionData": { + "$ref": "#/components/schemas/directTransactionData" + } + } + }, + "initiateDirectTransactionResponse": { + "type": "object", + "required": [ + "paymentId" + ], + "properties": { + "paymentId": { + "$ref": "#/components/schemas/paymentId" + }, + "redirectFormHtml": { + "$ref": "#/components/schemas/directTransactionRedirectFormHtml" + } + } + }, + "40x_errorBody": { + "type": "object", + "required": [ + "errorCode" + ], + "properties": { + "errorCode": { + "type": "string", + "maxLength": 20, + "enum": [ + "NOT_ALLOWED_OPER", + "TOKEN_UNKNOWN", + "TOKEN_INVALID", + "TOKEN_EXPIRED" + ] + }, + "errorDescription": { + "type": "string", + "maxLength": 1024 + } + } + }, + "400_errorBody": { + "type": "object", + "properties": { + "errorCode": { + "type": "string", + "maxLength": 20, + "enum": [ + "NO_CONTRACT", + "ILLEGAL_ARGUMENT", + "TOT_AMNT_LOW", + "TOT_AMNT_MISMATCH", + "PAYMENT_NOT_FOUND", + "NOT_ALLOWED_OPER", + "DUPLICATE_CALL", + "PA_AMOUNT_EXCEEDED", + "PA_NOT_FOUND", + "PA_ERROR", + "CB_AMOUNT_EXCEEDED", + "CB_NOT_FOUND", + "CB_TOO_OLD", + "CB_ERROR", + "NO_AVAIL_PAY_METH" + ] + }, + "errorDescription": { + "type": "string", + "maxLength": 1024 + }, + "availablePaymentMethods": { + "type": "array", + "description": "Reason codes of declined methods", + "items": { + "$ref": "#/components/schemas/availablePaymentMethod" + } + } + } + }, + "directTransactionRedirectFormHtml": { + "type": "string", + "description": "HTML form. Only for status TDS_AUTH_REQUIRED", + "maxLength": 300000 + }, + "directTransactionData": { + "type": "object", + "properties": { + "reasonCode": { + "oneOf": [ + { + "$ref": "#/components/schemas/cardPayReasonCodes3Chars" + }, + { + "$ref": "#/components/schemas/cardPayReasonCodes2Chars" + } + ] + }, + "paymentAuthorizationCode": { + "type": "string", + "description": "Payment authorization code", + "pattern": "^[ 0-9A-Z]{6}$" + } + } + }, + "directTransactionStatus": { + "type": "string", + "enum": [ + "OK", + "FAIL", + "TDS_AUTH_REQUIRED" + ] + }, + "transactionId": { + "description": "This identification of the transaction, available only in state OK and FAIL", + "type": "string", + "format": "$uuid", + "example": "5e8bda08-5521-11ed-bdc3-0242ac120002" + }, + "taskId": { + "description": "This identification of the processing transaction job", + "type": "string", + "format": "$uuid", + "example": "5e8bda08-5521-11ed-bdc3-0242ac120002" + }, + "amount": { + "type": "object", + "required": [ + "amountValue", + "currency" + ], + "properties": { + "amountValue": { + "$ref": "#/components/schemas/amountValue" + }, + "currency": { + "$ref": "#/components/schemas/currencyCode" + } + } + }, + "availablePaymentMethod": { + "type": "object", + "required": [ + "paymentMethod", + "isAvailable" + ], + "properties": { + "paymentMethod": { + "$ref": "#/components/schemas/paymentMethod" + }, + "isAvailable": { + "type": "boolean", + "description": "if true, method will be shown to user. Otherwise reasonCode will be provided" + }, + "reasonCodeMethodAvailability": { + "type": "string", + "description": "reason code. List of enumaration will be provided in documentation", + "enum": [ + "NO_CONTRACT", + "NOT_FEASIBLE_CURRENCY", + "OUT_OF_RANGE_AMOUNT", + "MANDATORY_STRUCTURE_NOT_PROVIDED" + ] + }, + "reasonCodeMethodAvailabilityDescription": { + "type": "string", + "description": "reason code description" + } + } + }, + "scaAuthLink": { + "description": "sca authorization link", + "format": "$url", + "type": "string" + }, + "cardPayStatus": { + "description": "\n**CardPay status**\n\n| Enum | description |\n| ---------------- | ------------|\n| INIT | initialized transaction |\n| OK | processed successfully transaction |\n| FAIL | failed transaction |\n| PA | pre-authorization |\n| CPA | completed pre-authorization |\n| SPA | canceled preauthorization |\n| XPA | expired pre-authorization |\n| CB | returned payment |\n| AUTH_REQUIRED | 3D secure authorization required |\n| AUTH_EXPIRED | authorization expired |\n| AUTH_CANCELED | authorization canceled |\n", + "type": "string", + "enum": [ + "INIT", + "OK", + "FAIL", + "PA", + "CPA", + "SPA", + "XPA", + "CB", + "AUTH_REQUIRED", + "AUTH_EXPIRED", + "AUTH_CANCELED" + ], + "example": "OK" + }, + "cardPayStatusStructure": { + "description": "card pay status structure", + "type": "object", + "required": [ + "status", + "currency" + ], + "properties": { + "status": { + "$ref": "#/components/schemas/cardPayStatus" + }, + "currency": { + "$ref": "#/components/schemas/currencyCode" + }, + "amount": { + "$ref": "#/components/schemas/amountValue" + }, + "preAuthorization": { + "$ref": "#/components/schemas/cardPayAmount" + }, + "chargeBack": { + "$ref": "#/components/schemas/cardPayAmount" + }, + "comfortPay": { + "type": "object", + "required": [ + "status" + ], + "properties": { + "status": { + "$ref": "#/components/schemas/comfortPayStatus" + }, + "cid": { + "$ref": "#/components/schemas/cardId" + } + } + }, + "maskedCardNumber": { + "$ref": "#/components/schemas/maskedCardNumber" + }, + "reasonCode": { + "oneOf": [ + { + "$ref": "#/components/schemas/cardPayReasonCodes3Chars" + }, + { + "$ref": "#/components/schemas/cardPayReasonCodes2Chars" + } + ] + }, + "paymentAuthorizationCode": { + "type": "string", + "description": "Payment authorization code", + "pattern": "^[ 0-9A-Z]{6}$" + } + } + }, + "maskedCardNumber": { + "description": "Masked card number.", + "type": "string", + "maxLength": 19 + }, + "cardPayReasonCodes3Chars": { + "description": "FDS,TDS, SYS.", + "type": "string", + "maxLength": 3 + }, + "cardPayReasonCodes2Chars": { + "description": "2 chars card reasonCode, https://developer.visa.com/request_response_codes#action_code , https://developer.mastercard.com/mastercard-send-disbursements/documentation/response-error-codes/network-response-codes/", + "type": "string", + "maxLength": 2 + }, + "comfortPayStatus": { + "type": "string", + "enum": [ + "OK", + "FAIL" + ] + }, + "cardPayAmount": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/components/schemas/amountValue" + } + } + }, + "payLaterStatus": { + "type": "string", + "description": "Finance application status", + "enum": [ + "NEW", + "CUSTOMER_CREATION_IN_PROGRESS", + "LOAN_APPLICATION_IN_PROGRESS", + "LOAN_APPLICATION_FINISHED", + "LOAN_DISBURSED", + "CANCELED", + "EXPIRED" + ] + }, + "bankTransferStatus": { + "description": "The transaction status is filled with codes of the ISO 20022\n", + "type": "string", + "enum": [ + "ACCC", + "ACCP", + "ACSC", + "ACSP", + "ACTC", + "ACWC", + "ACWP", + "RCVD", + "PDNG", + "RJCT", + "CANC", + "ACFC", + "PATC", + "PART" + ], + "example": "ACCP" + }, + "tatraPayPlusUrl": { + "description": "URL address for FE redirect to tatraPayPlus app", + "type": "string", + "format": "$url" + }, + "paymentId": { + "description": "Payment intent identifier", + "type": "string", + "format": "$uuid" + }, + "payLater": { + "type": "object", + "required": [ + "order", + "applicant" + ], + "properties": { + "order": { + "$ref": "#/components/schemas/order" + }, + "capacityInfo": { + "$ref": "#/components/schemas/capacityInfo" + } + } + }, + "capacityInfo": { + "type": "object", + "description": "Capacity posibilities of user. It is used to specify the calculation of the client's request. Based on this, the bank can make a more accurate calculation of the possibility of obtaining a loan", + "required": [ + "monthlyIncome", + "monthlyExpenses", + "numberOfChildren" + ], + "properties": { + "monthlyIncome": { + "$ref": "#/components/schemas/monthlyIncome" + }, + "monthlyExpenses": { + "$ref": "#/components/schemas/monthlyExpenses" + }, + "numberOfChildren": { + "$ref": "#/components/schemas/numberOfChildren" + } + } + }, + "monthlyIncome": { + "type": "number", + "format": "double", + "description": "Declared monthly income by user" + }, + "monthlyExpenses": { + "type": "number", + "format": "double", + "description": "Declared monthly expenses by user" + }, + "numberOfChildren": { + "type": "integer", + "minimum": 0, + "description": "Declared number of children of user" + }, + "userData": { + "type": "object", + "required": [ + "firstName", + "lastName" + ], + "properties": { + "externalApplicantId": { + "$ref": "#/components/schemas/externalApplicantId" + }, + "firstName": { + "$ref": "#/components/schemas/name" + }, + "lastName": { + "$ref": "#/components/schemas/name" + }, + "email": { + "$ref": "#/components/schemas/email" + }, + "phone": { + "$ref": "#/components/schemas/phone" + } + } + }, + "externalApplicantId": { + "type": "string", + "maxLength": 255, + "minLength": 1, + "description": "External applicant ID, could be generated by application" + }, + "name": { + "type": "string", + "maxLength": 30, + "minLength": 1, + "pattern": "^[a-zA-Z0-9À-ž ]{1,30}$" + }, + "phone": { + "description": "Conditionally mandatory. In case of TatraPayPlus payment initiation - It is mandatory only if the email attribute is not provided.", + "type": "string", + "pattern": "\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$" + }, + "orderNo": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "description": "Order Number. Sending the same orderNo will affect that previously created application status will change to 'CANCELLED' and new application will be created. In case that application is in state that its not possible to cancel, the error state 422 will be returned\n" + }, + "quantity": { + "type": "integer", + "format": "int64", + "description": "Quantity of the item", + "example": 1 + }, + "totalItemPrice": { + "type": "number", + "format": "double", + "description": "Total item price (including quantity e.g.:(item price*quantity))", + "example": 120 + }, + "itemName": { + "type": "string", + "maxLength": 255, + "minLength": 1 + }, + "itemDescription": { + "type": "string", + "maxLength": 1000, + "minLength": 1 + }, + "itemDetailLangUnit": { + "type": "object", + "required": [ + "itemName" + ], + "properties": { + "itemName": { + "$ref": "#/components/schemas/itemName" + }, + "itemDescription": { + "$ref": "#/components/schemas/itemDescription" + } + } + }, + "itemDetail": { + "type": "object", + "required": [ + "itemDetailSK" + ], + "properties": { + "itemDetailSK": { + "$ref": "#/components/schemas/itemDetailLangUnit" + }, + "itemDetailEN": { + "$ref": "#/components/schemas/itemDetailLangUnit" + } + } + }, + "itemInfoURL": { + "type": "string", + "example": "https://developer.tatrabanka.sk", + "format": "uri" + }, + "itemImage": { + "type": "string", + "example": "VGhpcyBpcyB0ZXN0", + "maxLength": 1000000, + "description": "base64 encoded image h:48px w:48px" + }, + "orderItem": { + "type": "object", + "required": [ + "quantity", + "totalItemPrice", + "itemDetail" + ], + "properties": { + "quantity": { + "$ref": "#/components/schemas/quantity" + }, + "totalItemPrice": { + "$ref": "#/components/schemas/totalItemPrice" + }, + "itemDetail": { + "$ref": "#/components/schemas/itemDetail" + }, + "itemInfoURL": { + "$ref": "#/components/schemas/itemInfoURL" + }, + "itemImage": { + "$ref": "#/components/schemas/itemImage" + } + } + }, + "orderItems": { + "type": "array", + "maxItems": 1000, + "minItems": 1, + "items": { + "$ref": "#/components/schemas/orderItem" + } + }, + "remittanceInformation": { + "type": "string", + "description": "Information for creditor", + "pattern": "^[ 0-9a-zA-Z?:()\\/\\.,'+-]{1,100}$", + "minLength": 1, + "maxLength": 100 + }, + "preferredLoanDuration": { + "type": "integer", + "format": "int64", + "description": "Preferred loan payment period" + }, + "downPayment": { + "type": "number", + "format": "double", + "description": "Downpayment for activation of service" + }, + "order": { + "type": "object", + "description": "Order detail informations", + "required": [ + "orderNo", + "totalAmount", + "orderItems", + "orderPaymentData" + ], + "properties": { + "orderNo": { + "$ref": "#/components/schemas/orderNo" + }, + "orderItems": { + "$ref": "#/components/schemas/orderItems" + }, + "preferredLoanDuration": { + "$ref": "#/components/schemas/preferredLoanDuration" + }, + "downPayment": { + "$ref": "#/components/schemas/downPayment" + } + } + }, + "allowedBankProviders": { + "description": "Allowed bank providers for BANK_TRNASFER method selected by TatraPayPlus client", + "type": "array", + "items": { + "$ref": "#/components/schemas/provider" + } + }, + "bankProvider": { + "description": "BANK_TRNASFER type bank provider, for full list see documentation", + "type": "string" + }, + "paymentMethods": { + "description": "TatraPayPlus methods list", + "type": "array", + "items": { + "$ref": "#/components/schemas/paymentMethodRules" + } + }, + "paymentMethodRules": { + "type": "object", + "required": [ + "paymentmethod" + ], + "properties": { + "paymentmethod": { + "$ref": "#/components/schemas/paymentMethod" + }, + "amountRangeRule": { + "$ref": "#/components/schemas/amountRangeRule" + }, + "supportedCurrency": { + "$ref": "#/components/schemas/supportedCurrency" + }, + "supportedCountry": { + "$ref": "#/components/schemas/supportedCountry" + }, + "allowedBankProviders": { + "$ref": "#/components/schemas/allowedBankProviders" + } + } + }, + "amountRangeRule": { + "type": "object", + "description": "Range of amounts allowed for a given payment method", + "properties": { + "minAmount": { + "type": "number" + }, + "maxAmount": { + "type": "number" + } + } + }, + "supportedCurrency": { + "type": "array", + "items": { + "$ref": "#/components/schemas/currencyCode" + } + }, + "supportedCountry": { + "type": "array", + "description": "Payment method is applicable for payment to listed countries", + "items": { + "$ref": "#/components/schemas/countryCode" + } + }, + "paymentMethod": { + "description": "TatraPayPlus enumaration", + "type": "string", + "enum": [ + "BANK_TRANSFER", + "CARD_PAY", + "PAY_LATER", + "DIRECT_API", + "QR_PAY" + ] + }, + "provider": { + "description": "Data provider", + "type": "object", + "required": [ + "countryCode", + "providerName", + "providerCode", + "swiftCode" + ], + "properties": { + "countryCode": { + "$ref": "#/components/schemas/countryCode" + }, + "providerName": { + "type": "string", + "maxLength": 500, + "example": "Dummie bank" + }, + "providerCode": { + "maxLength": 50, + "type": "string" + }, + "swiftCode": { + "$ref": "#/components/schemas/bicfi" + } + } + }, + "bicfi": { + "description": "BICFI\n", + "type": "string", + "pattern": "[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}", + "example": "AAAADEBBXXX" + }, + "basePayment": { + "description": "Common instruction detail", + "type": "object", + "required": [ + "instructedAmount", + "endToEnd" + ], + "properties": { + "instructedAmount": { + "$ref": "#/components/schemas/amount" + }, + "endToEnd": { + "$ref": "#/components/schemas/e2e" + } + } + }, + "bankTransfer": { + "description": "Bank transder attributes", + "type": "object", + "properties": { + "remittanceInformationUnstructured": { + "$ref": "#/components/schemas/remittanceInformationUnstructured" + } + } + }, + "comfortPay": { + "description": "ComfortPay attributes", + "type": "object", + "required": [ + "name" + ], + "properties": { + "cardIdentifier": { + "$ref": "#/components/schemas/cardIdentifierOrRegister" + } + } + }, + "directTransactionTDSData": { + "type": "object", + "description": "In case of Direct API either cardHolder or email is mandatory", + "properties": { + "cardHolder": { + "$ref": "#/components/schemas/cardHolder" + }, + "email": { + "$ref": "#/components/schemas/email" + }, + "phone": { + "$ref": "#/components/schemas/phone" + }, + "billingAddress": { + "$ref": "#/components/schemas/address" + }, + "shippingAddress": { + "$ref": "#/components/schemas/address" + } + } + }, + "token": { + "oneOf": [ + { + "$ref": "#/components/schemas/applePayToken" + }, + { + "$ref": "#/components/schemas/googlePayToken" + } + ] + }, + "applePayToken": { + "type": "object", + "properties": { + "token": { + "type": "object", + "properties": { + "header": { + "type": "object", + "properties": { + "ephemeralPublicKey": { + "type": "string" + }, + "publicKeyHash": { + "type": "string" + }, + "transactionId": { + "type": "string" + } + } + }, + "data": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "version": { + "type": "string" + } + } + } + } + }, + "googlePayToken": { + "type": "string", + "description": "Value of paymentData.paymentMethodData.tokenizationData.token" + }, + "directTransactionIPSPData": { + "type": "object", + "required": [ + "subMerchantId", + "name", + "location", + "country" + ], + "properties": { + "subMerchantId": { + "type": "string", + "pattern": "^\\d{1,15}$" + }, + "name": { + "type": "string", + "pattern": "^[ 0-9a-zA-Z\\.:\\/\\*-]{1,25}$" + }, + "location": { + "type": "string", + "pattern": "^[ 0-9a-zA-Z-]{1,13}$" + }, + "country": { + "$ref": "#/components/schemas/countryCode" + } + } + }, + "cardDetail": { + "description": "Card pay information", + "type": "object", + "required": [ + "cardHolder" + ], + "properties": { + "cardPayLangOverride": { + "description": "It is possible to override the accept-language header for the CardPay payment method. This override only affects CardPay itself, not the whole TatraPayPlus service. \nIf it is empty , then accept-language is taken into account\n", + "type": "string", + "enum": [ + "SK", + "EN", + "DE", + "HU", + "CZ", + "ES", + "FR", + "IT", + "PL" + ] + }, + "isPreAuthorization": { + "description": "If true - pre-authorization transaction", + "type": "boolean" + }, + "cardHolder": { + "$ref": "#/components/schemas/cardHolder" + }, + "billingAddress": { + "$ref": "#/components/schemas/address" + }, + "shippingAddress": { + "$ref": "#/components/schemas/address" + }, + "comfortPay": { + "$ref": "#/components/schemas/cardIdentifierOrRegister" + } + } + }, + "cardHolder": { + "description": "The card holder name. In case of Direct API either cardHolder or email is mandatory", + "type": "string", + "pattern": "^[ 0-9a-zA-Z.@_-]{2,45}$", + "maxLength": 45, + "minLength": 2 + }, + "registerForComfortPay": { + "description": "Flag to register the card for ComfortPay", + "type": "boolean", + "default": false, + "example": false + }, + "registerForComfortPayObj": { + "type": "object", + "properties": { + "registerForComfortPay": { + "$ref": "#/components/schemas/registerForComfortPay" + } + } + }, + "signedCardIdObj": { + "type": "object", + "properties": { + "signedCardId": { + "$ref": "#/components/schemas/signedCardId" + } + } + }, + "cardIdentifierOrRegister": { + "oneOf": [ + { + "$ref": "#/components/schemas/registerForComfortPayObj" + }, + { + "$ref": "#/components/schemas/signedCardIdObj" + } + ] + }, + "cardId": { + "description": "Card identifier for ComfortPay", + "type": "string", + "maxLength": 18, + "pattern": "[0-9]{1,18}" + }, + "signedCardId": { + "description": "Signed registered card identifier by client signing certificate for direct ComfortPay in base64 encoded string", + "type": "string", + "maxLength": 1024 + }, + "address": { + "type": "object", + "required": [ + "country" + ], + "properties": { + "streetName": { + "type": "string", + "maxLength": 40 + }, + "buildingNumber": { + "type": "string", + "maxLength": 10 + }, + "townName": { + "type": "string", + "maxLength": 35 + }, + "postCode": { + "type": "string", + "maxLength": 10 + }, + "country": { + "$ref": "#/components/schemas/countryCode" + } + } + }, + "countryCode": { + "description": "ISO 3166 ALPHA2 country code.", + "type": "string", + "pattern": "[A-Z]{2}", + "example": "SE" + }, + "e2e": { + "description": "EndToEndId or paymentSymbols", + "oneOf": [ + { + "$ref": "#/components/schemas/paymentSymbols" + }, + { + "$ref": "#/components/schemas/endToEndId" + } + ] + }, + "paymentSymbols": { + "type": "object", + "required": [ + "variableSymbol" + ], + "properties": { + "variableSymbol": { + "$ref": "#/components/schemas/variableSymbol" + }, + "specificSymbol": { + "$ref": "#/components/schemas/specificSymbol" + }, + "constantSymbol": { + "$ref": "#/components/schemas/constantSymbol" + } + } + }, + "variableSymbol": { + "type": "string", + "pattern": "^[0-9]{1,10}$", + "example": 123456 + }, + "specificSymbol": { + "type": "string", + "pattern": "^[0-9]{1,10}$" + }, + "constantSymbol": { + "type": "string", + "description": "In case of payment method CardPay will be automatically rewrite to value 0608", + "pattern": "^[0-9]{1,4}$" + }, + "endToEndId": { + "description": "Max 35 alphanumeric characters\n", + "pattern": "^[0-9a-zA-Z\\/\\. -]{1,35}$", + "type": "string", + "minLength": 1, + "maxLength": 35 + }, + "currencyCode": { + "description": "ISO 4217 Alpha 3 currency code.\n", + "type": "string", + "pattern": "[A-Z]{3}", + "example": "EUR" + }, + "amountValue": { + "description": "The amount given with fractional digits, where fractions must be compliant to the currency definition. Negative amounts are signed by minus.\nThe decimal separator is a dot.\n\n**Example:**\nValid representations for EUR with up to two decimals are:\n\n * 1056\n * 5768.2\n * -1.50\n * 5877.78\n", + "type": "number", + "example": 120, + "pattern": "-?[0-9]{1,9}(\\.[0-9]{1,2})?" + }, + "dateTime": { + "type": "string", + "format": "date-time", + "example": "2017-10-25T15:30:35.035Z" + }, + "date": { + "type": "string", + "format": "date", + "example": "2017-10-25" + }, + "status": { + "description": "Status of calculation", + "type": "string", + "enum": [ + "OFFER", + "NO_OFFER", + "OPEN", + "PROCESSING" + ] + }, + "email": { + "description": "Conditionally mandatory. In case of TatraPayPlus payment initiation - It is mandatory only if the phone attribute is not provided. If the email is not provided, the user will not receive the cardPay notification and payLater will ask for the email in the app.\nIn case of Direct API either cardHolder or email is mandatory", + "type": "string", + "maxLength": 50, + "format": "email" + }, + "iban": { + "type": "string", + "description": "IBAN of an account.", + "pattern": "[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}", + "example": "FR7612345987650123456789014" + }, + "bban": { + "description": "Basic Bank Account Number (BBAN) Identifier.\n\nThis data element can be used in the body of the consent request.\n Message for retrieving account access consent from this account. This\n data elements is used for payment accounts which have no IBAN.\n ISO20022: Basic Bank Account Number (BBAN). \n\n Identifier used nationally by financial institutions, i.e., in individual countries, \n generally as part of a National Account Numbering Scheme(s), \n which uniquely identifies the account of a customer.\n", + "type": "string", + "pattern": "[a-zA-Z0-9]{1,30}", + "example": "BARC12345612345678" + }, + "accountReference": { + "description": "Reference to an account by IBAN, of a payment accounts\n", + "type": "object", + "properties": { + "iban": { + "$ref": "#/components/schemas/iban" + } + } + }, + "remittanceInformationUnstructured": { + "description": "Unstructured transfer information. Currently, Tatrabanka bank transfer does not display the transfer information. The entire SEPA remittanceInformationUnstructured contains 140 characters. The structure of the string consists of 3 parts:\n\n - A. paymentId - fixed 40 characters are reserved for paymentId\n - B. Merchant Name value length - provided in the contract, up to 50 characters\n - C. Custom value length - free characters are calculated as C = 140-A-(B+1). Depends on the length of the merchant name.\n \n E.g. Merchant name = MerchantABCD,s.r.o. (19 characters + 1 separator space). 80 characters are available.\n \n The result of the UnstructuredTransferInformation will look like this\n \n 07b940d2-8b82-4c7a-a0dd-5ebeabcf1f3d MerchantABCD,s.r.o. Your text in remittance\n \n If the value of RemittanceInformationUnstructured in this attribute is longer than the calculated C, your custom value will be truncated. \n \n \n", + "type": "string", + "pattern": "^[ 0-9a-zA-Z?:()\\/\\.,'+-]{1,100}$", + "maxLength": 100, + "example": "Ref Number Merchant" + } + }, + "parameters": { + "task-id": { + "name": "task-id", + "in": "path", + "description": "taskId of the asynch job\n", + "required": true, + "schema": { + "$ref": "#/components/schemas/taskId" + } + }, + "Automatic-Redirect": { + "name": "Redirect-URI", + "in": "header", + "description": "If it is set to 'true', the customer will be automatically redirect to Redirect-URI(if is set) after 9 seconds, otherwise the last page will wait for customer action to click to button\n", + "schema": { + "type": "string", + "format": "uri" + }, + "required": false + }, + "Redirect-URI": { + "name": "Redirect-URI", + "in": "header", + "description": "URI of the client application endpoint, where the user shall be redirected to after payment process. URI has to be registered in Developer portal\n", + "schema": { + "type": "string", + "format": "uri" + }, + "required": true + }, + "Webhook-URI": { + "name": "Webhook-URI", + "in": "header", + "description": "URI of the client application webhook endpoint, where the user shall be sent notifications\n", + "schema": { + "type": "string", + "format": "uri" + }, + "required": false + }, + "X-Request-ID": { + "name": "X-Request-ID", + "in": "header", + "description": "ID of the request, unique to the call, as determined by the initiating party.", + "required": true, + "example": "99391c7e-ad88-49ec-a2ad-99ddcb1f7721", + "schema": { + "type": "string", + "format": "uuid" + } + }, + "Idempotency-Key": { + "name": "Idempotency-Key", + "in": "header", + "description": "An idempotency key is a unique value generated by the client which the resource server uses to recognize subsequent retries of the same request. The Idempotency-Key HTTP request header field carries this key.", + "required": true, + "example": "99391c7e-ad88-49ec-a2ad-99ddcb1f7721", + "schema": { + "type": "string", + "format": "uuid" + } + }, + "IP-Address": { + "name": "IP-Address", + "in": "header", + "description": "The forwarded IP address of the user\n", + "schema": { + "type": "string", + "format": "ipv4" + }, + "required": true, + "example": "192.168.8.78" + }, + "Signature": { + "name": "Signature", + "in": "header", + "description": "Signature for payment body\n", + "schema": { + "type": "string" + }, + "required": true, + "example": "8a91ea4e87c3db6c695051c5ac72498c54099114fc83554fdfabb784b485eea4" + }, + "Preferred-Method": { + "name": "Preferred-Method", + "in": "header", + "description": "Preferred payment intent method\n", + "schema": { + "$ref": "#/components/schemas/paymentMethod" + }, + "required": false, + "example": "BANK_TRANSFER" + }, + "Timestamp": { + "name": "Timestamp", + "in": "header", + "description": "Timestamp. Only +/-1h from UTC(GMT)\n", + "schema": { + "type": "string", + "format": "DDMMYYYYHHMISS" + }, + "required": true, + "example": 1092014125505 + }, + "User-Id": { + "name": "User-Id", + "in": "header", + "description": "The user id, if available.\n", + "schema": { + "type": "string" + }, + "required": false + }, + "Accept-Language": { + "name": "Accept-Language", + "in": "header", + "description": "The \"Accept-Language\" header field is used by user agents to indicate the set of natural languages that are preferred. Available \"en\" and \"sk\"", + "required": false, + "example": "sk", + "schema": { + "type": "string", + "enum": [ + "sk", + "en", + "de", + "hu", + "cz", + "es", + "pl" + ], + "default": "sk" + } + }, + "Payment-id": { + "name": "payment-id", + "in": "path", + "description": "payment intent identifier\n", + "schema": { + "type": "string", + "format": "uuid" + }, + "required": true + } + }, + "headers": { + "X-Request-ID": { + "description": "ID of the request, unique to the call, as determined by the initiating party.", + "required": true, + "example": "99391c7e-ad88-49ec-a2ad-99ddcb1f7721", + "schema": { + "type": "string", + "format": "uuid" + } + } + }, + "requestBodies": { + "initiateDirectTransaction": { + "description": "DirectAPI transaction", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/initiateDirectTransactionRequest" + } + } + } + }, + "initiatePaymentBody": { + "description": "\n**The table bellow describes required objects for specific payment method**\n\n| Base structures | Mandatory for Payment method |\n| ---------------- | ------------|\n| basePayment | Always mandatory |\n| userData | CARD_PAY, PAY_LATER|\n\n| Method specific structures | Mandatory for Payment method |\n| ---------------- | ------------|\n| bankTransfer | BANK_TRANSFER, QR_PAY |\n| cardDetail | CARD_PAY|\n| payLater | PAY_LATER|\n", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/initiatePaymentRequest" + } + } + } + }, + "updatePaymentBody": { + "description": "\n**TatraPayPlus update request**\n\n| Payment method | mandatory structure |\n| ---------------- | ------------|\n| BANK_TRANSFER | N/A |\n| CARD_PAY | cardPayUpdateInstruction |\n| PAY_LATER | N/A |\n", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/udpatePaymentRequest" + } + } + } + }, + "appearanceBody": { + "description": "Appearance request body", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/appearanceRequest" + } + } + } + }, + "logoBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/appearanceLogoRequest" + } + } + } + } + }, + "responses": { + "OK_201_Logo_created": { + "description": "TatraPayPlus Apearance set", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "OK_201_Appearance_created": { + "description": "TatraPayPlus Apearance set", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "OK_201_InitiatePaymentResponse": { + "description": "TatraPayPlus transaction initiated", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/initiatePaymentResponse" + } + } + } + }, + "OK_201_InitiateDirectAPITransactionResponse": { + "description": "TatraPayPlus direct api transaction initiated", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/initiateDirectTransactionResponse" + } + } + } + }, + "OK_200_DirectAPITransactionTaskStatusResponse": { + "description": "TatraPayPlus direct api transaction task status", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/directTransactionTaskStatusResponse" + } + } + } + }, + "OK_200_PaymentMethodsList": { + "description": "OK", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/paymentMethodsListResponse" + } + } + } + }, + "OK_200_PaymentIntentStatus": { + "description": "OK", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/paymentIntentStatusResponse" + } + } + } + }, + "OK_200_PaymentIntentCancelation": { + "description": "Cancel payment intent. Its supported for state 'NEW'", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "OK_200_PaymentIntentUpdate": { + "description": "Payment intent successfully updated", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "BAD_REQUEST_400": { + "description": "Bad Request", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400_errorBody" + } + } + } + }, + "UNAUTHORIZED_401": { + "description": "Unauthorized", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/40x_errorBody" + } + } + } + }, + "FORBIDDEN_403": { + "description": "Forbidden", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/40x_errorBody" + } + } + } + }, + "NOT_FOUND_404": { + "description": "Not found", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "METHOD_NOT_ALLOWED_405": { + "description": "Method not allowed", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "NOT_ACCEPTABLE_406": { + "description": "Not acceptable", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "REQUEST_TIMEOUT_408": { + "description": "Request timeout", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "CONFLICT_409": { + "description": "Conflict", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "UNSUPPORTED_MEDIA_TYPE_415": { + "description": "Unsupported media type", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "TOO_MANY_REQUESTS_429": { + "description": "Too many requests", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "INTERNAL_SERVER_ERROR_500": { + "description": "Internal server error", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + }, + "SERVICE_UNAVAILABLE_503": { + "description": "Service unavailable", + "headers": { + "X-Request-ID": { + "$ref": "#/components/headers/X-Request-ID" + } + } + } + } + }, + "security": [ + { + "oAuth2ClientCredentials": [] + } + ], + "tags": [ + { + "name": "TatraPayPlus API" + }, + { + "name": "TatraPayPlus Appearance API" + }, + { + "name": "TatraPayPlus DirectAPI" + } + ] +} \ No newline at end of file diff --git a/tests/tests.php b/tests/tests.php index bd19e7e..233d2cb 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -183,16 +183,6 @@ public function testLimitLength(): void $this->assertSame($result, "test"); } - public function testRemoveDiacritics(): void - { - $initiate_payment_request = $this->getPaymentPayload(10, "EUR"); - - $this->assertSame( - $initiate_payment_request->getCardDetail()->getCardHolder(), - "Janko Hrasko" - ); - } - public function testGetAvailablePaymentMethods(): void { $api_instance = new TatraPayPlusAPIApi( @@ -296,7 +286,7 @@ public function testInitiatePaymentCheckPaymentStatus(): void $payment_id = $response["object"]->getPaymentId(); $this->assertFalse(is_null($payment_id)); - $response = $api_instance->getPaymentIntentStatus($payment_id); + [$simple_status, $response] = $api_instance->getPaymentIntentStatus($payment_id); $this->assertFalse(is_null($response["object"])); $this->assertSame($response["response"]->getStatusCode(), 200); @@ -305,8 +295,8 @@ public function testInitiatePaymentCheckPaymentStatus(): void PaymentIntentStatusResponse::AUTHORIZATION_STATUS__NEW ); $this->assertSame( - $response["object"]->getSimpleStatus(), - PaymentIntentStatusResponse::SIMPLE_STATUS_PENDING + $simple_status, + TatraPayPlusService::SIMPLE_STATUS_PENDING ); } @@ -409,13 +399,13 @@ public function testSavedCardResponseMocked(): void ->will($this->returnCallback("mock_addAuthHeader")); $api_instance->setClient($mock_client); - $response = $api_instance->getPaymentIntentStatus("12345"); + [$simple_status, $response] = $api_instance->getPaymentIntentStatus("12345"); $this->assertFalse(is_null($response["object"])); $this->assertSame($response["response"]->getStatusCode(), 201); $this->assertSame( - $response["object"]->getSimpleStatus(), - PaymentIntentStatusResponse::SIMPLE_STATUS_ACCEPTED + $simple_status, + TatraPayPlusService::SIMPLE_STATUS_ACCEPTED ); $status_obj = $response["object"]->getStatus(); $this->assertSame($status_obj->getComfortPay()->getCid(), "123"); From a166988324dded2b11b28626f0863a7f7d5a505e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Fri, 9 May 2025 15:21:20 +0200 Subject: [PATCH 14/16] triv: refactor --- generate_openapi_models.sh | 3 +- lib/MagentoCurlClient.php | 2 +- lib/Model/PaymentIntentStatusResponse.php | 484 +++++++++++----------- lib/Model/PaymentMethod.php | 40 +- lib/Model/PaymentMethodRules.php | 0 lib/TatraPayPlusService.php | 4 + 6 files changed, 286 insertions(+), 247 deletions(-) mode change 100755 => 100644 lib/Model/PaymentMethodRules.php diff --git a/generate_openapi_models.sh b/generate_openapi_models.sh index 7ec5d9e..691cf72 100755 --- a/generate_openapi_models.sh +++ b/generate_openapi_models.sh @@ -18,10 +18,9 @@ rm -rf ./tmp-openapi echo "Adding custom Model classes from backup..." cp ./lib/ModelBackup/TokenSuccessResponseType.php ./lib/Model cp ./lib/ModelBackup/QRStatus.php ./lib/Model -cp ./lib/ModelBackup/PaymentIntentStatusResponse.php ./lib/Model -cp ./lib/ModelBackup/PaymentMethod.php ./lib/Model cp ./lib/ModelBackup/PaymentMethodRules.php ./lib/Model +echo "********************************" echo "Verify new Model files by running tests -> phpunit --bootstrap vendor/autoload.php tests/tests.php" echo "Ensure env variables TATRAPAY_CLIENT_ID and TATRAPAY_CLIENT_SECRET are set before running tests" echo "If successful, remove old Model files backup (dir ./lib/ModelBackup)" diff --git a/lib/MagentoCurlClient.php b/lib/MagentoCurlClient.php index a63bbab..9c35a53 100644 --- a/lib/MagentoCurlClient.php +++ b/lib/MagentoCurlClient.php @@ -6,7 +6,7 @@ class MagentoCurlClient { public $logger; public function __construct( $logger, $scopeConfig ) { - if ( !is_null($scopeConfig) && $scopeConfig->getValue('payment/tatrapayplus/enable_debug_log') == "1" ) { + if ( $scopeConfig->getValue('payment/tatrapayplus/enable_debug_log') == "1" ) { $this->logger = $logger; } else { $this->logger = null; diff --git a/lib/Model/PaymentIntentStatusResponse.php b/lib/Model/PaymentIntentStatusResponse.php index b5bc3fc..a8c3811 100644 --- a/lib/Model/PaymentIntentStatusResponse.php +++ b/lib/Model/PaymentIntentStatusResponse.php @@ -2,169 +2,152 @@ /** * PaymentIntentStatusResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; -use Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +use \ArrayAccess; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; -class PaymentIntentStatusResponse implements ModelInterface, \ArrayAccess +/** + * PaymentIntentStatusResponse Class Doc Comment + * + * @category Class + * @description **TatraPayPlus status response. For each payment method will be sent specific status structure** | selectedPaymentMethod | status structure | description| | ---------------- | ------------| ------------| | BANK_TRANSFER | bankTransferStatus || | QR_PAY | bankTransferStatus | Only ACCC is provided. Status will be provided as soon as amount is in target account | | CARD_PAY | cardPayStatusStructure || | PAY_LATER | payLaterStatus || | DIRECT_API | cardPayStatusStructure || + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + */ +class PaymentIntentStatusResponse implements ModelInterface, ArrayAccess, \JsonSerializable { - public const SIMPLE_STATUS_ACCEPTED = 'ACCEPTED'; - public const SIMPLE_STATUS_PENDING = 'PENDING'; - public const SIMPLE_STATUS_REJECTED = 'REJECTED'; - - public const SIMPLE_STATUS_MAP = array( - PaymentMethod::PAY_LATER => array( - self::SIMPLE_STATUS_ACCEPTED => [PayLaterStatus::LOAN_APPLICATION_FINISHED, PayLaterStatus::LOAN_DISBURSED], - self::SIMPLE_STATUS_REJECTED => [PayLaterStatus::CANCELED, PayLaterStatus::EXPIRED], - ), - PaymentMethod::CARD_PAY => array( - self::SIMPLE_STATUS_ACCEPTED => [CardPayStatus::OK, CardPayStatus::CB], - self::SIMPLE_STATUS_REJECTED => [CardPayStatus::FAIL], - ), - PaymentMethod::BANK_TRANSFER => array( - self::SIMPLE_STATUS_ACCEPTED => [BankTransferStatus::ACCC, BankTransferStatus::ACSC], - self::SIMPLE_STATUS_REJECTED => [BankTransferStatus::CANC, BankTransferStatus::RJCT], - ), - PaymentMethod::QR_PAY => array( - self::SIMPLE_STATUS_ACCEPTED => [QRStatus::ACCC], - self::SIMPLE_STATUS_REJECTED => [QRStatus::EXPIRED], - ), - ); - public const DISCRIMINATOR = null; - public const AUTHORIZATION_STATUS__NEW = 'NEW'; - public const AUTHORIZATION_STATUS_PAY_METHOD_SELECTED = 'PAY_METHOD_SELECTED'; - public const AUTHORIZATION_STATUS_AUTH_DONE = 'AUTH_DONE'; - public const AUTHORIZATION_STATUS_AUTH_FAILED = 'AUTH_FAILED'; - public const AUTHORIZATION_STATUS_EXPIRED = 'EXPIRED'; - public const AUTHORIZATION_STATUS_CANCELLED_BY_TPP = 'CANCELLED_BY_TPP'; - public const AUTHORIZATION_STATUS_CANCELLED_BY_USER = 'CANCELLED_BY_USER'; + /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'paymentIntentStatusResponse'; + /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'selected_payment_method' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod', 'authorization_status' => 'string', - 'status' => 'mixed', + 'status' => '\Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponseStatus' ]; + /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * - * @phpstan-var array - * - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'selected_payment_method' => null, 'authorization_status' => null, - 'status' => null, + 'status' => null ]; + /** - * Array of nullable properties. Used for (de)serialization - * - * @var bool[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'selected_payment_method' => false, 'authorization_status' => false, - 'status' => false, - ]; - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'selected_payment_method' => 'selectedPaymentMethod', - 'authorization_status' => 'authorizationStatus', - 'status' => 'status', + 'status' => false ]; + /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'selected_payment_method' => 'setSelectedPaymentMethod', - 'authorization_status' => 'setAuthorizationStatus', - 'status' => 'setStatus', - ]; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** - * Array of attributes to getter functions (for serialization of requests) + * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @return array */ - protected static $getters = [ - 'selected_payment_method' => 'getSelectedPaymentMethod', - 'authorization_status' => 'getAuthorizationStatus', - 'status' => 'getStatus', - 'simple_status' => 'getSimpleStatus', - ]; + public static function openAPITypes() + { + return self::$openAPITypes; + } + /** - * If a nullable field gets set to null, insert it here + * Array of property to format mappings. Used for (de)serialization * - * @var bool[] + * @return array */ - protected array $openAPINullablesSetToNull = []; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + /** - * Associative array for storing property values + * Array of nullable properties * - * @var mixed[] + * @return array */ - protected $container = []; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * Constructor + * Array of nullable field names deliberately set to null * - * @param mixed[] $data Associated array of property values - * initializing the model + * @return boolean[] */ - public function __construct(?array $data = null) + private function getOpenAPINullablesSetToNull(): array { - $this->setIfExists('selected_payment_method', $data ?? [], null); - $this->setIfExists('authorization_status', $data ?? [], null); - $this->setIfExists('status', $data ?? [], null); + return $this->openAPINullablesSetToNull; } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array + * Setter - Array of nullable field names deliberately set to null * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue + * @param boolean[] $openAPINullablesSetToNull */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property - * * @return bool */ public static function isNullable(string $property): bool @@ -173,34 +156,49 @@ public static function isNullable(string $property): bool } /** - * Array of nullable properties + * Checks if a nullable property is set to null. * - * @return array + * @param string $property + * @return bool */ - protected static function openAPINullables(): array + public function isNullableSetToNull(string $property): bool { - return self::$openAPINullables; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * Array of property to type mappings. Used for (de)serialization + * Array of attributes where the key is the local name, + * and the value is the original name * - * @return array + * @var string[] */ - public static function openAPITypes() - { - return self::$openAPITypes; - } + protected static $attributeMap = [ + 'selected_payment_method' => 'selectedPaymentMethod', + 'authorization_status' => 'authorizationStatus', + 'status' => 'status' + ]; /** - * Array of property to format mappings. Used for (de)serialization + * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @var string[] */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } + protected static $setters = [ + 'selected_payment_method' => 'setSelectedPaymentMethod', + 'authorization_status' => 'setAuthorizationStatus', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'selected_payment_method' => 'getSelectedPaymentMethod', + 'authorization_status' => 'getAuthorizationStatus', + 'status' => 'getStatus' + ]; /** * Array of attributes where the key is the local name, @@ -234,46 +232,77 @@ public static function getters() } /** - * Checks if a nullable property is set to null. - * - * @param string $property + * The original name of the model. * - * @return bool + * @return string */ - public function isNullableSetToNull(string $property): bool + public function getModelName() { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + return self::$openAPIModelName; } + public const AUTHORIZATION_STATUS__NEW = 'NEW'; + public const AUTHORIZATION_STATUS_PAY_METHOD_SELECTED = 'PAY_METHOD_SELECTED'; + public const AUTHORIZATION_STATUS_AUTH_DONE = 'AUTH_DONE'; + public const AUTHORIZATION_STATUS_AUTH_FAILED = 'AUTH_FAILED'; + public const AUTHORIZATION_STATUS_EXPIRED = 'EXPIRED'; + public const AUTHORIZATION_STATUS_CANCELLED_BY_TPP = 'CANCELLED_BY_TPP'; + public const AUTHORIZATION_STATUS_CANCELLED_BY_USER = 'CANCELLED_BY_USER'; + /** - * Array of nullable field names deliberately set to null + * Gets allowable values of the enum * - * @return bool[] + * @return string[] */ - private function getOpenAPINullablesSetToNull(): array + public function getAuthorizationStatusAllowableValues() { - return $this->openAPINullablesSetToNull; + return [ + self::AUTHORIZATION_STATUS__NEW, + self::AUTHORIZATION_STATUS_PAY_METHOD_SELECTED, + self::AUTHORIZATION_STATUS_AUTH_DONE, + self::AUTHORIZATION_STATUS_AUTH_FAILED, + self::AUTHORIZATION_STATUS_EXPIRED, + self::AUTHORIZATION_STATUS_CANCELLED_BY_TPP, + self::AUTHORIZATION_STATUS_CANCELLED_BY_USER, + ]; } /** - * The original name of the model. + * Associative array for storing property values * - * @return string + * @var mixed[] */ - public function getModelName() - { - return self::$openAPIModelName; - } + protected $container = []; /** - * Validate all the properties in the model - * return true if all passed + * Constructor * - * @return bool True if all properties are valid + * @param mixed[]|null $data Associated array of property values + * initializing the model */ - public function valid() + public function __construct(?array $data = null) { - return count($this->listInvalidProperties()) === 0; + $this->setIfExists('selected_payment_method', $data ?? [], null); + $this->setIfExists('authorization_status', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -301,34 +330,38 @@ public function listInvalidProperties() } /** - * Gets allowable values of the enum + * Validate all the properties in the model + * return true if all passed * - * @return string[] + * @return bool True if all properties are valid */ - public function getAuthorizationStatusAllowableValues() + public function valid() { - return [ - self::AUTHORIZATION_STATUS__NEW, - self::AUTHORIZATION_STATUS_PAY_METHOD_SELECTED, - self::AUTHORIZATION_STATUS_AUTH_DONE, - self::AUTHORIZATION_STATUS_AUTH_FAILED, - self::AUTHORIZATION_STATUS_EXPIRED, - self::AUTHORIZATION_STATUS_CANCELLED_BY_TPP, - self::AUTHORIZATION_STATUS_CANCELLED_BY_USER, - ]; + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets selected_payment_method + * + * @return \Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod|null + */ + public function getSelectedPaymentMethod() + { + return $this->container['selected_payment_method']; } /** * Sets selected_payment_method * - * @param PaymentMethod|null $selected_payment_method selected_payment_method + * @param \Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod|null $selected_payment_method selected_payment_method * * @return self */ public function setSelectedPaymentMethod($selected_payment_method) { if (is_null($selected_payment_method)) { - throw new InvalidArgumentException('non-nullable selected_payment_method cannot be null'); + throw new \InvalidArgumentException('non-nullable selected_payment_method cannot be null'); } $this->container['selected_payment_method'] = $selected_payment_method; @@ -355,11 +388,17 @@ public function getAuthorizationStatus() public function setAuthorizationStatus($authorization_status) { if (is_null($authorization_status)) { - throw new InvalidArgumentException('non-nullable authorization_status cannot be null'); + throw new \InvalidArgumentException('non-nullable authorization_status cannot be null'); } $allowedValues = $this->getAuthorizationStatusAllowableValues(); if (!in_array($authorization_status, $allowedValues, true)) { - throw new InvalidArgumentException(sprintf("Invalid value '%s' for 'authorization_status', must be one of '%s'", $authorization_status, implode("', '", $allowedValues))); + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'authorization_status', must be one of '%s'", + $authorization_status, + implode("', '", $allowedValues) + ) + ); } $this->container['authorization_status'] = $authorization_status; @@ -369,7 +408,7 @@ public function setAuthorizationStatus($authorization_status) /** * Gets status * - * @return CardPayStatusStructure|BankTransferStatus|PayLaterStatus|null + * @return \Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponseStatus|null */ public function getStatus() { @@ -379,90 +418,25 @@ public function getStatus() /** * Sets status * - * @param string|null $status status + * @param \Tatrapayplus\TatrapayplusApiClient\Model\PaymentIntentStatusResponseStatus|null $status status * * @return self */ public function setStatus($status) { if (is_null($status)) { - throw new InvalidArgumentException('non-nullable status cannot be null'); + throw new \InvalidArgumentException('non-nullable status cannot be null'); } - - $selected_method = $this->getSelectedPaymentMethod(); - - if ($selected_method == PaymentMethod::CARD_PAY) { - $type = '\Tatrapayplus\TatrapayplusApiClient\Model\CardPayStatusStructure'; - $value = ObjectSerializer::deserialize($status, $type, null); - } elseif ($selected_method == PaymentMethod::BANK_TRANSFER) { - $value = new BankTransferStatus(); - $value->setStatus($status); - } elseif ($selected_method == PaymentMethod::PAY_LATER) { - $value = new PayLaterStatus(); - $value->setStatus($status); - } elseif ($selected_method == PaymentMethod::QR_PAY) { - $value = new QRStatus(); - $value->setStatus($status); - } - $this->container['status'] = $value; - - if (is_string($status)) { - $status_to_map = $status; - } else { - $status_to_map = $value->getStatus(); - } - - $this ->setSimpleStatus(self::SIMPLE_STATUS_PENDING); - foreach (self::SIMPLE_STATUS_MAP[$selected_method] as $simple_status => $gateway_statuses) { - if (in_array($status_to_map, $gateway_statuses)) { - $this->setSimpleStatus($simple_status); - break; - } - } - - return $this; - } - - /** - * Gets simple_status - * - * @return string - */ - public function getSimpleStatus() - { - return $this->container['simple_status'] ?? self::SIMPLE_STATUS_PENDING; - } - - /** - * Sets simple_status - * - * @param string|null $simple_status simple_status - * - * @return self - */ - public function setSimpleStatus(string|null $simple_status) - { - $this->container['simple_status'] = $simple_status; + $this->container['status'] = $status; return $this; } - - /** - * Gets selected_payment_method - * - * @return PaymentMethod|null - */ - public function getSelectedPaymentMethod() - { - return $this->container['selected_payment_method']; - } - /** * Returns true if offset exists. False otherwise. * - * @param int $offset Offset + * @param integer $offset Offset * - * @return bool + * @return boolean */ public function offsetExists($offset): bool { @@ -472,7 +446,7 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return mixed|null */ @@ -486,7 +460,7 @@ public function offsetGet($offset) * Sets value based on offset. * * @param int|null $offset Offset - * @param mixed $value Value to be set + * @param mixed $value Value to be set * * @return void */ @@ -502,7 +476,7 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param int $offset Offset + * @param integer $offset Offset * * @return void */ @@ -512,12 +486,40 @@ public function offsetUnset($offset): void } /** - * Setter - Array of nullable field names deliberately set to null + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @param bool[] $openAPINullablesSetToNull + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } + + diff --git a/lib/Model/PaymentMethod.php b/lib/Model/PaymentMethod.php index 54c0676..2afaefe 100644 --- a/lib/Model/PaymentMethod.php +++ b/lib/Model/PaymentMethod.php @@ -2,13 +2,42 @@ /** * PaymentMethod * - * PHP version 7.4 + * PHP version 8.1 * * @category Class + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * TatraPayPlus API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1_2024-05-27v1 + * Generated by: https://openapi-generator.tech + * Generator version: 7.13.0 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ namespace Tatrapayplus\TatrapayplusApiClient\Model; +use \Tatrapayplus\TatrapayplusApiClient\ObjectSerializer; +/** + * PaymentMethod Class Doc Comment + * + * @category Class + * @description TatraPayPlus enumaration + * @package Tatrapayplus\TatrapayplusApiClient + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ class PaymentMethod { /** @@ -19,11 +48,13 @@ class PaymentMethod public const CARD_PAY = 'CARD_PAY'; public const PAY_LATER = 'PAY_LATER'; + + public const DIRECT_API = 'DIRECT_API'; + public const QR_PAY = 'QR_PAY'; /** * Gets allowable values of the enum - * * @return string[] */ public static function getAllowableEnumValues() @@ -32,7 +63,10 @@ public static function getAllowableEnumValues() self::BANK_TRANSFER, self::CARD_PAY, self::PAY_LATER, - self::QR_PAY, + self::DIRECT_API, + self::QR_PAY ]; } } + + diff --git a/lib/Model/PaymentMethodRules.php b/lib/Model/PaymentMethodRules.php old mode 100755 new mode 100644 diff --git a/lib/TatraPayPlusService.php b/lib/TatraPayPlusService.php index 1becc76..8359706 100644 --- a/lib/TatraPayPlusService.php +++ b/lib/TatraPayPlusService.php @@ -32,6 +32,10 @@ class TatraPayPlusService self::SIMPLE_STATUS_ACCEPTED => [QRStatus::ACCC], self::SIMPLE_STATUS_REJECTED => [QRStatus::EXPIRED], ), + PaymentMethod::DIRECT_API => array( + self::SIMPLE_STATUS_ACCEPTED => [CardPayStatus::OK, CardPayStatus::CB], + self::SIMPLE_STATUS_REJECTED => [CardPayStatus::FAIL], + ), ); public static function remove_diacritics($string) From 84b0e21a7d494fd2c60468edff918a663b7d7fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Mon, 12 May 2025 10:23:40 +0200 Subject: [PATCH 15/16] triv: use public key file by default --- .../ECID_PUBLIC_KEY_2023.txt => ECID_PUBLIC_KEY_2023.txt | 0 lib/Api/TatraPayPlusAPIApi.php | 8 +++++++- tests/tests.php | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) rename tests/ECID_PUBLIC_KEY_2023.txt => ECID_PUBLIC_KEY_2023.txt (100%) diff --git a/tests/ECID_PUBLIC_KEY_2023.txt b/ECID_PUBLIC_KEY_2023.txt similarity index 100% rename from tests/ECID_PUBLIC_KEY_2023.txt rename to ECID_PUBLIC_KEY_2023.txt diff --git a/lib/Api/TatraPayPlusAPIApi.php b/lib/Api/TatraPayPlusAPIApi.php index 8bd066e..48d643b 100755 --- a/lib/Api/TatraPayPlusAPIApi.php +++ b/lib/Api/TatraPayPlusAPIApi.php @@ -975,8 +975,14 @@ public function setLogoRequest($appearance_logo_request) ); } - public static function generateSignedCardId(string $cid, string $public_key_content): string + public static function generateSignedCardId(string $cid, string $public_key_content = null): string { + if (empty($public_key_content)) { + $public_key_content = file_get_contents( + dirname(dirname(__FILE__)) . "/../ECID_PUBLIC_KEY_2023.txt" + ); + } + return TatraPayPlusService::generate_signed_card_id_from_cid($cid, $public_key_content); } diff --git a/tests/tests.php b/tests/tests.php index 233d2cb..2d9f26d 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -168,13 +168,16 @@ private function getPaymentPayload( public function testGenerateSignedCardId(): void { $public_key_content = file_get_contents( - dirname(dirname(__FILE__)) . "/tests/ECID_PUBLIC_KEY_2023.txt" + dirname(dirname(__FILE__)) . "/ECID_PUBLIC_KEY_2023.txt" ); $signed_card_id = TatraPayPlusAPIApi::generateSignedCardId( "123", $public_key_content ); $this->assertTrue(is_string($signed_card_id)); + + $signed_card_id = TatraPayPlusAPIApi::generateSignedCardId("123"); + $this->assertTrue(is_string($signed_card_id)); } public function testLimitLength(): void From d421f862fbccc17837dc3d650d78d8ea98da0909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubom=C3=ADr=20Samotn=C3=BD?= Date: Mon, 12 May 2025 10:54:34 +0200 Subject: [PATCH 16/16] triv: update github workflows --- .github/workflows/php.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 24d5dc4..2a14a50 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,9 +2,9 @@ name: PHP Composer on: push: - branches: [ "main", "dev_tests" ] + branches: [ "main" ] pull_request: - branches: [ "main", "dev_tests" ] + branches: [ "main" ] permissions: contents: read