diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 363474c..0ef7b8a 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -4,6 +4,8 @@ src/ApiException.php src/Configuration.php src/FormDataProcessor.php src/HeaderSelector.php +src/Model/ApplePaySession.php +src/Model/ApplePayTransaction.php src/Model/AuthMethod.php src/Model/AuthorizedTransaction.php src/Model/CardCancel.php @@ -15,7 +17,9 @@ src/Model/Cardquery200ResponseHistoryInner.php src/Model/Currency.php src/Model/Delivery.php src/Model/Do200Response.php +src/Model/Doapplepay200Response.php src/Model/Dorecurring200Response.php +src/Model/EamTransaciton.php src/Model/Finish200Response.php src/Model/Invoice.php src/Model/Item.php @@ -33,6 +37,9 @@ src/Model/Refund.php src/Model/Refund200Response.php src/Model/RefundStatus.php src/Model/Start200Response.php +src/Model/Startapplepay200Response.php +src/Model/Startapplepay200ResponseApplePaySession.php +src/Model/Starteam200Response.php src/Model/TokenCancel.php src/Model/TokenQuery.php src/Model/TokenStatus.php @@ -47,6 +54,8 @@ src/Model/TransactionUrls.php src/Model/Transactioncancel200Response.php src/ObjectSerializer.php tests/Api/TransactionApiTest.php +tests/Model/ApplePaySessionTest.php +tests/Model/ApplePayTransactionTest.php tests/Model/AuthMethodTest.php tests/Model/AuthorizedTransactionTest.php tests/Model/CardCancelTest.php @@ -58,7 +67,9 @@ tests/Model/Cardquery200ResponseTest.php tests/Model/CurrencyTest.php tests/Model/DeliveryTest.php tests/Model/Do200ResponseTest.php +tests/Model/Doapplepay200ResponseTest.php tests/Model/Dorecurring200ResponseTest.php +tests/Model/EamTransacitonTest.php tests/Model/Finish200ResponseTest.php tests/Model/InvoiceTest.php tests/Model/ItemTest.php @@ -75,6 +86,9 @@ tests/Model/Refund200ResponseTest.php tests/Model/RefundStatusTest.php tests/Model/RefundTest.php tests/Model/Start200ResponseTest.php +tests/Model/Startapplepay200ResponseApplePaySessionTest.php +tests/Model/Startapplepay200ResponseTest.php +tests/Model/Starteam200ResponseTest.php tests/Model/TokenCancelTest.php tests/Model/TokenQueryTest.php tests/Model/TokenStatusTest.php diff --git a/src/Api/TransactionApi.php b/src/Api/TransactionApi.php index f773594..178dcf4 100644 --- a/src/Api/TransactionApi.php +++ b/src/Api/TransactionApi.php @@ -83,6 +83,9 @@ class TransactionApi 'cardquery' => [ 'application/json', ], + 'doapplepay' => [ + 'application/json', + ], 'dorecurring' => [ 'application/json', ], @@ -98,6 +101,12 @@ class TransactionApi 'start' => [ 'application/json', ], + 'startapplepay' => [ + 'application/json', + ], + 'starteam' => [ + 'application/json', + ], 'tokencancel' => [ 'application/json', ], @@ -1040,6 +1049,301 @@ public function cardqueryRequest( ); } + /** + * Operation doapplepay + * + * Start an ApplePay transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction The ApplePay transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doapplepay'] 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\Doapplepay200Response + */ + public function doapplepay( + string $signature, + \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction, + string $contentType = self::contentTypes['doapplepay'][0] + ): \Cone\SimplePay\Model\Doapplepay200Response { + list($response) = $this->doapplepayWithHttpInfo($signature, $applePayTransaction, $contentType); + return $response; + } + + /** + * Operation doapplepayWithHttpInfo + * + * Start an ApplePay transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction The ApplePay transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doapplepay'] 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\Doapplepay200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function doapplepayWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction, + string $contentType = self::contentTypes['doapplepay'][0] + ): array { + $request = $this->doapplepayRequest($signature, $applePayTransaction, $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\Doapplepay200Response', + $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\Doapplepay200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Doapplepay200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation doapplepayAsync + * + * Start an ApplePay transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction The ApplePay transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doapplepay'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function doapplepayAsync( + string $signature, + \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction, + string $contentType = self::contentTypes['doapplepay'][0] + ): PromiseInterface { + return $this->doapplepayAsyncWithHttpInfo($signature, $applePayTransaction, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation doapplepayAsyncWithHttpInfo + * + * Start an ApplePay transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction The ApplePay transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doapplepay'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function doapplepayAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction, + string $contentType = self::contentTypes['doapplepay'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Doapplepay200Response'; + $request = $this->doapplepayRequest($signature, $applePayTransaction, $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 'doapplepay' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction The ApplePay transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doapplepay'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function doapplepayRequest( + string $signature, + \Cone\SimplePay\Model\ApplePayTransaction $applePayTransaction, + string $contentType = self::contentTypes['doapplepay'][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 doapplepay' + ); + } + + // verify the required parameter 'applePayTransaction' is set + if ($applePayTransaction === null || (is_array($applePayTransaction) && count($applePayTransaction) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $applePayTransaction when calling doapplepay' + ); + } + + + $resourcePath = '/doapplepay'; + $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($applePayTransaction)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($applePayTransaction)); + } else { + $httpBody = $applePayTransaction; + } + } 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 dorecurring * @@ -2515,6 +2819,596 @@ public function startRequest( ); } + /** + * Operation startapplepay + * + * Start an ApplePay session + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePaySession $applePaySession The ApplePay session object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startapplepay'] 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\Startapplepay200Response + */ + public function startapplepay( + string $signature, + \Cone\SimplePay\Model\ApplePaySession $applePaySession, + string $contentType = self::contentTypes['startapplepay'][0] + ): \Cone\SimplePay\Model\Startapplepay200Response { + list($response) = $this->startapplepayWithHttpInfo($signature, $applePaySession, $contentType); + return $response; + } + + /** + * Operation startapplepayWithHttpInfo + * + * Start an ApplePay session + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePaySession $applePaySession The ApplePay session object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startapplepay'] 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\Startapplepay200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function startapplepayWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\ApplePaySession $applePaySession, + string $contentType = self::contentTypes['startapplepay'][0] + ): array { + $request = $this->startapplepayRequest($signature, $applePaySession, $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\Startapplepay200Response', + $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\Startapplepay200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Startapplepay200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation startapplepayAsync + * + * Start an ApplePay session + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePaySession $applePaySession The ApplePay session object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startapplepay'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function startapplepayAsync( + string $signature, + \Cone\SimplePay\Model\ApplePaySession $applePaySession, + string $contentType = self::contentTypes['startapplepay'][0] + ): PromiseInterface { + return $this->startapplepayAsyncWithHttpInfo($signature, $applePaySession, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation startapplepayAsyncWithHttpInfo + * + * Start an ApplePay session + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePaySession $applePaySession The ApplePay session object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startapplepay'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function startapplepayAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\ApplePaySession $applePaySession, + string $contentType = self::contentTypes['startapplepay'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Startapplepay200Response'; + $request = $this->startapplepayRequest($signature, $applePaySession, $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 'startapplepay' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\ApplePaySession $applePaySession The ApplePay session object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['startapplepay'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function startapplepayRequest( + string $signature, + \Cone\SimplePay\Model\ApplePaySession $applePaySession, + string $contentType = self::contentTypes['startapplepay'][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 startapplepay' + ); + } + + // verify the required parameter 'applePaySession' is set + if ($applePaySession === null || (is_array($applePaySession) && count($applePaySession) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $applePaySession when calling startapplepay' + ); + } + + + $resourcePath = '/startapplepay'; + $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($applePaySession)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($applePaySession)); + } else { + $httpBody = $applePaySession; + } + } 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 starteam + * + * Start an EAM transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\EamTransaciton $eamTransaciton The EAM transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['starteam'] 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\Starteam200Response + */ + public function starteam( + string $signature, + \Cone\SimplePay\Model\EamTransaciton $eamTransaciton, + string $contentType = self::contentTypes['starteam'][0] + ): \Cone\SimplePay\Model\Starteam200Response { + list($response) = $this->starteamWithHttpInfo($signature, $eamTransaciton, $contentType); + return $response; + } + + /** + * Operation starteamWithHttpInfo + * + * Start an EAM transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\EamTransaciton $eamTransaciton The EAM transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['starteam'] 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\Starteam200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function starteamWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\EamTransaciton $eamTransaciton, + string $contentType = self::contentTypes['starteam'][0] + ): array { + $request = $this->starteamRequest($signature, $eamTransaciton, $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\Starteam200Response', + $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\Starteam200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Starteam200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation starteamAsync + * + * Start an EAM transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\EamTransaciton $eamTransaciton The EAM transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['starteam'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function starteamAsync( + string $signature, + \Cone\SimplePay\Model\EamTransaciton $eamTransaciton, + string $contentType = self::contentTypes['starteam'][0] + ): PromiseInterface { + return $this->starteamAsyncWithHttpInfo($signature, $eamTransaciton, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation starteamAsyncWithHttpInfo + * + * Start an EAM transaction + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\EamTransaciton $eamTransaciton The EAM transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['starteam'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function starteamAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\EamTransaciton $eamTransaciton, + string $contentType = self::contentTypes['starteam'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Starteam200Response'; + $request = $this->starteamRequest($signature, $eamTransaciton, $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 'starteam' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\EamTransaciton $eamTransaciton The EAM transaction object you would like to start. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['starteam'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function starteamRequest( + string $signature, + \Cone\SimplePay\Model\EamTransaciton $eamTransaciton, + string $contentType = self::contentTypes['starteam'][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 starteam' + ); + } + + // verify the required parameter 'eamTransaciton' is set + if ($eamTransaciton === null || (is_array($eamTransaciton) && count($eamTransaciton) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $eamTransaciton when calling starteam' + ); + } + + + $resourcePath = '/starteam'; + $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($eamTransaciton)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($eamTransaciton)); + } else { + $httpBody = $eamTransaciton; + } + } 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 tokencancel * diff --git a/src/Model/ApplePaySession.php b/src/Model/ApplePaySession.php new file mode 100644 index 0000000..0bd5744 --- /dev/null +++ b/src/Model/ApplePaySession.php @@ -0,0 +1,1096 @@ + + */ +class ApplePaySession implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ApplePaySession'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'customer' => 'string', + 'customerEmail' => 'string', + 'currency' => '\Cone\SimplePay\Model\Currency', + 'maySelectInvoice' => 'bool', + 'maySelectEmail' => 'bool', + 'maySelectDelivery' => 'string[]', + 'twoStep' => 'bool', + 'onlyCardReg' => 'bool', + 'url' => 'string', + 'urls' => '\Cone\SimplePay\Model\TransactionUrls', + 'language' => '\Cone\SimplePay\Model\Language', + 'discount' => 'float', + 'shippingCost' => 'float', + 'total' => 'float', + 'delivery' => '\Cone\SimplePay\Model\Delivery', + 'invoice' => '\Cone\SimplePay\Model\Invoice', + 'items' => '\Cone\SimplePay\Model\Item[]', + 'methods' => '\Cone\SimplePay\Model\Method[]', + 'timeout' => 'string', + 'domain' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'customer' => null, + 'customerEmail' => 'email', + 'currency' => null, + 'maySelectInvoice' => null, + 'maySelectEmail' => null, + 'maySelectDelivery' => null, + 'twoStep' => null, + 'onlyCardReg' => null, + 'url' => null, + 'urls' => null, + 'language' => null, + 'discount' => null, + 'shippingCost' => null, + 'total' => null, + 'delivery' => null, + 'invoice' => null, + 'items' => null, + 'methods' => null, + 'timeout' => null, + 'domain' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'customer' => false, + 'customerEmail' => false, + 'currency' => false, + 'maySelectInvoice' => false, + 'maySelectEmail' => false, + 'maySelectDelivery' => false, + 'twoStep' => false, + 'onlyCardReg' => false, + 'url' => false, + 'urls' => false, + 'language' => false, + 'discount' => false, + 'shippingCost' => false, + 'total' => false, + 'delivery' => false, + 'invoice' => false, + 'items' => false, + 'methods' => false, + 'timeout' => false, + 'domain' => 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 = [ + 'customer' => 'customer', + 'customerEmail' => 'customerEmail', + 'currency' => 'currency', + 'maySelectInvoice' => 'maySelectInvoice', + 'maySelectEmail' => 'maySelectEmail', + 'maySelectDelivery' => 'maySelectDelivery', + 'twoStep' => 'twoStep', + 'onlyCardReg' => 'onlyCardReg', + 'url' => 'url', + 'urls' => 'urls', + 'language' => 'language', + 'discount' => 'discount', + 'shippingCost' => 'shippingCost', + 'total' => 'total', + 'delivery' => 'delivery', + 'invoice' => 'invoice', + 'items' => 'items', + 'methods' => 'methods', + 'timeout' => 'timeout', + 'domain' => 'domain', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'customer' => 'setCustomer', + 'customerEmail' => 'setCustomerEmail', + 'currency' => 'setCurrency', + 'maySelectInvoice' => 'setMaySelectInvoice', + 'maySelectEmail' => 'setMaySelectEmail', + 'maySelectDelivery' => 'setMaySelectDelivery', + 'twoStep' => 'setTwoStep', + 'onlyCardReg' => 'setOnlyCardReg', + 'url' => 'setUrl', + 'urls' => 'setUrls', + 'language' => 'setLanguage', + 'discount' => 'setDiscount', + 'shippingCost' => 'setShippingCost', + 'total' => 'setTotal', + 'delivery' => 'setDelivery', + 'invoice' => 'setInvoice', + 'items' => 'setItems', + 'methods' => 'setMethods', + 'timeout' => 'setTimeout', + 'domain' => 'setDomain', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'customer' => 'getCustomer', + 'customerEmail' => 'getCustomerEmail', + 'currency' => 'getCurrency', + 'maySelectInvoice' => 'getMaySelectInvoice', + 'maySelectEmail' => 'getMaySelectEmail', + 'maySelectDelivery' => 'getMaySelectDelivery', + 'twoStep' => 'getTwoStep', + 'onlyCardReg' => 'getOnlyCardReg', + 'url' => 'getUrl', + 'urls' => 'getUrls', + 'language' => 'getLanguage', + 'discount' => 'getDiscount', + 'shippingCost' => 'getShippingCost', + 'total' => 'getTotal', + 'delivery' => 'getDelivery', + 'invoice' => 'getInvoice', + 'items' => 'getItems', + 'methods' => 'getMethods', + 'timeout' => 'getTimeout', + 'domain' => 'getDomain', + ]; + + /** + * 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('customer', $data ?? [], null); + $this->setIfExists('customerEmail', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('maySelectInvoice', $data ?? [], false); + $this->setIfExists('maySelectEmail', $data ?? [], false); + $this->setIfExists('maySelectDelivery', $data ?? [], null); + $this->setIfExists('twoStep', $data ?? [], false); + $this->setIfExists('onlyCardReg', $data ?? [], false); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('urls', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], 0); + $this->setIfExists('shippingCost', $data ?? [], 0); + $this->setIfExists('total', $data ?? [], 0); + $this->setIfExists('delivery', $data ?? [], null); + $this->setIfExists('invoice', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('methods', $data ?? [], null); + $this->setIfExists('timeout', $data ?? [], null); + $this->setIfExists('domain', $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['customerEmail'] === null) { + $invalidProperties[] = "'customerEmail' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; + } + if (!is_null($this->container['discount']) && ($this->container['discount'] < 0)) { + $invalidProperties[] = "invalid value for 'discount', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['shippingCost']) && ($this->container['shippingCost'] < 0)) { + $invalidProperties[] = "invalid value for 'shippingCost', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['total']) && ($this->container['total'] <= 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than 0."; + } + + if ($this->container['methods'] === null) { + $invalidProperties[] = "'methods' can't be null"; + } + if ($this->container['timeout'] === null) { + $invalidProperties[] = "'timeout' can't be null"; + } + if ($this->container['domain'] === null) { + $invalidProperties[] = "'domain' 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 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 + */ + public function getCustomerEmail(): string + { + return $this->container['customerEmail']; + } + + /** + * Sets customerEmail + * + * @param string $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 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 maySelectInvoice + * + * @return bool|null + */ + public function getMaySelectInvoice(): ?bool + { + return $this->container['maySelectInvoice']; + } + + /** + * Sets maySelectInvoice + * + * @param bool|null $maySelectInvoice maySelectInvoice + * + * @return $this + */ + public function setMaySelectInvoice(?bool $maySelectInvoice): static + { + if (is_null($maySelectInvoice)) { + throw new InvalidArgumentException('non-nullable maySelectInvoice cannot be null'); + } + $this->container['maySelectInvoice'] = $maySelectInvoice; + + return $this; + } + + /** + * Gets maySelectEmail + * + * @return bool|null + */ + public function getMaySelectEmail(): ?bool + { + return $this->container['maySelectEmail']; + } + + /** + * Sets maySelectEmail + * + * @param bool|null $maySelectEmail maySelectEmail + * + * @return $this + */ + public function setMaySelectEmail(?bool $maySelectEmail): static + { + if (is_null($maySelectEmail)) { + throw new InvalidArgumentException('non-nullable maySelectEmail cannot be null'); + } + $this->container['maySelectEmail'] = $maySelectEmail; + + return $this; + } + + /** + * Gets maySelectDelivery + * + * @return string[]|null + */ + public function getMaySelectDelivery(): ?array + { + return $this->container['maySelectDelivery']; + } + + /** + * Sets maySelectDelivery + * + * @param string[]|null $maySelectDelivery maySelectDelivery + * + * @return $this + */ + public function setMaySelectDelivery(?array $maySelectDelivery): static + { + if (is_null($maySelectDelivery)) { + throw new InvalidArgumentException('non-nullable maySelectDelivery cannot be null'); + } + $this->container['maySelectDelivery'] = $maySelectDelivery; + + 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 onlyCardReg + * + * @return bool|null + */ + public function getOnlyCardReg(): ?bool + { + return $this->container['onlyCardReg']; + } + + /** + * Sets onlyCardReg + * + * @param bool|null $onlyCardReg onlyCardReg + * + * @return $this + */ + public function setOnlyCardReg(?bool $onlyCardReg): static + { + if (is_null($onlyCardReg)) { + throw new InvalidArgumentException('non-nullable onlyCardReg cannot be null'); + } + $this->container['onlyCardReg'] = $onlyCardReg; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets urls + * + * @return \Cone\SimplePay\Model\TransactionUrls|null + */ + public function getUrls(): ?\Cone\SimplePay\Model\TransactionUrls + { + return $this->container['urls']; + } + + /** + * Sets urls + * + * @param \Cone\SimplePay\Model\TransactionUrls|null $urls urls + * + * @return $this + */ + public function setUrls(?\Cone\SimplePay\Model\TransactionUrls $urls): static + { + if (is_null($urls)) { + throw new InvalidArgumentException('non-nullable urls cannot be null'); + } + $this->container['urls'] = $urls; + + return $this; + } + + /** + * Gets language + * + * @return \Cone\SimplePay\Model\Language + */ + public function getLanguage(): \Cone\SimplePay\Model\Language + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Cone\SimplePay\Model\Language $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 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'); + } + + if (($discount < 0)) { + throw new InvalidArgumentException('invalid value for $discount when calling ApplePaySession., must be bigger than or equal to 0.'); + } + + $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'); + } + + if (($shippingCost < 0)) { + throw new InvalidArgumentException('invalid value for $shippingCost when calling ApplePaySession., must be bigger than or equal to 0.'); + } + + $this->container['shippingCost'] = $shippingCost; + + 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'); + } + + if (($total <= 0)) { + throw new InvalidArgumentException('invalid value for $total when calling ApplePaySession., must be bigger than 0.'); + } + + $this->container['total'] = $total; + + 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 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 items + * + * @return \Cone\SimplePay\Model\Item[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Cone\SimplePay\Model\Item[]|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 methods + * + * @return \Cone\SimplePay\Model\Method[] + */ + public function getMethods(): array + { + return $this->container['methods']; + } + + /** + * Sets methods + * + * @param \Cone\SimplePay\Model\Method[] $methods Possible values: CARD, WIRE or EAM. + * + * @return $this + */ + public function setMethods(array $methods): static + { + if (is_null($methods)) { + throw new InvalidArgumentException('non-nullable methods cannot be null'); + } + $this->container['methods'] = $methods; + + return $this; + } + + /** + * Gets timeout + * + * @return string + */ + public function getTimeout(): string + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param string $timeout The ISO 8601 format of the timeout date. + * + * @return $this + */ + public function setTimeout(string $timeout): static + { + if (is_null($timeout)) { + throw new InvalidArgumentException('non-nullable timeout cannot be null'); + } + $this->container['timeout'] = $timeout; + + return $this; + } + + /** + * Gets domain + * + * @return string + */ + public function getDomain(): string + { + return $this->container['domain']; + } + + /** + * Sets domain + * + * @param string $domain The FQDN registered for ApplePay. + * + * @return $this + */ + public function setDomain(string $domain): static + { + if (is_null($domain)) { + throw new InvalidArgumentException('non-nullable domain cannot be null'); + } + $this->container['domain'] = $domain; + + 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/ApplePayTransaction.php b/src/Model/ApplePayTransaction.php new file mode 100644 index 0000000..fcb0bf9 --- /dev/null +++ b/src/Model/ApplePayTransaction.php @@ -0,0 +1,476 @@ + + */ +class ApplePayTransaction implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ApplePayTransaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'transactionId' => 'float', + 'currecy' => '\Cone\SimplePay\Model\Currency', + 'applePayToken' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'transactionId' => null, + 'currecy' => null, + 'applePayToken' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'transactionId' => false, + 'currecy' => false, + 'applePayToken' => 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', + 'currecy' => 'currecy', + 'applePayToken' => 'applePayToken', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'transactionId' => 'setTransactionId', + 'currecy' => 'setCurrecy', + 'applePayToken' => 'setApplePayToken', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'transactionId' => 'getTransactionId', + 'currecy' => 'getCurrecy', + 'applePayToken' => 'getApplePayToken', + ]; + + /** + * 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('currecy', $data ?? [], null); + $this->setIfExists('applePayToken', $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['applePayToken'] === null) { + $invalidProperties[] = "'applePayToken' 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 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 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 applePayToken + * + * @return string + */ + public function getApplePayToken(): string + { + return $this->container['applePayToken']; + } + + /** + * Sets applePayToken + * + * @param string $applePayToken The base64 encoded value of the applePaySession object in the startapplepay call response. + * + * @return $this + */ + public function setApplePayToken(string $applePayToken): static + { + if (is_null($applePayToken)) { + throw new InvalidArgumentException('non-nullable applePayToken cannot be null'); + } + $this->container['applePayToken'] = $applePayToken; + + 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/Doapplepay200Response.php b/src/Model/Doapplepay200Response.php new file mode 100644 index 0000000..7d6a5fa --- /dev/null +++ b/src/Model/Doapplepay200Response.php @@ -0,0 +1,609 @@ + + */ +class Doapplepay200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'doapplepay_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'orderRef' => 'string', + 'transactionId' => 'float', + 'currency' => '\Cone\SimplePay\Model\Currency', + 'total' => 'float', + 'applePayStatus' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'orderRef' => null, + 'transactionId' => null, + 'currency' => null, + 'total' => null, + 'applePayStatus' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'orderRef' => false, + 'transactionId' => false, + 'currency' => false, + 'total' => false, + 'applePayStatus' => 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', + 'transactionId' => 'transactionId', + 'currency' => 'currency', + 'total' => 'total', + 'applePayStatus' => 'applePayStatus', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'orderRef' => 'setOrderRef', + 'transactionId' => 'setTransactionId', + 'currency' => 'setCurrency', + 'total' => 'setTotal', + 'applePayStatus' => 'setApplePayStatus', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'orderRef' => 'getOrderRef', + 'transactionId' => 'getTransactionId', + 'currency' => 'getCurrency', + 'total' => 'getTotal', + 'applePayStatus' => 'getApplePayStatus', + ]; + + /** + * 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('transactionId', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('applePayStatus', $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 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 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 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 applePayStatus + * + * @return string|null + */ + public function getApplePayStatus(): ?string + { + return $this->container['applePayStatus']; + } + + /** + * Sets applePayStatus + * + * @param string|null $applePayStatus applePayStatus + * + * @return $this + */ + public function setApplePayStatus(?string $applePayStatus): static + { + if (is_null($applePayStatus)) { + throw new InvalidArgumentException('non-nullable applePayStatus cannot be null'); + } + $this->container['applePayStatus'] = $applePayStatus; + + 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/EamTransaciton.php b/src/Model/EamTransaciton.php new file mode 100644 index 0000000..b61afce --- /dev/null +++ b/src/Model/EamTransaciton.php @@ -0,0 +1,1140 @@ + + */ +class EamTransaciton implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'EamTransaciton'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'customer' => 'string', + 'customerEmail' => 'string', + 'currency' => '\Cone\SimplePay\Model\Currency', + 'maySelectInvoice' => 'bool', + 'maySelectEmail' => 'bool', + 'maySelectDelivery' => 'string[]', + 'twoStep' => 'bool', + 'onlyCardReg' => 'bool', + 'url' => 'string', + 'urls' => '\Cone\SimplePay\Model\TransactionUrls', + 'language' => '\Cone\SimplePay\Model\Language', + 'discount' => 'float', + 'shippingCost' => 'float', + 'total' => 'float', + 'delivery' => '\Cone\SimplePay\Model\Delivery', + 'invoice' => '\Cone\SimplePay\Model\Invoice', + 'items' => '\Cone\SimplePay\Model\Item[]', + 'methods' => '\Cone\SimplePay\Model\Method[]', + 'timeout' => 'string', + 'eamType' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'customer' => null, + 'customerEmail' => 'email', + 'currency' => null, + 'maySelectInvoice' => null, + 'maySelectEmail' => null, + 'maySelectDelivery' => null, + 'twoStep' => null, + 'onlyCardReg' => null, + 'url' => null, + 'urls' => null, + 'language' => null, + 'discount' => null, + 'shippingCost' => null, + 'total' => null, + 'delivery' => null, + 'invoice' => null, + 'items' => null, + 'methods' => null, + 'timeout' => null, + 'eamType' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'customer' => false, + 'customerEmail' => false, + 'currency' => false, + 'maySelectInvoice' => false, + 'maySelectEmail' => false, + 'maySelectDelivery' => false, + 'twoStep' => false, + 'onlyCardReg' => false, + 'url' => false, + 'urls' => false, + 'language' => false, + 'discount' => false, + 'shippingCost' => false, + 'total' => false, + 'delivery' => false, + 'invoice' => false, + 'items' => false, + 'methods' => false, + 'timeout' => false, + 'eamType' => 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 = [ + 'customer' => 'customer', + 'customerEmail' => 'customerEmail', + 'currency' => 'currency', + 'maySelectInvoice' => 'maySelectInvoice', + 'maySelectEmail' => 'maySelectEmail', + 'maySelectDelivery' => 'maySelectDelivery', + 'twoStep' => 'twoStep', + 'onlyCardReg' => 'onlyCardReg', + 'url' => 'url', + 'urls' => 'urls', + 'language' => 'language', + 'discount' => 'discount', + 'shippingCost' => 'shippingCost', + 'total' => 'total', + 'delivery' => 'delivery', + 'invoice' => 'invoice', + 'items' => 'items', + 'methods' => 'methods', + 'timeout' => 'timeout', + 'eamType' => 'eamType', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'customer' => 'setCustomer', + 'customerEmail' => 'setCustomerEmail', + 'currency' => 'setCurrency', + 'maySelectInvoice' => 'setMaySelectInvoice', + 'maySelectEmail' => 'setMaySelectEmail', + 'maySelectDelivery' => 'setMaySelectDelivery', + 'twoStep' => 'setTwoStep', + 'onlyCardReg' => 'setOnlyCardReg', + 'url' => 'setUrl', + 'urls' => 'setUrls', + 'language' => 'setLanguage', + 'discount' => 'setDiscount', + 'shippingCost' => 'setShippingCost', + 'total' => 'setTotal', + 'delivery' => 'setDelivery', + 'invoice' => 'setInvoice', + 'items' => 'setItems', + 'methods' => 'setMethods', + 'timeout' => 'setTimeout', + 'eamType' => 'setEamType', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'customer' => 'getCustomer', + 'customerEmail' => 'getCustomerEmail', + 'currency' => 'getCurrency', + 'maySelectInvoice' => 'getMaySelectInvoice', + 'maySelectEmail' => 'getMaySelectEmail', + 'maySelectDelivery' => 'getMaySelectDelivery', + 'twoStep' => 'getTwoStep', + 'onlyCardReg' => 'getOnlyCardReg', + 'url' => 'getUrl', + 'urls' => 'getUrls', + 'language' => 'getLanguage', + 'discount' => 'getDiscount', + 'shippingCost' => 'getShippingCost', + 'total' => 'getTotal', + 'delivery' => 'getDelivery', + 'invoice' => 'getInvoice', + 'items' => 'getItems', + 'methods' => 'getMethods', + 'timeout' => 'getTimeout', + 'eamType' => 'getEamType', + ]; + + /** + * 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; + } + + public const EAM_TYPE_NUMBER_1 = 1; + public const EAM_TYPE_NUMBER_2 = 2; + public const EAM_TYPE_NUMBER_3 = 3; + public const EAM_TYPE_NUMBER_4 = 4; + public const EAM_TYPE_NUMBER_5 = 5; + public const EAM_TYPE_NUMBER_6 = 6; + public const EAM_TYPE_NUMBER_7 = 7; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public static function getEamTypeAllowableValues() + { + return [ + self::EAM_TYPE_NUMBER_1, + self::EAM_TYPE_NUMBER_2, + self::EAM_TYPE_NUMBER_3, + self::EAM_TYPE_NUMBER_4, + self::EAM_TYPE_NUMBER_5, + self::EAM_TYPE_NUMBER_6, + self::EAM_TYPE_NUMBER_7, + ]; + } + + /** + * 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('customer', $data ?? [], null); + $this->setIfExists('customerEmail', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('maySelectInvoice', $data ?? [], false); + $this->setIfExists('maySelectEmail', $data ?? [], false); + $this->setIfExists('maySelectDelivery', $data ?? [], null); + $this->setIfExists('twoStep', $data ?? [], false); + $this->setIfExists('onlyCardReg', $data ?? [], false); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('urls', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], 0); + $this->setIfExists('shippingCost', $data ?? [], 0); + $this->setIfExists('total', $data ?? [], 0); + $this->setIfExists('delivery', $data ?? [], null); + $this->setIfExists('invoice', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('methods', $data ?? [], null); + $this->setIfExists('timeout', $data ?? [], null); + $this->setIfExists('eamType', $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['customerEmail'] === null) { + $invalidProperties[] = "'customerEmail' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; + } + if (!is_null($this->container['discount']) && ($this->container['discount'] < 0)) { + $invalidProperties[] = "invalid value for 'discount', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['shippingCost']) && ($this->container['shippingCost'] < 0)) { + $invalidProperties[] = "invalid value for 'shippingCost', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['total']) && ($this->container['total'] <= 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than 0."; + } + + if ($this->container['methods'] === null) { + $invalidProperties[] = "'methods' can't be null"; + } + if ($this->container['timeout'] === null) { + $invalidProperties[] = "'timeout' can't be null"; + } + if ($this->container['eamType'] === null) { + $invalidProperties[] = "'eamType' can't be null"; + } + $allowedValues = self::getEamTypeAllowableValues(); + if (!is_null($this->container['eamType']) && !in_array($this->container['eamType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'eamType', must be one of '%s'", + $this->container['eamType'], + implode("', '", $allowedValues) + ); + } + + 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 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 + */ + public function getCustomerEmail(): string + { + return $this->container['customerEmail']; + } + + /** + * Sets customerEmail + * + * @param string $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 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 maySelectInvoice + * + * @return bool|null + */ + public function getMaySelectInvoice(): ?bool + { + return $this->container['maySelectInvoice']; + } + + /** + * Sets maySelectInvoice + * + * @param bool|null $maySelectInvoice maySelectInvoice + * + * @return $this + */ + public function setMaySelectInvoice(?bool $maySelectInvoice): static + { + if (is_null($maySelectInvoice)) { + throw new InvalidArgumentException('non-nullable maySelectInvoice cannot be null'); + } + $this->container['maySelectInvoice'] = $maySelectInvoice; + + return $this; + } + + /** + * Gets maySelectEmail + * + * @return bool|null + */ + public function getMaySelectEmail(): ?bool + { + return $this->container['maySelectEmail']; + } + + /** + * Sets maySelectEmail + * + * @param bool|null $maySelectEmail maySelectEmail + * + * @return $this + */ + public function setMaySelectEmail(?bool $maySelectEmail): static + { + if (is_null($maySelectEmail)) { + throw new InvalidArgumentException('non-nullable maySelectEmail cannot be null'); + } + $this->container['maySelectEmail'] = $maySelectEmail; + + return $this; + } + + /** + * Gets maySelectDelivery + * + * @return string[]|null + */ + public function getMaySelectDelivery(): ?array + { + return $this->container['maySelectDelivery']; + } + + /** + * Sets maySelectDelivery + * + * @param string[]|null $maySelectDelivery maySelectDelivery + * + * @return $this + */ + public function setMaySelectDelivery(?array $maySelectDelivery): static + { + if (is_null($maySelectDelivery)) { + throw new InvalidArgumentException('non-nullable maySelectDelivery cannot be null'); + } + $this->container['maySelectDelivery'] = $maySelectDelivery; + + 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 onlyCardReg + * + * @return bool|null + */ + public function getOnlyCardReg(): ?bool + { + return $this->container['onlyCardReg']; + } + + /** + * Sets onlyCardReg + * + * @param bool|null $onlyCardReg onlyCardReg + * + * @return $this + */ + public function setOnlyCardReg(?bool $onlyCardReg): static + { + if (is_null($onlyCardReg)) { + throw new InvalidArgumentException('non-nullable onlyCardReg cannot be null'); + } + $this->container['onlyCardReg'] = $onlyCardReg; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url url + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets urls + * + * @return \Cone\SimplePay\Model\TransactionUrls|null + */ + public function getUrls(): ?\Cone\SimplePay\Model\TransactionUrls + { + return $this->container['urls']; + } + + /** + * Sets urls + * + * @param \Cone\SimplePay\Model\TransactionUrls|null $urls urls + * + * @return $this + */ + public function setUrls(?\Cone\SimplePay\Model\TransactionUrls $urls): static + { + if (is_null($urls)) { + throw new InvalidArgumentException('non-nullable urls cannot be null'); + } + $this->container['urls'] = $urls; + + return $this; + } + + /** + * Gets language + * + * @return \Cone\SimplePay\Model\Language + */ + public function getLanguage(): \Cone\SimplePay\Model\Language + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Cone\SimplePay\Model\Language $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 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'); + } + + if (($discount < 0)) { + throw new InvalidArgumentException('invalid value for $discount when calling EamTransaciton., must be bigger than or equal to 0.'); + } + + $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'); + } + + if (($shippingCost < 0)) { + throw new InvalidArgumentException('invalid value for $shippingCost when calling EamTransaciton., must be bigger than or equal to 0.'); + } + + $this->container['shippingCost'] = $shippingCost; + + 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'); + } + + if (($total <= 0)) { + throw new InvalidArgumentException('invalid value for $total when calling EamTransaciton., must be bigger than 0.'); + } + + $this->container['total'] = $total; + + 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 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 items + * + * @return \Cone\SimplePay\Model\Item[]|null + */ + public function getItems(): ?array + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Cone\SimplePay\Model\Item[]|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 methods + * + * @return \Cone\SimplePay\Model\Method[] + */ + public function getMethods(): array + { + return $this->container['methods']; + } + + /** + * Sets methods + * + * @param \Cone\SimplePay\Model\Method[] $methods Possible values: CARD, WIRE or EAM. + * + * @return $this + */ + public function setMethods(array $methods): static + { + if (is_null($methods)) { + throw new InvalidArgumentException('non-nullable methods cannot be null'); + } + $this->container['methods'] = $methods; + + return $this; + } + + /** + * Gets timeout + * + * @return string + */ + public function getTimeout(): string + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param string $timeout The ISO 8601 format of the timeout date. + * + * @return $this + */ + public function setTimeout(string $timeout): static + { + if (is_null($timeout)) { + throw new InvalidArgumentException('non-nullable timeout cannot be null'); + } + $this->container['timeout'] = $timeout; + + return $this; + } + + /** + * Gets eamType + * + * @return int + */ + public function getEamType(): int + { + return $this->container['eamType']; + } + + /** + * Sets eamType + * + * @param int $eamType 1: QR, 2: Deeplink, 3: NFC, 4: QR+ Deeplink, 5: QR+NFC, 6: Deeplink +NFC, 7: QR+DL+NFC + * + * @return $this + */ + public function setEamType(int $eamType): static + { + if (is_null($eamType)) { + throw new InvalidArgumentException('non-nullable eamType cannot be null'); + } + $allowedValues = self::getEamTypeAllowableValues(); + if (!in_array($eamType, $allowedValues, true)) { + throw new InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'eamType', must be one of '%s'", + $eamType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['eamType'] = $eamType; + + 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/Startapplepay200Response.php b/src/Model/Startapplepay200Response.php new file mode 100644 index 0000000..4cdc889 --- /dev/null +++ b/src/Model/Startapplepay200Response.php @@ -0,0 +1,575 @@ + + */ +class Startapplepay200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'startapplepay_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'transactionId' => 'float', + 'timeout' => 'string', + 'total' => 'float', + 'applePaySession' => '\Cone\SimplePay\Model\Startapplepay200ResponseApplePaySession', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'transactionId' => null, + 'timeout' => null, + 'total' => null, + 'applePaySession' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'transactionId' => false, + 'timeout' => false, + 'total' => false, + 'applePaySession' => 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', + 'transactionId' => 'transactionId', + 'timeout' => 'timeout', + 'total' => 'total', + 'applePaySession' => 'applePaySession', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'transactionId' => 'setTransactionId', + 'timeout' => 'setTimeout', + 'total' => 'setTotal', + 'applePaySession' => 'setApplePaySession', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'transactionId' => 'getTransactionId', + 'timeout' => 'getTimeout', + 'total' => 'getTotal', + 'applePaySession' => 'getApplePaySession', + ]; + + /** + * 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('transactionId', $data ?? [], null); + $this->setIfExists('timeout', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('applePaySession', $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 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 timeout + * + * @return string|null + */ + public function getTimeout(): ?string + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param string|null $timeout The ISO 8601 format of the timeout date. + * + * @return $this + */ + public function setTimeout(?string $timeout): static + { + if (is_null($timeout)) { + throw new InvalidArgumentException('non-nullable timeout cannot be null'); + } + $this->container['timeout'] = $timeout; + + 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 applePaySession + * + * @return \Cone\SimplePay\Model\Startapplepay200ResponseApplePaySession|null + */ + public function getApplePaySession(): ?\Cone\SimplePay\Model\Startapplepay200ResponseApplePaySession + { + return $this->container['applePaySession']; + } + + /** + * Sets applePaySession + * + * @param \Cone\SimplePay\Model\Startapplepay200ResponseApplePaySession|null $applePaySession applePaySession + * + * @return $this + */ + public function setApplePaySession(?\Cone\SimplePay\Model\Startapplepay200ResponseApplePaySession $applePaySession): static + { + if (is_null($applePaySession)) { + throw new InvalidArgumentException('non-nullable applePaySession cannot be null'); + } + $this->container['applePaySession'] = $applePaySession; + + 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/Startapplepay200ResponseApplePaySession.php b/src/Model/Startapplepay200ResponseApplePaySession.php new file mode 100644 index 0000000..293a2da --- /dev/null +++ b/src/Model/Startapplepay200ResponseApplePaySession.php @@ -0,0 +1,745 @@ + + */ +class Startapplepay200ResponseApplePaySession implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'startapplepay_200_response_applePaySession'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'epochTimestamp' => 'int', + 'expiresAt' => 'int', + 'merchantSessionIdentifier' => 'string', + 'nonce' => 'string', + 'merchantIdentifier' => 'string', + 'domainName' => 'string', + 'displayName' => 'string', + 'signature' => 'string', + 'operationalAnalyticsIdentifier' => 'string', + 'retries' => 'int', + 'pspId' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'epochTimestamp' => null, + 'expiresAt' => null, + 'merchantSessionIdentifier' => null, + 'nonce' => null, + 'merchantIdentifier' => null, + 'domainName' => null, + 'displayName' => null, + 'signature' => null, + 'operationalAnalyticsIdentifier' => null, + 'retries' => null, + 'pspId' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'epochTimestamp' => false, + 'expiresAt' => false, + 'merchantSessionIdentifier' => false, + 'nonce' => false, + 'merchantIdentifier' => false, + 'domainName' => false, + 'displayName' => false, + 'signature' => false, + 'operationalAnalyticsIdentifier' => false, + 'retries' => false, + 'pspId' => 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 = [ + 'epochTimestamp' => 'epochTimestamp', + 'expiresAt' => 'expiresAt', + 'merchantSessionIdentifier' => 'merchantSessionIdentifier', + 'nonce' => 'nonce', + 'merchantIdentifier' => 'merchantIdentifier', + 'domainName' => 'domainName', + 'displayName' => 'displayName', + 'signature' => 'signature', + 'operationalAnalyticsIdentifier' => 'operationalAnalyticsIdentifier', + 'retries' => 'retries', + 'pspId' => 'pspId', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'epochTimestamp' => 'setEpochTimestamp', + 'expiresAt' => 'setExpiresAt', + 'merchantSessionIdentifier' => 'setMerchantSessionIdentifier', + 'nonce' => 'setNonce', + 'merchantIdentifier' => 'setMerchantIdentifier', + 'domainName' => 'setDomainName', + 'displayName' => 'setDisplayName', + 'signature' => 'setSignature', + 'operationalAnalyticsIdentifier' => 'setOperationalAnalyticsIdentifier', + 'retries' => 'setRetries', + 'pspId' => 'setPspId', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'epochTimestamp' => 'getEpochTimestamp', + 'expiresAt' => 'getExpiresAt', + 'merchantSessionIdentifier' => 'getMerchantSessionIdentifier', + 'nonce' => 'getNonce', + 'merchantIdentifier' => 'getMerchantIdentifier', + 'domainName' => 'getDomainName', + 'displayName' => 'getDisplayName', + 'signature' => 'getSignature', + 'operationalAnalyticsIdentifier' => 'getOperationalAnalyticsIdentifier', + 'retries' => 'getRetries', + 'pspId' => 'getPspId', + ]; + + /** + * 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('epochTimestamp', $data ?? [], null); + $this->setIfExists('expiresAt', $data ?? [], null); + $this->setIfExists('merchantSessionIdentifier', $data ?? [], null); + $this->setIfExists('nonce', $data ?? [], null); + $this->setIfExists('merchantIdentifier', $data ?? [], null); + $this->setIfExists('domainName', $data ?? [], null); + $this->setIfExists('displayName', $data ?? [], null); + $this->setIfExists('signature', $data ?? [], null); + $this->setIfExists('operationalAnalyticsIdentifier', $data ?? [], null); + $this->setIfExists('retries', $data ?? [], null); + $this->setIfExists('pspId', $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 epochTimestamp + * + * @return int|null + */ + public function getEpochTimestamp(): ?int + { + return $this->container['epochTimestamp']; + } + + /** + * Sets epochTimestamp + * + * @param int|null $epochTimestamp The timestamp of the session start. + * + * @return $this + */ + public function setEpochTimestamp(?int $epochTimestamp): static + { + if (is_null($epochTimestamp)) { + throw new InvalidArgumentException('non-nullable epochTimestamp cannot be null'); + } + $this->container['epochTimestamp'] = $epochTimestamp; + + return $this; + } + + /** + * Gets expiresAt + * + * @return int|null + */ + public function getExpiresAt(): ?int + { + return $this->container['expiresAt']; + } + + /** + * Sets expiresAt + * + * @param int|null $expiresAt The timestamp of the session expiration. + * + * @return $this + */ + public function setExpiresAt(?int $expiresAt): static + { + if (is_null($expiresAt)) { + throw new InvalidArgumentException('non-nullable expiresAt cannot be null'); + } + $this->container['expiresAt'] = $expiresAt; + + return $this; + } + + /** + * Gets merchantSessionIdentifier + * + * @return string|null + */ + public function getMerchantSessionIdentifier(): ?string + { + return $this->container['merchantSessionIdentifier']; + } + + /** + * Sets merchantSessionIdentifier + * + * @param string|null $merchantSessionIdentifier merchantSessionIdentifier + * + * @return $this + */ + public function setMerchantSessionIdentifier(?string $merchantSessionIdentifier): static + { + if (is_null($merchantSessionIdentifier)) { + throw new InvalidArgumentException('non-nullable merchantSessionIdentifier cannot be null'); + } + $this->container['merchantSessionIdentifier'] = $merchantSessionIdentifier; + + return $this; + } + + /** + * Gets nonce + * + * @return string|null + */ + public function getNonce(): ?string + { + return $this->container['nonce']; + } + + /** + * Sets nonce + * + * @param string|null $nonce nonce + * + * @return $this + */ + public function setNonce(?string $nonce): static + { + if (is_null($nonce)) { + throw new InvalidArgumentException('non-nullable nonce cannot be null'); + } + $this->container['nonce'] = $nonce; + + return $this; + } + + /** + * Gets merchantIdentifier + * + * @return string|null + */ + public function getMerchantIdentifier(): ?string + { + return $this->container['merchantIdentifier']; + } + + /** + * Sets merchantIdentifier + * + * @param string|null $merchantIdentifier The ApplePay merchant ID. + * + * @return $this + */ + public function setMerchantIdentifier(?string $merchantIdentifier): static + { + if (is_null($merchantIdentifier)) { + throw new InvalidArgumentException('non-nullable merchantIdentifier cannot be null'); + } + $this->container['merchantIdentifier'] = $merchantIdentifier; + + return $this; + } + + /** + * Gets domainName + * + * @return string|null + */ + public function getDomainName(): ?string + { + return $this->container['domainName']; + } + + /** + * Sets domainName + * + * @param string|null $domainName The FQDN. + * + * @return $this + */ + public function setDomainName(?string $domainName): static + { + if (is_null($domainName)) { + throw new InvalidArgumentException('non-nullable domainName cannot be null'); + } + $this->container['domainName'] = $domainName; + + return $this; + } + + /** + * Gets displayName + * + * @return string|null + */ + public function getDisplayName(): ?string + { + return $this->container['displayName']; + } + + /** + * Sets displayName + * + * @param string|null $displayName displayName + * + * @return $this + */ + public function setDisplayName(?string $displayName): static + { + if (is_null($displayName)) { + throw new InvalidArgumentException('non-nullable displayName cannot be null'); + } + $this->container['displayName'] = $displayName; + + return $this; + } + + /** + * Gets signature + * + * @return string|null + */ + public function getSignature(): ?string + { + return $this->container['signature']; + } + + /** + * Sets signature + * + * @param string|null $signature signature + * + * @return $this + */ + public function setSignature(?string $signature): static + { + if (is_null($signature)) { + throw new InvalidArgumentException('non-nullable signature cannot be null'); + } + $this->container['signature'] = $signature; + + return $this; + } + + /** + * Gets operationalAnalyticsIdentifier + * + * @return string|null + */ + public function getOperationalAnalyticsIdentifier(): ?string + { + return $this->container['operationalAnalyticsIdentifier']; + } + + /** + * Sets operationalAnalyticsIdentifier + * + * @param string|null $operationalAnalyticsIdentifier operationalAnalyticsIdentifier + * + * @return $this + */ + public function setOperationalAnalyticsIdentifier(?string $operationalAnalyticsIdentifier): static + { + if (is_null($operationalAnalyticsIdentifier)) { + throw new InvalidArgumentException('non-nullable operationalAnalyticsIdentifier cannot be null'); + } + $this->container['operationalAnalyticsIdentifier'] = $operationalAnalyticsIdentifier; + + return $this; + } + + /** + * Gets retries + * + * @return int|null + */ + public function getRetries(): ?int + { + return $this->container['retries']; + } + + /** + * Sets retries + * + * @param int|null $retries retries + * + * @return $this + */ + public function setRetries(?int $retries): static + { + if (is_null($retries)) { + throw new InvalidArgumentException('non-nullable retries cannot be null'); + } + $this->container['retries'] = $retries; + + return $this; + } + + /** + * Gets pspId + * + * @return string|null + */ + public function getPspId(): ?string + { + return $this->container['pspId']; + } + + /** + * Sets pspId + * + * @param string|null $pspId pspId + * + * @return $this + */ + public function setPspId(?string $pspId): static + { + if (is_null($pspId)) { + throw new InvalidArgumentException('non-nullable pspId cannot be null'); + } + $this->container['pspId'] = $pspId; + + 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/Starteam200Response.php b/src/Model/Starteam200Response.php new file mode 100644 index 0000000..85bfa88 --- /dev/null +++ b/src/Model/Starteam200Response.php @@ -0,0 +1,677 @@ + + */ +class Starteam200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'starteam_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', + 'timeout' => 'string', + 'total' => 'float', + 'eam' => 'string', + 'tokens' => 'string[]', + ]; + + /** + * 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, + 'timeout' => null, + 'total' => null, + 'eam' => null, + 'tokens' => 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, + 'timeout' => false, + 'total' => false, + 'eam' => false, + 'tokens' => 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', + 'timeout' => 'timeout', + 'total' => 'total', + 'eam' => 'eam', + 'tokens' => 'tokens', + ]; + + /** + * 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', + 'timeout' => 'setTimeout', + 'total' => 'setTotal', + 'eam' => 'setEam', + 'tokens' => 'setTokens', + ]; + + /** + * 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', + 'timeout' => 'getTimeout', + 'total' => 'getTotal', + 'eam' => 'getEam', + 'tokens' => 'getTokens', + ]; + + /** + * 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('timeout', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('eam', $data ?? [], null); + $this->setIfExists('tokens', $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 timeout + * + * @return string|null + */ + public function getTimeout(): ?string + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param string|null $timeout The ISO 8601 format of the timeout date. + * + * @return $this + */ + public function setTimeout(?string $timeout): static + { + if (is_null($timeout)) { + throw new InvalidArgumentException('non-nullable timeout cannot be null'); + } + $this->container['timeout'] = $timeout; + + 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 eam + * + * @return string|null + */ + public function getEam(): ?string + { + return $this->container['eam']; + } + + /** + * Sets eam + * + * @param string|null $eam The deeplink. + * + * @return $this + */ + public function setEam(?string $eam): static + { + if (is_null($eam)) { + throw new InvalidArgumentException('non-nullable eam cannot be null'); + } + $this->container['eam'] = $eam; + + return $this; + } + + /** + * Gets tokens + * + * @return string[]|null + */ + public function getTokens(): ?array + { + return $this->container['tokens']; + } + + /** + * Sets tokens + * + * @param string[]|null $tokens The recurring payment tokens. Provided only for the initial recurring payment. + * + * @return $this + */ + public function setTokens(?array $tokens): static + { + if (is_null($tokens)) { + throw new InvalidArgumentException('non-nullable tokens cannot be null'); + } + $this->container['tokens'] = $tokens; + + 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/TokenCancel.php b/src/Model/TokenCancel.php index 7416612..cd6d2a9 100644 --- a/src/Model/TokenCancel.php +++ b/src/Model/TokenCancel.php @@ -58,7 +58,7 @@ class TokenCancel implements ModelInterface, ArrayAccess, JsonSerializable * @var array */ protected static array $openAPITypes = [ - 'token' => 'float', + 'token' => 'string', ]; /** @@ -293,9 +293,9 @@ public function valid(): bool /** * Gets token * - * @return float + * @return string */ - public function getToken(): float + public function getToken(): string { return $this->container['token']; } @@ -303,11 +303,11 @@ public function getToken(): float /** * Sets token * - * @param float $token token + * @param string $token token * * @return $this */ - public function setToken(float $token): static + public function setToken(string $token): static { if (is_null($token)) { throw new InvalidArgumentException('non-nullable token cannot be null');