From 94e006e7b7c706f259d9a89f0b2fc44354c051a2 Mon Sep 17 00:00:00 2001 From: iamgergo Date: Sun, 3 Aug 2025 19:09:29 +0000 Subject: [PATCH] Upgrade client --- .openapi-generator/FILES | 18 + src/Api/TransactionApi.php | 596 +++++++++ src/Model/Finish200Response.php | 32 +- src/Model/Item.php | 9 + src/Model/Query.php | 510 ++++++++ src/Model/Query200Response.php | 507 ++++++++ .../Query200ResponseTransactionsInner.php | 1153 +++++++++++++++++ ...200ResponseTransactionsInnerItemsInner.php | 618 +++++++++ ...0ResponseTransactionsInnerRefundsInner.php | 507 ++++++++ src/Model/Refund.php | 491 +++++++ src/Model/Refund200Response.php | 643 +++++++++ src/Model/RefundStatus.php | 42 + src/Model/Status.php | 56 + tests/Api/TransactionApiTest.php | 24 + tests/Model/Finish200ResponseTest.php | 4 +- tests/Model/Query200ResponseTest.php | 114 ++ ...esponseTransactionsInnerItemsInnerTest.php | 141 ++ ...ponseTransactionsInnerRefundsInnerTest.php | 114 ++ .../Query200ResponseTransactionsInnerTest.php | 285 ++++ tests/Model/QueryTest.php | 114 ++ tests/Model/Refund200ResponseTest.php | 150 +++ tests/Model/RefundStatusTest.php | 78 ++ tests/Model/RefundTest.php | 105 ++ tests/Model/StatusTest.php | 78 ++ 24 files changed, 6371 insertions(+), 18 deletions(-) create mode 100644 src/Model/Query.php create mode 100644 src/Model/Query200Response.php create mode 100644 src/Model/Query200ResponseTransactionsInner.php create mode 100644 src/Model/Query200ResponseTransactionsInnerItemsInner.php create mode 100644 src/Model/Query200ResponseTransactionsInnerRefundsInner.php create mode 100644 src/Model/Refund.php create mode 100644 src/Model/Refund200Response.php create mode 100644 src/Model/RefundStatus.php create mode 100644 src/Model/Status.php create mode 100644 tests/Model/Query200ResponseTest.php create mode 100644 tests/Model/Query200ResponseTransactionsInnerItemsInnerTest.php create mode 100644 tests/Model/Query200ResponseTransactionsInnerRefundsInnerTest.php create mode 100644 tests/Model/Query200ResponseTransactionsInnerTest.php create mode 100644 tests/Model/QueryTest.php create mode 100644 tests/Model/Refund200ResponseTest.php create mode 100644 tests/Model/RefundStatusTest.php create mode 100644 tests/Model/RefundTest.php create mode 100644 tests/Model/StatusTest.php diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index bda4d03..ce6243a 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -13,7 +13,16 @@ src/Model/Item.php src/Model/Language.php src/Model/Method.php src/Model/ModelInterface.php +src/Model/Query.php +src/Model/Query200Response.php +src/Model/Query200ResponseTransactionsInner.php +src/Model/Query200ResponseTransactionsInnerItemsInner.php +src/Model/Query200ResponseTransactionsInnerRefundsInner.php +src/Model/Refund.php +src/Model/Refund200Response.php +src/Model/RefundStatus.php src/Model/Start200Response.php +src/Model/Status.php src/Model/Transaction.php src/Model/TransactionUrls.php src/ObjectSerializer.php @@ -26,6 +35,15 @@ tests/Model/InvoiceTest.php tests/Model/ItemTest.php tests/Model/LanguageTest.php tests/Model/MethodTest.php +tests/Model/Query200ResponseTest.php +tests/Model/Query200ResponseTransactionsInnerItemsInnerTest.php +tests/Model/Query200ResponseTransactionsInnerRefundsInnerTest.php +tests/Model/Query200ResponseTransactionsInnerTest.php +tests/Model/QueryTest.php +tests/Model/Refund200ResponseTest.php +tests/Model/RefundStatusTest.php +tests/Model/RefundTest.php tests/Model/Start200ResponseTest.php +tests/Model/StatusTest.php tests/Model/TransactionTest.php tests/Model/TransactionUrlsTest.php diff --git a/src/Api/TransactionApi.php b/src/Api/TransactionApi.php index cfc2702..2ccc6d1 100644 --- a/src/Api/TransactionApi.php +++ b/src/Api/TransactionApi.php @@ -77,6 +77,12 @@ class TransactionApi 'finish' => [ 'application/json', ], + 'query' => [ + 'application/json', + ], + 'refund' => [ + 'application/json', + ], 'start' => [ 'application/json', ], @@ -423,6 +429,596 @@ public function finishRequest( ); } + /** + * Operation query + * + * Query a set transactions + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Query $query The query parameters. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['query'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Cone\SimplePay\Model\Query200Response + */ + public function query( + string $signature, + \Cone\SimplePay\Model\Query $query, + string $contentType = self::contentTypes['query'][0] + ): \Cone\SimplePay\Model\Query200Response { + list($response) = $this->queryWithHttpInfo($signature, $query, $contentType); + return $response; + } + + /** + * Operation queryWithHttpInfo + * + * Query a set transactions + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Query $query The query parameters. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['query'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Cone\SimplePay\Model\Query200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function queryWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\Query $query, + string $contentType = self::contentTypes['query'][0] + ): array { + $request = $this->queryRequest($signature, $query, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } 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 + ); + } + + $statusCode = $response->getStatusCode(); + + switch ($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Cone\SimplePay\Model\Query200Response', + $request, + $response, + ); + } + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Cone\SimplePay\Model\Query200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Query200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation queryAsync + * + * Query a set transactions + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Query $query The query parameters. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['query'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function queryAsync( + string $signature, + \Cone\SimplePay\Model\Query $query, + string $contentType = self::contentTypes['query'][0] + ): PromiseInterface { + return $this->queryAsyncWithHttpInfo($signature, $query, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation queryAsyncWithHttpInfo + * + * Query a set transactions + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Query $query The query parameters. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['query'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function queryAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\Query $query, + string $contentType = self::contentTypes['query'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Query200Response'; + $request = $this->queryRequest($signature, $query, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'], true)) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders(), + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'query' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Query $query The query parameters. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['query'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function queryRequest( + string $signature, + \Cone\SimplePay\Model\Query $query, + string $contentType = self::contentTypes['query'][0] + ): Request { + + // verify the required parameter 'signature' is set + if ($signature === null || (is_array($signature) && count($signature) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $signature when calling query' + ); + } + + // verify the required parameter 'query' is set + if ($query === null || (is_array($query) && count($query) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $query when calling query' + ); + } + + + $resourcePath = '/query'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($signature !== null) { + $headerParams['Signature'] = ObjectSerializer::toHeaderValue($signature); + } + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($query)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($query)); + } else { + $httpBody = $query; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem, + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation refund + * + * Refund a transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Refund $refund The refund object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refund'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Cone\SimplePay\Model\Refund200Response + */ + public function refund( + string $signature, + \Cone\SimplePay\Model\Refund $refund, + string $contentType = self::contentTypes['refund'][0] + ): \Cone\SimplePay\Model\Refund200Response { + list($response) = $this->refundWithHttpInfo($signature, $refund, $contentType); + return $response; + } + + /** + * Operation refundWithHttpInfo + * + * Refund a transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Refund $refund The refund object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refund'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \Cone\SimplePay\Model\Refund200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function refundWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\Refund $refund, + string $contentType = self::contentTypes['refund'][0] + ): array { + $request = $this->refundRequest($signature, $refund, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } 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 + ); + } + + $statusCode = $response->getStatusCode(); + + switch ($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Cone\SimplePay\Model\Refund200Response', + $request, + $response, + ); + } + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Cone\SimplePay\Model\Refund200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Refund200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation refundAsync + * + * Refund a transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Refund $refund The refund object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refund'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function refundAsync( + string $signature, + \Cone\SimplePay\Model\Refund $refund, + string $contentType = self::contentTypes['refund'][0] + ): PromiseInterface { + return $this->refundAsyncWithHttpInfo($signature, $refund, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation refundAsyncWithHttpInfo + * + * Refund a transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Refund $refund The refund object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refund'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function refundAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\Refund $refund, + string $contentType = self::contentTypes['refund'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Refund200Response'; + $request = $this->refundRequest($signature, $refund, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'], true)) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders(), + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'refund' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\Refund $refund The refund object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['refund'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function refundRequest( + string $signature, + \Cone\SimplePay\Model\Refund $refund, + string $contentType = self::contentTypes['refund'][0] + ): Request { + + // verify the required parameter 'signature' is set + if ($signature === null || (is_array($signature) && count($signature) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $signature when calling refund' + ); + } + + // verify the required parameter 'refund' is set + if ($refund === null || (is_array($refund) && count($refund) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $refund when calling refund' + ); + } + + + $resourcePath = '/refund'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($signature !== null) { + $headerParams['Signature'] = ObjectSerializer::toHeaderValue($signature); + } + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($refund)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($refund)); + } else { + $httpBody = $refund; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem, + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation start * diff --git a/src/Model/Finish200Response.php b/src/Model/Finish200Response.php index 296ea75..6f612cd 100644 --- a/src/Model/Finish200Response.php +++ b/src/Model/Finish200Response.php @@ -63,7 +63,7 @@ class Finish200Response implements ModelInterface, ArrayAccess, JsonSerializable 'orderRef' => 'string', 'currency' => '\Cone\SimplePay\Model\Currency', 'transactionId' => 'float', - 'total' => 'float', + 'approveTotal' => 'float', ]; /** @@ -77,7 +77,7 @@ class Finish200Response implements ModelInterface, ArrayAccess, JsonSerializable 'orderRef' => null, 'currency' => null, 'transactionId' => null, - 'total' => null, + 'approveTotal' => null, ]; /** @@ -91,7 +91,7 @@ class Finish200Response implements ModelInterface, ArrayAccess, JsonSerializable 'orderRef' => false, 'currency' => false, 'transactionId' => false, - 'total' => false, + 'approveTotal' => false, ]; /** @@ -185,7 +185,7 @@ public function isNullableSetToNull(string $property): bool 'orderRef' => 'orderRef', 'currency' => 'currency', 'transactionId' => 'transactionId', - 'total' => 'total', + 'approveTotal' => 'approveTotal', ]; /** @@ -199,7 +199,7 @@ public function isNullableSetToNull(string $property): bool 'orderRef' => 'setOrderRef', 'currency' => 'setCurrency', 'transactionId' => 'setTransactionId', - 'total' => 'setTotal', + 'approveTotal' => 'setApproveTotal', ]; /** @@ -213,7 +213,7 @@ public function isNullableSetToNull(string $property): bool 'orderRef' => 'getOrderRef', 'currency' => 'getCurrency', 'transactionId' => 'getTransactionId', - 'total' => 'getTotal', + 'approveTotal' => 'getApproveTotal', ]; /** @@ -277,7 +277,7 @@ public function __construct(?array $data = null) $this->setIfExists('orderRef', $data ?? [], null); $this->setIfExists('currency', $data ?? [], null); $this->setIfExists('transactionId', $data ?? [], null); - $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('approveTotal', $data ?? [], null); } /** @@ -458,28 +458,28 @@ public function setTransactionId(?float $transactionId): static } /** - * Gets total + * Gets approveTotal * * @return float|null */ - public function getTotal(): ?float + public function getApproveTotal(): ?float { - return $this->container['total']; + return $this->container['approveTotal']; } /** - * Sets total + * Sets approveTotal * - * @param float|null $total total + * @param float|null $approveTotal approveTotal * * @return $this */ - public function setTotal(?float $total): static + public function setApproveTotal(?float $approveTotal): static { - if (is_null($total)) { - throw new InvalidArgumentException('non-nullable total cannot be null'); + if (is_null($approveTotal)) { + throw new InvalidArgumentException('non-nullable approveTotal cannot be null'); } - $this->container['total'] = $total; + $this->container['approveTotal'] = $approveTotal; return $this; } diff --git a/src/Model/Item.php b/src/Model/Item.php index cea5e7c..b7b5c0e 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -327,6 +327,10 @@ public function listInvalidProperties(): array $invalidProperties[] = "invalid value for 'price', must be bigger than 0."; } + if (!is_null($this->container['tax']) && ($this->container['tax'] < 0)) { + $invalidProperties[] = "invalid value for 'tax', must be bigger than or equal to 0."; + } + return $invalidProperties; } @@ -516,6 +520,11 @@ public function setTax(?float $tax): static if (is_null($tax)) { throw new InvalidArgumentException('non-nullable tax cannot be null'); } + + if (($tax < 0)) { + throw new InvalidArgumentException('invalid value for $tax when calling Item., must be bigger than or equal to 0.'); + } + $this->container['tax'] = $tax; return $this; diff --git a/src/Model/Query.php b/src/Model/Query.php new file mode 100644 index 0000000..1c35737 --- /dev/null +++ b/src/Model/Query.php @@ -0,0 +1,510 @@ + + */ +class Query implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Query'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'transactionIds' => 'float[]', + 'orderRefs' => 'string[]', + 'detailed' => 'bool', + 'refunds' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'transactionIds' => null, + 'orderRefs' => null, + 'detailed' => null, + 'refunds' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'transactionIds' => false, + 'orderRefs' => false, + 'detailed' => false, + 'refunds' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'transactionIds' => 'transactionIds', + 'orderRefs' => 'orderRefs', + 'detailed' => 'detailed', + 'refunds' => 'refunds', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'transactionIds' => 'setTransactionIds', + 'orderRefs' => 'setOrderRefs', + 'detailed' => 'setDetailed', + 'refunds' => 'setRefunds', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'transactionIds' => 'getTransactionIds', + 'orderRefs' => 'getOrderRefs', + 'detailed' => 'getDetailed', + 'refunds' => 'getRefunds', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transactionIds', $data ?? [], null); + $this->setIfExists('orderRefs', $data ?? [], null); + $this->setIfExists('detailed', $data ?? [], false); + $this->setIfExists('refunds', $data ?? [], false); + } + + /** + * 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, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['transactionIds'] === null) { + $invalidProperties[] = "'transactionIds' 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transactionIds + * + * @return float[] + */ + public function getTransactionIds(): array + { + return $this->container['transactionIds']; + } + + /** + * Sets transactionIds + * + * @param float[] $transactionIds transactionIds + * + * @return $this + */ + public function setTransactionIds(array $transactionIds): static + { + if (is_null($transactionIds)) { + throw new InvalidArgumentException('non-nullable transactionIds cannot be null'); + } + $this->container['transactionIds'] = $transactionIds; + + return $this; + } + + /** + * Gets orderRefs + * + * @return string[]|null + */ + public function getOrderRefs(): ?array + { + return $this->container['orderRefs']; + } + + /** + * Sets orderRefs + * + * @param string[]|null $orderRefs orderRefs + * + * @return $this + */ + public function setOrderRefs(?array $orderRefs): static + { + if (is_null($orderRefs)) { + throw new InvalidArgumentException('non-nullable orderRefs cannot be null'); + } + $this->container['orderRefs'] = $orderRefs; + + return $this; + } + + /** + * Gets detailed + * + * @return bool|null + */ + public function getDetailed(): ?bool + { + return $this->container['detailed']; + } + + /** + * Sets detailed + * + * @param bool|null $detailed detailed + * + * @return $this + */ + public function setDetailed(?bool $detailed): static + { + if (is_null($detailed)) { + throw new InvalidArgumentException('non-nullable detailed cannot be null'); + } + $this->container['detailed'] = $detailed; + + return $this; + } + + /** + * Gets refunds + * + * @return bool|null + */ + public function getRefunds(): ?bool + { + return $this->container['refunds']; + } + + /** + * Sets refunds + * + * @param bool|null $refunds refunds + * + * @return $this + */ + public function setRefunds(?bool $refunds): static + { + if (is_null($refunds)) { + throw new InvalidArgumentException('non-nullable refunds cannot be null'); + } + $this->container['refunds'] = $refunds; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/Query200Response.php b/src/Model/Query200Response.php new file mode 100644 index 0000000..a8df45e --- /dev/null +++ b/src/Model/Query200Response.php @@ -0,0 +1,507 @@ + + */ +class Query200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'query_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'transactions' => '\Cone\SimplePay\Model\Query200ResponseTransactionsInner[]', + 'totalCount' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'transactions' => null, + 'totalCount' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'transactions' => false, + 'totalCount' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'salt' => 'salt', + 'merchant' => 'merchant', + 'transactions' => 'transactions', + 'totalCount' => 'totalCount', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'transactions' => 'setTransactions', + 'totalCount' => 'setTotalCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'transactions' => 'getTransactions', + 'totalCount' => 'getTotalCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('salt', $data ?? [], null); + $this->setIfExists('merchant', $data ?? [], null); + $this->setIfExists('transactions', $data ?? [], null); + $this->setIfExists('totalCount', $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, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets salt + * + * @return string|null + */ + public function getSalt(): ?string + { + return $this->container['salt']; + } + + /** + * Sets salt + * + * @param string|null $salt salt + * + * @return $this + */ + public function setSalt(?string $salt): static + { + if (is_null($salt)) { + throw new InvalidArgumentException('non-nullable salt cannot be null'); + } + $this->container['salt'] = $salt; + + return $this; + } + + /** + * Gets merchant + * + * @return string|null + */ + public function getMerchant(): ?string + { + return $this->container['merchant']; + } + + /** + * Sets merchant + * + * @param string|null $merchant merchant + * + * @return $this + */ + public function setMerchant(?string $merchant): static + { + if (is_null($merchant)) { + throw new InvalidArgumentException('non-nullable merchant cannot be null'); + } + $this->container['merchant'] = $merchant; + + return $this; + } + + /** + * Gets transactions + * + * @return \Cone\SimplePay\Model\Query200ResponseTransactionsInner[]|null + */ + public function getTransactions(): ?array + { + return $this->container['transactions']; + } + + /** + * Sets transactions + * + * @param \Cone\SimplePay\Model\Query200ResponseTransactionsInner[]|null $transactions transactions + * + * @return $this + */ + public function setTransactions(?array $transactions): static + { + if (is_null($transactions)) { + throw new InvalidArgumentException('non-nullable transactions cannot be null'); + } + $this->container['transactions'] = $transactions; + + return $this; + } + + /** + * Gets totalCount + * + * @return int|null + */ + public function getTotalCount(): ?int + { + return $this->container['totalCount']; + } + + /** + * Sets totalCount + * + * @param int|null $totalCount totalCount + * + * @return $this + */ + public function setTotalCount(?int $totalCount): static + { + if (is_null($totalCount)) { + throw new InvalidArgumentException('non-nullable totalCount cannot be null'); + } + $this->container['totalCount'] = $totalCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/Query200ResponseTransactionsInner.php b/src/Model/Query200ResponseTransactionsInner.php new file mode 100644 index 0000000..b136b12 --- /dev/null +++ b/src/Model/Query200ResponseTransactionsInner.php @@ -0,0 +1,1153 @@ + + */ +class Query200ResponseTransactionsInner implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'query_200_response_transactions_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'orderRef' => 'string', + 'currecy' => '\Cone\SimplePay\Model\Currency', + 'currecyEnum' => '\Cone\SimplePay\Model\Currency', + 'customer' => 'string', + 'customerEmail' => 'string', + 'language' => '\Cone\SimplePay\Model\Language', + 'twoStep' => 'bool', + 'total' => 'float', + 'items' => '\Cone\SimplePay\Model\Query200ResponseTransactionsInnerItemsInner[]', + 'discount' => 'float', + 'shippingCost' => 'float', + 'invoice' => '\Cone\SimplePay\Model\Invoice', + 'delivery' => '\Cone\SimplePay\Model\Delivery', + 'transactionId' => 'float', + 'status' => '\Cone\SimplePay\Model\Status', + 'resultCode' => 'string', + 'refundStatus' => '\Cone\SimplePay\Model\RefundStatus', + 'refunds' => '\Cone\SimplePay\Model\Query200ResponseTransactionsInnerRefundsInner[]', + 'remainingTotal' => 'float', + 'paymentDate' => 'string', + 'method' => '\Cone\SimplePay\Model\Method', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'orderRef' => null, + 'currecy' => null, + 'currecyEnum' => null, + 'customer' => null, + 'customerEmail' => 'email', + 'language' => null, + 'twoStep' => null, + 'total' => null, + 'items' => null, + 'discount' => null, + 'shippingCost' => null, + 'invoice' => null, + 'delivery' => null, + 'transactionId' => null, + 'status' => null, + 'resultCode' => null, + 'refundStatus' => null, + 'refunds' => null, + 'remainingTotal' => null, + 'paymentDate' => null, + 'method' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'orderRef' => false, + 'currecy' => false, + 'currecyEnum' => false, + 'customer' => false, + 'customerEmail' => false, + 'language' => false, + 'twoStep' => false, + 'total' => false, + 'items' => false, + 'discount' => false, + 'shippingCost' => false, + 'invoice' => false, + 'delivery' => false, + 'transactionId' => false, + 'status' => false, + 'resultCode' => false, + 'refundStatus' => false, + 'refunds' => false, + 'remainingTotal' => false, + 'paymentDate' => false, + 'method' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'salt' => 'salt', + 'merchant' => 'merchant', + 'orderRef' => 'orderRef', + 'currecy' => 'currecy', + 'currecyEnum' => 'currecyEnum', + 'customer' => 'customer', + 'customerEmail' => 'customerEmail', + 'language' => 'language', + 'twoStep' => 'twoStep', + 'total' => 'total', + 'items' => 'items', + 'discount' => 'discount', + 'shippingCost' => 'shippingCost', + 'invoice' => 'invoice', + 'delivery' => 'delivery', + 'transactionId' => 'transactionId', + 'status' => 'status', + 'resultCode' => 'resultCode', + 'refundStatus' => 'refundStatus', + 'refunds' => 'refunds', + 'remainingTotal' => 'remainingTotal', + 'paymentDate' => 'paymentDate', + 'method' => 'method', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'orderRef' => 'setOrderRef', + 'currecy' => 'setCurrecy', + 'currecyEnum' => 'setCurrecyEnum', + 'customer' => 'setCustomer', + 'customerEmail' => 'setCustomerEmail', + 'language' => 'setLanguage', + 'twoStep' => 'setTwoStep', + 'total' => 'setTotal', + 'items' => 'setItems', + 'discount' => 'setDiscount', + 'shippingCost' => 'setShippingCost', + 'invoice' => 'setInvoice', + 'delivery' => 'setDelivery', + 'transactionId' => 'setTransactionId', + 'status' => 'setStatus', + 'resultCode' => 'setResultCode', + 'refundStatus' => 'setRefundStatus', + 'refunds' => 'setRefunds', + 'remainingTotal' => 'setRemainingTotal', + 'paymentDate' => 'setPaymentDate', + 'method' => 'setMethod', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'orderRef' => 'getOrderRef', + 'currecy' => 'getCurrecy', + 'currecyEnum' => 'getCurrecyEnum', + 'customer' => 'getCustomer', + 'customerEmail' => 'getCustomerEmail', + 'language' => 'getLanguage', + 'twoStep' => 'getTwoStep', + 'total' => 'getTotal', + 'items' => 'getItems', + 'discount' => 'getDiscount', + 'shippingCost' => 'getShippingCost', + 'invoice' => 'getInvoice', + 'delivery' => 'getDelivery', + 'transactionId' => 'getTransactionId', + 'status' => 'getStatus', + 'resultCode' => 'getResultCode', + 'refundStatus' => 'getRefundStatus', + 'refunds' => 'getRefunds', + 'remainingTotal' => 'getRemainingTotal', + 'paymentDate' => 'getPaymentDate', + 'method' => 'getMethod', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('salt', $data ?? [], null); + $this->setIfExists('merchant', $data ?? [], null); + $this->setIfExists('orderRef', $data ?? [], null); + $this->setIfExists('currecy', $data ?? [], null); + $this->setIfExists('currecyEnum', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customerEmail', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('twoStep', $data ?? [], false); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('shippingCost', $data ?? [], null); + $this->setIfExists('invoice', $data ?? [], null); + $this->setIfExists('delivery', $data ?? [], null); + $this->setIfExists('transactionId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('resultCode', $data ?? [], null); + $this->setIfExists('refundStatus', $data ?? [], null); + $this->setIfExists('refunds', $data ?? [], null); + $this->setIfExists('remainingTotal', $data ?? [], null); + $this->setIfExists('paymentDate', $data ?? [], null); + $this->setIfExists('method', $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, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets salt + * + * @return string|null + */ + public function getSalt(): ?string + { + return $this->container['salt']; + } + + /** + * Sets salt + * + * @param string|null $salt salt + * + * @return $this + */ + public function setSalt(?string $salt): static + { + if (is_null($salt)) { + throw new InvalidArgumentException('non-nullable salt cannot be null'); + } + $this->container['salt'] = $salt; + + return $this; + } + + /** + * Gets merchant + * + * @return string|null + */ + public function getMerchant(): ?string + { + return $this->container['merchant']; + } + + /** + * Sets merchant + * + * @param string|null $merchant merchant + * + * @return $this + */ + public function setMerchant(?string $merchant): static + { + if (is_null($merchant)) { + throw new InvalidArgumentException('non-nullable merchant cannot be null'); + } + $this->container['merchant'] = $merchant; + + return $this; + } + + /** + * Gets orderRef + * + * @return string|null + */ + public function getOrderRef(): ?string + { + return $this->container['orderRef']; + } + + /** + * Sets orderRef + * + * @param string|null $orderRef orderRef + * + * @return $this + */ + public function setOrderRef(?string $orderRef): static + { + if (is_null($orderRef)) { + throw new InvalidArgumentException('non-nullable orderRef cannot be null'); + } + $this->container['orderRef'] = $orderRef; + + return $this; + } + + /** + * Gets currecy + * + * @return \Cone\SimplePay\Model\Currency|null + */ + public function getCurrecy(): ?\Cone\SimplePay\Model\Currency + { + return $this->container['currecy']; + } + + /** + * Sets currecy + * + * @param \Cone\SimplePay\Model\Currency|null $currecy currecy + * + * @return $this + */ + public function setCurrecy(?\Cone\SimplePay\Model\Currency $currecy): static + { + if (is_null($currecy)) { + throw new InvalidArgumentException('non-nullable currecy cannot be null'); + } + $this->container['currecy'] = $currecy; + + return $this; + } + + /** + * Gets currecyEnum + * + * @return \Cone\SimplePay\Model\Currency|null + */ + public function getCurrecyEnum(): ?\Cone\SimplePay\Model\Currency + { + return $this->container['currecyEnum']; + } + + /** + * Sets currecyEnum + * + * @param \Cone\SimplePay\Model\Currency|null $currecyEnum currecyEnum + * + * @return $this + */ + public function setCurrecyEnum(?\Cone\SimplePay\Model\Currency $currecyEnum): static + { + if (is_null($currecyEnum)) { + throw new InvalidArgumentException('non-nullable currecyEnum cannot be null'); + } + $this->container['currecyEnum'] = $currecyEnum; + + return $this; + } + + /** + * Gets customer + * + * @return string|null + */ + public function getCustomer(): ?string + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param string|null $customer customer + * + * @return $this + */ + public function setCustomer(?string $customer): static + { + if (is_null($customer)) { + throw new InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customerEmail + * + * @return string|null + */ + public function getCustomerEmail(): ?string + { + return $this->container['customerEmail']; + } + + /** + * Sets customerEmail + * + * @param string|null $customerEmail customerEmail + * + * @return $this + */ + public function setCustomerEmail(?string $customerEmail): static + { + if (is_null($customerEmail)) { + throw new InvalidArgumentException('non-nullable customerEmail cannot be null'); + } + $this->container['customerEmail'] = $customerEmail; + + return $this; + } + + /** + * Gets language + * + * @return \Cone\SimplePay\Model\Language|null + */ + public function getLanguage(): ?\Cone\SimplePay\Model\Language + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Cone\SimplePay\Model\Language|null $language language + * + * @return $this + */ + public function setLanguage(?\Cone\SimplePay\Model\Language $language): static + { + if (is_null($language)) { + throw new InvalidArgumentException('non-nullable language cannot be null'); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets twoStep + * + * @return bool|null + */ + public function getTwoStep(): ?bool + { + return $this->container['twoStep']; + } + + /** + * Sets twoStep + * + * @param bool|null $twoStep twoStep + * + * @return $this + */ + public function setTwoStep(?bool $twoStep): static + { + if (is_null($twoStep)) { + throw new InvalidArgumentException('non-nullable twoStep cannot be null'); + } + $this->container['twoStep'] = $twoStep; + + return $this; + } + + /** + * Gets total + * + * @return float|null + */ + public function getTotal(): ?float + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param float|null $total total + * + * @return $this + */ + public function setTotal(?float $total): static + { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets items + * + * @return \Cone\SimplePay\Model\Query200ResponseTransactionsInnerItemsInner[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Cone\SimplePay\Model\Query200ResponseTransactionsInnerItemsInner[]|null $items items + * + * @return $this + */ + public function setItems(?array $items): static + { + if (is_null($items)) { + throw new InvalidArgumentException('non-nullable items cannot be null'); + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets discount + * + * @return float|null + */ + public function getDiscount(): ?float + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param float|null $discount discount + * + * @return $this + */ + public function setDiscount(?float $discount): static + { + if (is_null($discount)) { + throw new InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets shippingCost + * + * @return float|null + */ + public function getShippingCost(): ?float + { + return $this->container['shippingCost']; + } + + /** + * Sets shippingCost + * + * @param float|null $shippingCost shippingCost + * + * @return $this + */ + public function setShippingCost(?float $shippingCost): static + { + if (is_null($shippingCost)) { + throw new InvalidArgumentException('non-nullable shippingCost cannot be null'); + } + $this->container['shippingCost'] = $shippingCost; + + return $this; + } + + /** + * Gets invoice + * + * @return \Cone\SimplePay\Model\Invoice|null + */ + public function getInvoice(): ?\Cone\SimplePay\Model\Invoice + { + return $this->container['invoice']; + } + + /** + * Sets invoice + * + * @param \Cone\SimplePay\Model\Invoice|null $invoice invoice + * + * @return $this + */ + public function setInvoice(?\Cone\SimplePay\Model\Invoice $invoice): static + { + if (is_null($invoice)) { + throw new InvalidArgumentException('non-nullable invoice cannot be null'); + } + $this->container['invoice'] = $invoice; + + return $this; + } + + /** + * Gets delivery + * + * @return \Cone\SimplePay\Model\Delivery|null + */ + public function getDelivery(): ?\Cone\SimplePay\Model\Delivery + { + return $this->container['delivery']; + } + + /** + * Sets delivery + * + * @param \Cone\SimplePay\Model\Delivery|null $delivery delivery + * + * @return $this + */ + public function setDelivery(?\Cone\SimplePay\Model\Delivery $delivery): static + { + if (is_null($delivery)) { + throw new InvalidArgumentException('non-nullable delivery cannot be null'); + } + $this->container['delivery'] = $delivery; + + return $this; + } + + /** + * Gets transactionId + * + * @return float|null + */ + public function getTransactionId(): ?float + { + return $this->container['transactionId']; + } + + /** + * Sets transactionId + * + * @param float|null $transactionId transactionId + * + * @return $this + */ + public function setTransactionId(?float $transactionId): static + { + if (is_null($transactionId)) { + throw new InvalidArgumentException('non-nullable transactionId cannot be null'); + } + $this->container['transactionId'] = $transactionId; + + return $this; + } + + /** + * Gets status + * + * @return \Cone\SimplePay\Model\Status|null + */ + public function getStatus(): ?\Cone\SimplePay\Model\Status + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Cone\SimplePay\Model\Status|null $status status + * + * @return $this + */ + public function setStatus(?\Cone\SimplePay\Model\Status $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets resultCode + * + * @return string|null + */ + public function getResultCode(): ?string + { + return $this->container['resultCode']; + } + + /** + * Sets resultCode + * + * @param string|null $resultCode resultCode + * + * @return $this + */ + public function setResultCode(?string $resultCode): static + { + if (is_null($resultCode)) { + throw new InvalidArgumentException('non-nullable resultCode cannot be null'); + } + $this->container['resultCode'] = $resultCode; + + return $this; + } + + /** + * Gets refundStatus + * + * @return \Cone\SimplePay\Model\RefundStatus|null + */ + public function getRefundStatus(): ?\Cone\SimplePay\Model\RefundStatus + { + return $this->container['refundStatus']; + } + + /** + * Sets refundStatus + * + * @param \Cone\SimplePay\Model\RefundStatus|null $refundStatus refundStatus + * + * @return $this + */ + public function setRefundStatus(?\Cone\SimplePay\Model\RefundStatus $refundStatus): static + { + if (is_null($refundStatus)) { + throw new InvalidArgumentException('non-nullable refundStatus cannot be null'); + } + $this->container['refundStatus'] = $refundStatus; + + return $this; + } + + /** + * Gets refunds + * + * @return \Cone\SimplePay\Model\Query200ResponseTransactionsInnerRefundsInner[]|null + */ + public function getRefunds(): ?array + { + return $this->container['refunds']; + } + + /** + * Sets refunds + * + * @param \Cone\SimplePay\Model\Query200ResponseTransactionsInnerRefundsInner[]|null $refunds refunds + * + * @return $this + */ + public function setRefunds(?array $refunds): static + { + if (is_null($refunds)) { + throw new InvalidArgumentException('non-nullable refunds cannot be null'); + } + $this->container['refunds'] = $refunds; + + return $this; + } + + /** + * Gets remainingTotal + * + * @return float|null + */ + public function getRemainingTotal(): ?float + { + return $this->container['remainingTotal']; + } + + /** + * Sets remainingTotal + * + * @param float|null $remainingTotal remainingTotal + * + * @return $this + */ + public function setRemainingTotal(?float $remainingTotal): static + { + if (is_null($remainingTotal)) { + throw new InvalidArgumentException('non-nullable remainingTotal cannot be null'); + } + $this->container['remainingTotal'] = $remainingTotal; + + return $this; + } + + /** + * Gets paymentDate + * + * @return string|null + */ + public function getPaymentDate(): ?string + { + return $this->container['paymentDate']; + } + + /** + * Sets paymentDate + * + * @param string|null $paymentDate The ISO 8601 format of the payment date. + * + * @return $this + */ + public function setPaymentDate(?string $paymentDate): static + { + if (is_null($paymentDate)) { + throw new InvalidArgumentException('non-nullable paymentDate cannot be null'); + } + $this->container['paymentDate'] = $paymentDate; + + return $this; + } + + /** + * Gets method + * + * @return \Cone\SimplePay\Model\Method|null + */ + public function getMethod(): ?\Cone\SimplePay\Model\Method + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param \Cone\SimplePay\Model\Method|null $method method + * + * @return $this + */ + public function setMethod(?\Cone\SimplePay\Model\Method $method): static + { + if (is_null($method)) { + throw new InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/Query200ResponseTransactionsInnerItemsInner.php b/src/Model/Query200ResponseTransactionsInnerItemsInner.php new file mode 100644 index 0000000..6602d26 --- /dev/null +++ b/src/Model/Query200ResponseTransactionsInnerItemsInner.php @@ -0,0 +1,618 @@ + + */ +class Query200ResponseTransactionsInnerItemsInner implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'query_200_response_transactions_inner_items_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ref' => 'string', + 'title' => 'string', + 'amount' => 'int', + 'price' => 'float', + 'tax' => 'float', + 'grossUnitPrice' => 'float', + 'rowTotal' => 'float', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ref' => null, + 'title' => null, + 'amount' => null, + 'price' => null, + 'tax' => null, + 'grossUnitPrice' => null, + 'rowTotal' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ref' => false, + 'title' => false, + 'amount' => false, + 'price' => false, + 'tax' => false, + 'grossUnitPrice' => false, + 'rowTotal' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'ref' => 'ref', + 'title' => 'title', + 'amount' => 'amount', + 'price' => 'price', + 'tax' => 'tax', + 'grossUnitPrice' => 'grossUnitPrice', + 'rowTotal' => 'rowTotal', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ref' => 'setRef', + 'title' => 'setTitle', + 'amount' => 'setAmount', + 'price' => 'setPrice', + 'tax' => 'setTax', + 'grossUnitPrice' => 'setGrossUnitPrice', + 'rowTotal' => 'setRowTotal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ref' => 'getRef', + 'title' => 'getTitle', + 'amount' => 'getAmount', + 'price' => 'getPrice', + 'tax' => 'getTax', + 'grossUnitPrice' => 'getGrossUnitPrice', + 'rowTotal' => 'getRowTotal', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ref', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('tax', $data ?? [], null); + $this->setIfExists('grossUnitPrice', $data ?? [], null); + $this->setIfExists('rowTotal', $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, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['tax']) && ($this->container['tax'] < 0)) { + $invalidProperties[] = "invalid value for 'tax', 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ref + * + * @return string|null + */ + public function getRef(): ?string + { + return $this->container['ref']; + } + + /** + * Sets ref + * + * @param string|null $ref ref + * + * @return $this + */ + public function setRef(?string $ref): static + { + if (is_null($ref)) { + throw new InvalidArgumentException('non-nullable ref cannot be null'); + } + $this->container['ref'] = $ref; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title title + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount The quantity. + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice(): ?float + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price price + * + * @return $this + */ + public function setPrice(?float $price): static + { + if (is_null($price)) { + throw new InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets tax + * + * @return float|null + */ + public function getTax(): ?float + { + return $this->container['tax']; + } + + /** + * Sets tax + * + * @param float|null $tax tax + * + * @return $this + */ + public function setTax(?float $tax): static + { + if (is_null($tax)) { + throw new InvalidArgumentException('non-nullable tax cannot be null'); + } + + if (($tax < 0)) { + throw new InvalidArgumentException('invalid value for $tax when calling Query200ResponseTransactionsInnerItemsInner., must be bigger than or equal to 0.'); + } + + $this->container['tax'] = $tax; + + return $this; + } + + /** + * Gets grossUnitPrice + * + * @return float|null + */ + public function getGrossUnitPrice(): ?float + { + return $this->container['grossUnitPrice']; + } + + /** + * Sets grossUnitPrice + * + * @param float|null $grossUnitPrice grossUnitPrice + * + * @return $this + */ + public function setGrossUnitPrice(?float $grossUnitPrice): static + { + if (is_null($grossUnitPrice)) { + throw new InvalidArgumentException('non-nullable grossUnitPrice cannot be null'); + } + $this->container['grossUnitPrice'] = $grossUnitPrice; + + return $this; + } + + /** + * Gets rowTotal + * + * @return float|null + */ + public function getRowTotal(): ?float + { + return $this->container['rowTotal']; + } + + /** + * Sets rowTotal + * + * @param float|null $rowTotal rowTotal + * + * @return $this + */ + public function setRowTotal(?float $rowTotal): static + { + if (is_null($rowTotal)) { + throw new InvalidArgumentException('non-nullable rowTotal cannot be null'); + } + $this->container['rowTotal'] = $rowTotal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/Query200ResponseTransactionsInnerRefundsInner.php b/src/Model/Query200ResponseTransactionsInnerRefundsInner.php new file mode 100644 index 0000000..7f34c55 --- /dev/null +++ b/src/Model/Query200ResponseTransactionsInnerRefundsInner.php @@ -0,0 +1,507 @@ + + */ +class Query200ResponseTransactionsInnerRefundsInner implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'query_200_response_transactions_inner_refunds_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'transactionId' => 'float', + 'refundTotal' => 'float', + 'refundDate' => 'string', + 'status' => '\Cone\SimplePay\Model\Status', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'transactionId' => null, + 'refundTotal' => null, + 'refundDate' => null, + 'status' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'transactionId' => false, + 'refundTotal' => false, + 'refundDate' => false, + 'status' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'transactionId' => 'transactionId', + 'refundTotal' => 'refundTotal', + 'refundDate' => 'refundDate', + 'status' => 'status', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'transactionId' => 'setTransactionId', + 'refundTotal' => 'setRefundTotal', + 'refundDate' => 'setRefundDate', + 'status' => 'setStatus', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'transactionId' => 'getTransactionId', + 'refundTotal' => 'getRefundTotal', + 'refundDate' => 'getRefundDate', + 'status' => 'getStatus', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transactionId', $data ?? [], null); + $this->setIfExists('refundTotal', $data ?? [], null); + $this->setIfExists('refundDate', $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, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transactionId + * + * @return float|null + */ + public function getTransactionId(): ?float + { + return $this->container['transactionId']; + } + + /** + * Sets transactionId + * + * @param float|null $transactionId transactionId + * + * @return $this + */ + public function setTransactionId(?float $transactionId): static + { + if (is_null($transactionId)) { + throw new InvalidArgumentException('non-nullable transactionId cannot be null'); + } + $this->container['transactionId'] = $transactionId; + + return $this; + } + + /** + * Gets refundTotal + * + * @return float|null + */ + public function getRefundTotal(): ?float + { + return $this->container['refundTotal']; + } + + /** + * Sets refundTotal + * + * @param float|null $refundTotal refundTotal + * + * @return $this + */ + public function setRefundTotal(?float $refundTotal): static + { + if (is_null($refundTotal)) { + throw new InvalidArgumentException('non-nullable refundTotal cannot be null'); + } + $this->container['refundTotal'] = $refundTotal; + + return $this; + } + + /** + * Gets refundDate + * + * @return string|null + */ + public function getRefundDate(): ?string + { + return $this->container['refundDate']; + } + + /** + * Sets refundDate + * + * @param string|null $refundDate The ISO 8601 format of the refund date. + * + * @return $this + */ + public function setRefundDate(?string $refundDate): static + { + if (is_null($refundDate)) { + throw new InvalidArgumentException('non-nullable refundDate cannot be null'); + } + $this->container['refundDate'] = $refundDate; + + return $this; + } + + /** + * Gets status + * + * @return \Cone\SimplePay\Model\Status|null + */ + public function getStatus(): ?\Cone\SimplePay\Model\Status + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Cone\SimplePay\Model\Status|null $status status + * + * @return $this + */ + public function setStatus(?\Cone\SimplePay\Model\Status $status): static + { + if (is_null($status)) { + 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 + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/Refund.php b/src/Model/Refund.php new file mode 100644 index 0000000..b053697 --- /dev/null +++ b/src/Model/Refund.php @@ -0,0 +1,491 @@ + + */ +class Refund implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Refund'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'refundTotal' => 'float', + 'currency' => '\Cone\SimplePay\Model\Currency', + 'orderRef' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'refundTotal' => null, + 'currency' => null, + 'orderRef' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'refundTotal' => false, + 'currency' => false, + 'orderRef' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'refundTotal' => 'refundTotal', + 'currency' => 'currency', + 'orderRef' => 'orderRef', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'refundTotal' => 'setRefundTotal', + 'currency' => 'setCurrency', + 'orderRef' => 'setOrderRef', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'refundTotal' => 'getRefundTotal', + 'currency' => 'getCurrency', + 'orderRef' => 'getOrderRef', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('refundTotal', $data ?? [], 0); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('orderRef', $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, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['refundTotal'] === null) { + $invalidProperties[] = "'refundTotal' can't be null"; + } + if (($this->container['refundTotal'] <= 0)) { + $invalidProperties[] = "invalid value for 'refundTotal', must be bigger than 0."; + } + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['orderRef'] === null) { + $invalidProperties[] = "'orderRef' 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets refundTotal + * + * @return float + */ + public function getRefundTotal(): float + { + return $this->container['refundTotal']; + } + + /** + * Sets refundTotal + * + * @param float $refundTotal refundTotal + * + * @return $this + */ + public function setRefundTotal(float $refundTotal): static + { + if (is_null($refundTotal)) { + throw new InvalidArgumentException('non-nullable refundTotal cannot be null'); + } + + if (($refundTotal <= 0)) { + throw new InvalidArgumentException('invalid value for $refundTotal when calling Refund., must be bigger than 0.'); + } + + $this->container['refundTotal'] = $refundTotal; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\SimplePay\Model\Currency + */ + public function getCurrency(): \Cone\SimplePay\Model\Currency + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\SimplePay\Model\Currency $currency currency + * + * @return $this + */ + public function setCurrency(\Cone\SimplePay\Model\Currency $currency): static + { + if (is_null($currency)) { + throw new InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets orderRef + * + * @return string + */ + public function getOrderRef(): string + { + return $this->container['orderRef']; + } + + /** + * Sets orderRef + * + * @param string $orderRef orderRef + * + * @return $this + */ + public function setOrderRef(string $orderRef): static + { + if (is_null($orderRef)) { + throw new InvalidArgumentException('non-nullable orderRef cannot be null'); + } + $this->container['orderRef'] = $orderRef; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/Refund200Response.php b/src/Model/Refund200Response.php new file mode 100644 index 0000000..f063d48 --- /dev/null +++ b/src/Model/Refund200Response.php @@ -0,0 +1,643 @@ + + */ +class Refund200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'refund_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'orderRef' => 'string', + 'currency' => '\Cone\SimplePay\Model\Currency', + 'transactionId' => 'float', + 'refundTransactionId' => 'float', + 'refundTotal' => 'float', + 'remainingTotal' => 'float', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'orderRef' => null, + 'currency' => null, + 'transactionId' => null, + 'refundTransactionId' => null, + 'refundTotal' => null, + 'remainingTotal' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'orderRef' => false, + 'currency' => false, + 'transactionId' => false, + 'refundTransactionId' => false, + 'refundTotal' => false, + 'remainingTotal' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'salt' => 'salt', + 'merchant' => 'merchant', + 'orderRef' => 'orderRef', + 'currency' => 'currency', + 'transactionId' => 'transactionId', + 'refundTransactionId' => 'refundTransactionId', + 'refundTotal' => 'refundTotal', + 'remainingTotal' => 'remainingTotal', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'orderRef' => 'setOrderRef', + 'currency' => 'setCurrency', + 'transactionId' => 'setTransactionId', + 'refundTransactionId' => 'setRefundTransactionId', + 'refundTotal' => 'setRefundTotal', + 'remainingTotal' => 'setRemainingTotal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'orderRef' => 'getOrderRef', + 'currency' => 'getCurrency', + 'transactionId' => 'getTransactionId', + 'refundTransactionId' => 'getRefundTransactionId', + 'refundTotal' => 'getRefundTotal', + 'remainingTotal' => 'getRemainingTotal', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('salt', $data ?? [], null); + $this->setIfExists('merchant', $data ?? [], null); + $this->setIfExists('orderRef', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('transactionId', $data ?? [], null); + $this->setIfExists('refundTransactionId', $data ?? [], null); + $this->setIfExists('refundTotal', $data ?? [], null); + $this->setIfExists('remainingTotal', $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, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets salt + * + * @return string|null + */ + public function getSalt(): ?string + { + return $this->container['salt']; + } + + /** + * Sets salt + * + * @param string|null $salt salt + * + * @return $this + */ + public function setSalt(?string $salt): static + { + if (is_null($salt)) { + throw new InvalidArgumentException('non-nullable salt cannot be null'); + } + $this->container['salt'] = $salt; + + return $this; + } + + /** + * Gets merchant + * + * @return string|null + */ + public function getMerchant(): ?string + { + return $this->container['merchant']; + } + + /** + * Sets merchant + * + * @param string|null $merchant merchant + * + * @return $this + */ + public function setMerchant(?string $merchant): static + { + if (is_null($merchant)) { + throw new InvalidArgumentException('non-nullable merchant cannot be null'); + } + $this->container['merchant'] = $merchant; + + return $this; + } + + /** + * Gets orderRef + * + * @return string|null + */ + public function getOrderRef(): ?string + { + return $this->container['orderRef']; + } + + /** + * Sets orderRef + * + * @param string|null $orderRef orderRef + * + * @return $this + */ + public function setOrderRef(?string $orderRef): static + { + if (is_null($orderRef)) { + throw new InvalidArgumentException('non-nullable orderRef cannot be null'); + } + $this->container['orderRef'] = $orderRef; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\SimplePay\Model\Currency|null + */ + public function getCurrency(): ?\Cone\SimplePay\Model\Currency + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\SimplePay\Model\Currency|null $currency currency + * + * @return $this + */ + public function setCurrency(?\Cone\SimplePay\Model\Currency $currency): static + { + if (is_null($currency)) { + throw new InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets transactionId + * + * @return float|null + */ + public function getTransactionId(): ?float + { + return $this->container['transactionId']; + } + + /** + * Sets transactionId + * + * @param float|null $transactionId transactionId + * + * @return $this + */ + public function setTransactionId(?float $transactionId): static + { + if (is_null($transactionId)) { + throw new InvalidArgumentException('non-nullable transactionId cannot be null'); + } + $this->container['transactionId'] = $transactionId; + + return $this; + } + + /** + * Gets refundTransactionId + * + * @return float|null + */ + public function getRefundTransactionId(): ?float + { + return $this->container['refundTransactionId']; + } + + /** + * Sets refundTransactionId + * + * @param float|null $refundTransactionId refundTransactionId + * + * @return $this + */ + public function setRefundTransactionId(?float $refundTransactionId): static + { + if (is_null($refundTransactionId)) { + throw new InvalidArgumentException('non-nullable refundTransactionId cannot be null'); + } + $this->container['refundTransactionId'] = $refundTransactionId; + + return $this; + } + + /** + * Gets refundTotal + * + * @return float|null + */ + public function getRefundTotal(): ?float + { + return $this->container['refundTotal']; + } + + /** + * Sets refundTotal + * + * @param float|null $refundTotal refundTotal + * + * @return $this + */ + public function setRefundTotal(?float $refundTotal): static + { + if (is_null($refundTotal)) { + throw new InvalidArgumentException('non-nullable refundTotal cannot be null'); + } + $this->container['refundTotal'] = $refundTotal; + + return $this; + } + + /** + * Gets remainingTotal + * + * @return float|null + */ + public function getRemainingTotal(): ?float + { + return $this->container['remainingTotal']; + } + + /** + * Sets remainingTotal + * + * @param float|null $remainingTotal remainingTotal + * + * @return $this + */ + public function setRemainingTotal(?float $remainingTotal): static + { + if (is_null($remainingTotal)) { + throw new InvalidArgumentException('non-nullable remainingTotal cannot be null'); + } + $this->container['remainingTotal'] = $remainingTotal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/RefundStatus.php b/src/Model/RefundStatus.php new file mode 100644 index 0000000..6d3eccc --- /dev/null +++ b/src/Model/RefundStatus.php @@ -0,0 +1,42 @@ +