diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 046188d..363474c 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -33,7 +33,12 @@ src/Model/Refund.php src/Model/Refund200Response.php src/Model/RefundStatus.php src/Model/Start200Response.php +src/Model/TokenCancel.php +src/Model/TokenQuery.php +src/Model/TokenStatus.php src/Model/TokenTransaction.php +src/Model/Tokencancel200Response.php +src/Model/Tokenquery200Response.php src/Model/Transaction.php src/Model/TransactionCancel.php src/Model/TransactionStatus.php @@ -70,7 +75,12 @@ tests/Model/Refund200ResponseTest.php tests/Model/RefundStatusTest.php tests/Model/RefundTest.php tests/Model/Start200ResponseTest.php +tests/Model/TokenCancelTest.php +tests/Model/TokenQueryTest.php +tests/Model/TokenStatusTest.php tests/Model/TokenTransactionTest.php +tests/Model/Tokencancel200ResponseTest.php +tests/Model/Tokenquery200ResponseTest.php tests/Model/TransactionCancelTest.php tests/Model/TransactionStatusTest.php tests/Model/TransactionTest.php diff --git a/src/Api/TransactionApi.php b/src/Api/TransactionApi.php index fa55461..f773594 100644 --- a/src/Api/TransactionApi.php +++ b/src/Api/TransactionApi.php @@ -98,6 +98,12 @@ class TransactionApi 'start' => [ 'application/json', ], + 'tokencancel' => [ + 'application/json', + ], + 'tokenquery' => [ + 'application/json', + ], 'transactioncancel' => [ 'application/json', ], @@ -2509,6 +2515,596 @@ public function startRequest( ); } + /** + * Operation tokencancel + * + * Cancel a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenCancel $tokenCancel The token object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokencancel'] 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\Tokencancel200Response + */ + public function tokencancel( + string $signature, + \Cone\SimplePay\Model\TokenCancel $tokenCancel, + string $contentType = self::contentTypes['tokencancel'][0] + ): \Cone\SimplePay\Model\Tokencancel200Response { + list($response) = $this->tokencancelWithHttpInfo($signature, $tokenCancel, $contentType); + return $response; + } + + /** + * Operation tokencancelWithHttpInfo + * + * Cancel a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenCancel $tokenCancel The token object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokencancel'] 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\Tokencancel200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function tokencancelWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\TokenCancel $tokenCancel, + string $contentType = self::contentTypes['tokencancel'][0] + ): array { + $request = $this->tokencancelRequest($signature, $tokenCancel, $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\Tokencancel200Response', + $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\Tokencancel200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Tokencancel200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation tokencancelAsync + * + * Cancel a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenCancel $tokenCancel The token object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokencancel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function tokencancelAsync( + string $signature, + \Cone\SimplePay\Model\TokenCancel $tokenCancel, + string $contentType = self::contentTypes['tokencancel'][0] + ): PromiseInterface { + return $this->tokencancelAsyncWithHttpInfo($signature, $tokenCancel, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation tokencancelAsyncWithHttpInfo + * + * Cancel a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenCancel $tokenCancel The token object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokencancel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function tokencancelAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\TokenCancel $tokenCancel, + string $contentType = self::contentTypes['tokencancel'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Tokencancel200Response'; + $request = $this->tokencancelRequest($signature, $tokenCancel, $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 'tokencancel' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenCancel $tokenCancel The token object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokencancel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function tokencancelRequest( + string $signature, + \Cone\SimplePay\Model\TokenCancel $tokenCancel, + string $contentType = self::contentTypes['tokencancel'][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 tokencancel' + ); + } + + // verify the required parameter 'tokenCancel' is set + if ($tokenCancel === null || (is_array($tokenCancel) && count($tokenCancel) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tokenCancel when calling tokencancel' + ); + } + + + $resourcePath = '/tokencancel'; + $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($tokenCancel)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tokenCancel)); + } else { + $httpBody = $tokenCancel; + } + } 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 tokenquery + * + * Query a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenQuery $tokenQuery The token object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenquery'] 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\Tokenquery200Response + */ + public function tokenquery( + string $signature, + \Cone\SimplePay\Model\TokenQuery $tokenQuery, + string $contentType = self::contentTypes['tokenquery'][0] + ): \Cone\SimplePay\Model\Tokenquery200Response { + list($response) = $this->tokenqueryWithHttpInfo($signature, $tokenQuery, $contentType); + return $response; + } + + /** + * Operation tokenqueryWithHttpInfo + * + * Query a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenQuery $tokenQuery The token object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenquery'] 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\Tokenquery200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function tokenqueryWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\TokenQuery $tokenQuery, + string $contentType = self::contentTypes['tokenquery'][0] + ): array { + $request = $this->tokenqueryRequest($signature, $tokenQuery, $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\Tokenquery200Response', + $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\Tokenquery200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Tokenquery200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation tokenqueryAsync + * + * Query a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenQuery $tokenQuery The token object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenquery'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function tokenqueryAsync( + string $signature, + \Cone\SimplePay\Model\TokenQuery $tokenQuery, + string $contentType = self::contentTypes['tokenquery'][0] + ): PromiseInterface { + return $this->tokenqueryAsyncWithHttpInfo($signature, $tokenQuery, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation tokenqueryAsyncWithHttpInfo + * + * Query a saved token + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenQuery $tokenQuery The token object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenquery'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function tokenqueryAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\TokenQuery $tokenQuery, + string $contentType = self::contentTypes['tokenquery'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Tokenquery200Response'; + $request = $this->tokenqueryRequest($signature, $tokenQuery, $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 'tokenquery' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\TokenQuery $tokenQuery The token object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['tokenquery'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function tokenqueryRequest( + string $signature, + \Cone\SimplePay\Model\TokenQuery $tokenQuery, + string $contentType = self::contentTypes['tokenquery'][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 tokenquery' + ); + } + + // verify the required parameter 'tokenQuery' is set + if ($tokenQuery === null || (is_array($tokenQuery) && count($tokenQuery) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tokenQuery when calling tokenquery' + ); + } + + + $resourcePath = '/tokenquery'; + $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($tokenQuery)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tokenQuery)); + } else { + $httpBody = $tokenQuery; + } + } 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 transactioncancel * diff --git a/src/Model/TokenCancel.php b/src/Model/TokenCancel.php new file mode 100644 index 0000000..7416612 --- /dev/null +++ b/src/Model/TokenCancel.php @@ -0,0 +1,408 @@ + + */ +class TokenCancel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TokenCancel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'token' => 'float', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'token' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'token' => 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 = [ + 'token' => 'token', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'token' => 'setToken', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'token' => 'getToken', + ]; + + /** + * 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('token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, 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['token'] === null) { + $invalidProperties[] = "'token' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets token + * + * @return float + */ + public function getToken(): float + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param float $token token + * + * @return $this + */ + public function setToken(float $token): static + { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @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/TokenQuery.php b/src/Model/TokenQuery.php new file mode 100644 index 0000000..3252513 --- /dev/null +++ b/src/Model/TokenQuery.php @@ -0,0 +1,408 @@ + + */ +class TokenQuery implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TokenQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'token' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'token' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'token' => 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 = [ + 'token' => 'token', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'token' => 'setToken', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'token' => 'getToken', + ]; + + /** + * 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('token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, 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['token'] === null) { + $invalidProperties[] = "'token' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets token + * + * @return string + */ + public function getToken(): string + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string $token token + * + * @return $this + */ + public function setToken(string $token): static + { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @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/TokenStatus.php b/src/Model/TokenStatus.php new file mode 100644 index 0000000..78d20e5 --- /dev/null +++ b/src/Model/TokenStatus.php @@ -0,0 +1,44 @@ + + */ +class Tokencancel200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tokencancel_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'token' => 'string', + 'status' => '\Cone\SimplePay\Model\TokenStatus', + 'expiry' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'token' => null, + 'status' => null, + 'expiry' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'token' => false, + 'status' => false, + 'expiry' => 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', + 'token' => 'token', + 'status' => 'status', + 'expiry' => 'expiry', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'token' => 'setToken', + 'status' => 'setStatus', + 'expiry' => 'setExpiry', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'token' => 'getToken', + 'status' => 'getStatus', + 'expiry' => 'getExpiry', + ]; + + /** + * 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('token', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('expiry', $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 token + * + * @return string|null + */ + public function getToken(): ?string + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token token + * + * @return $this + */ + public function setToken(?string $token): static + { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets status + * + * @return \Cone\SimplePay\Model\TokenStatus|null + */ + public function getStatus(): ?\Cone\SimplePay\Model\TokenStatus + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Cone\SimplePay\Model\TokenStatus|null $status status + * + * @return $this + */ + public function setStatus(?\Cone\SimplePay\Model\TokenStatus $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets expiry + * + * @return string|null + */ + public function getExpiry(): ?string + { + return $this->container['expiry']; + } + + /** + * Sets expiry + * + * @param string|null $expiry The ISO 8601 format of the card expiry date. + * + * @return $this + */ + public function setExpiry(?string $expiry): static + { + if (is_null($expiry)) { + throw new InvalidArgumentException('non-nullable expiry cannot be null'); + } + $this->container['expiry'] = $expiry; + + 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/Tokenquery200Response.php b/src/Model/Tokenquery200Response.php new file mode 100644 index 0000000..888dc9d --- /dev/null +++ b/src/Model/Tokenquery200Response.php @@ -0,0 +1,541 @@ + + */ +class Tokenquery200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tokenquery_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'token' => 'string', + 'status' => '\Cone\SimplePay\Model\TokenStatus', + 'expiry' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'token' => null, + 'status' => null, + 'expiry' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'token' => false, + 'status' => false, + 'expiry' => 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', + 'token' => 'token', + 'status' => 'status', + 'expiry' => 'expiry', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'token' => 'setToken', + 'status' => 'setStatus', + 'expiry' => 'setExpiry', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'token' => 'getToken', + 'status' => 'getStatus', + 'expiry' => 'getExpiry', + ]; + + /** + * 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('token', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('expiry', $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 token + * + * @return string|null + */ + public function getToken(): ?string + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string|null $token token + * + * @return $this + */ + public function setToken(?string $token): static + { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + + /** + * Gets status + * + * @return \Cone\SimplePay\Model\TokenStatus|null + */ + public function getStatus(): ?\Cone\SimplePay\Model\TokenStatus + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Cone\SimplePay\Model\TokenStatus|null $status status + * + * @return $this + */ + public function setStatus(?\Cone\SimplePay\Model\TokenStatus $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets expiry + * + * @return string|null + */ + public function getExpiry(): ?string + { + return $this->container['expiry']; + } + + /** + * Sets expiry + * + * @param string|null $expiry The ISO 8601 format of the token expiry date. + * + * @return $this + */ + public function setExpiry(?string $expiry): static + { + if (is_null($expiry)) { + throw new InvalidArgumentException('non-nullable expiry cannot be null'); + } + $this->container['expiry'] = $expiry; + + 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)); + } +}