diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index ecd396f..046188d 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -6,6 +6,12 @@ src/FormDataProcessor.php src/HeaderSelector.php src/Model/AuthMethod.php src/Model/AuthorizedTransaction.php +src/Model/CardCancel.php +src/Model/CardQuery.php +src/Model/CardStatus.php +src/Model/Cardcancel200Response.php +src/Model/Cardquery200Response.php +src/Model/Cardquery200ResponseHistoryInner.php src/Model/Currency.php src/Model/Delivery.php src/Model/Do200Response.php @@ -27,10 +33,10 @@ src/Model/Refund.php src/Model/Refund200Response.php src/Model/RefundStatus.php src/Model/Start200Response.php -src/Model/Status.php src/Model/TokenTransaction.php src/Model/Transaction.php src/Model/TransactionCancel.php +src/Model/TransactionStatus.php src/Model/TransactionType.php src/Model/TransactionUrls.php src/Model/Transactioncancel200Response.php @@ -38,6 +44,12 @@ src/ObjectSerializer.php tests/Api/TransactionApiTest.php tests/Model/AuthMethodTest.php tests/Model/AuthorizedTransactionTest.php +tests/Model/CardCancelTest.php +tests/Model/CardQueryTest.php +tests/Model/CardStatusTest.php +tests/Model/Cardcancel200ResponseTest.php +tests/Model/Cardquery200ResponseHistoryInnerTest.php +tests/Model/Cardquery200ResponseTest.php tests/Model/CurrencyTest.php tests/Model/DeliveryTest.php tests/Model/Do200ResponseTest.php @@ -58,9 +70,9 @@ tests/Model/Refund200ResponseTest.php tests/Model/RefundStatusTest.php tests/Model/RefundTest.php tests/Model/Start200ResponseTest.php -tests/Model/StatusTest.php tests/Model/TokenTransactionTest.php tests/Model/TransactionCancelTest.php +tests/Model/TransactionStatusTest.php tests/Model/TransactionTest.php tests/Model/TransactionTypeTest.php tests/Model/TransactionUrlsTest.php diff --git a/src/Api/TransactionApi.php b/src/Api/TransactionApi.php index 5fc496e..fa55461 100644 --- a/src/Api/TransactionApi.php +++ b/src/Api/TransactionApi.php @@ -77,6 +77,12 @@ class TransactionApi 'callDo' => [ 'application/json', ], + 'cardcancel' => [ + 'application/json', + ], + 'cardquery' => [ + 'application/json', + ], 'dorecurring' => [ 'application/json', ], @@ -438,6 +444,596 @@ public function callDoRequest( ); } + /** + * Operation cardcancel + * + * Cancel a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardCancel $cardCancel The card object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardcancel'] 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\Cardcancel200Response + */ + public function cardcancel( + string $signature, + \Cone\SimplePay\Model\CardCancel $cardCancel, + string $contentType = self::contentTypes['cardcancel'][0] + ): \Cone\SimplePay\Model\Cardcancel200Response { + list($response) = $this->cardcancelWithHttpInfo($signature, $cardCancel, $contentType); + return $response; + } + + /** + * Operation cardcancelWithHttpInfo + * + * Cancel a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardCancel $cardCancel The card object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardcancel'] 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\Cardcancel200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function cardcancelWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\CardCancel $cardCancel, + string $contentType = self::contentTypes['cardcancel'][0] + ): array { + $request = $this->cardcancelRequest($signature, $cardCancel, $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\Cardcancel200Response', + $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\Cardcancel200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Cardcancel200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation cardcancelAsync + * + * Cancel a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardCancel $cardCancel The card object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardcancel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cardcancelAsync( + string $signature, + \Cone\SimplePay\Model\CardCancel $cardCancel, + string $contentType = self::contentTypes['cardcancel'][0] + ): PromiseInterface { + return $this->cardcancelAsyncWithHttpInfo($signature, $cardCancel, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cardcancelAsyncWithHttpInfo + * + * Cancel a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardCancel $cardCancel The card object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardcancel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cardcancelAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\CardCancel $cardCancel, + string $contentType = self::contentTypes['cardcancel'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Cardcancel200Response'; + $request = $this->cardcancelRequest($signature, $cardCancel, $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 'cardcancel' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardCancel $cardCancel The card object you would cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardcancel'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cardcancelRequest( + string $signature, + \Cone\SimplePay\Model\CardCancel $cardCancel, + string $contentType = self::contentTypes['cardcancel'][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 cardcancel' + ); + } + + // verify the required parameter 'cardCancel' is set + if ($cardCancel === null || (is_array($cardCancel) && count($cardCancel) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $cardCancel when calling cardcancel' + ); + } + + + $resourcePath = '/cardcancel'; + $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($cardCancel)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($cardCancel)); + } else { + $httpBody = $cardCancel; + } + } 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 cardquery + * + * Query a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardQuery $cardQuery The card object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardquery'] 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\Cardquery200Response + */ + public function cardquery( + string $signature, + \Cone\SimplePay\Model\CardQuery $cardQuery, + string $contentType = self::contentTypes['cardquery'][0] + ): \Cone\SimplePay\Model\Cardquery200Response { + list($response) = $this->cardqueryWithHttpInfo($signature, $cardQuery, $contentType); + return $response; + } + + /** + * Operation cardqueryWithHttpInfo + * + * Query a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardQuery $cardQuery The card object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardquery'] 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\Cardquery200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function cardqueryWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\CardQuery $cardQuery, + string $contentType = self::contentTypes['cardquery'][0] + ): array { + $request = $this->cardqueryRequest($signature, $cardQuery, $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\Cardquery200Response', + $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\Cardquery200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\SimplePay\Model\Cardquery200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation cardqueryAsync + * + * Query a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardQuery $cardQuery The card object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardquery'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cardqueryAsync( + string $signature, + \Cone\SimplePay\Model\CardQuery $cardQuery, + string $contentType = self::contentTypes['cardquery'][0] + ): PromiseInterface { + return $this->cardqueryAsyncWithHttpInfo($signature, $cardQuery, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cardqueryAsyncWithHttpInfo + * + * Query a saved card + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardQuery $cardQuery The card object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardquery'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function cardqueryAsyncWithHttpInfo( + string $signature, + \Cone\SimplePay\Model\CardQuery $cardQuery, + string $contentType = self::contentTypes['cardquery'][0] + ): PromiseInterface { + $returnType = '\Cone\SimplePay\Model\Cardquery200Response'; + $request = $this->cardqueryRequest($signature, $cardQuery, $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 'cardquery' + * + * @param string $signature The signature. (required) + * @param \Cone\SimplePay\Model\CardQuery $cardQuery The card object you would query. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cardquery'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cardqueryRequest( + string $signature, + \Cone\SimplePay\Model\CardQuery $cardQuery, + string $contentType = self::contentTypes['cardquery'][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 cardquery' + ); + } + + // verify the required parameter 'cardQuery' is set + if ($cardQuery === null || (is_array($cardQuery) && count($cardQuery) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $cardQuery when calling cardquery' + ); + } + + + $resourcePath = '/cardquery'; + $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($cardQuery)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($cardQuery)); + } else { + $httpBody = $cardQuery; + } + } 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 * diff --git a/src/Model/CardCancel.php b/src/Model/CardCancel.php new file mode 100644 index 0000000..43de17d --- /dev/null +++ b/src/Model/CardCancel.php @@ -0,0 +1,408 @@ + + */ +class CardCancel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CardCancel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'cardId' => 'float', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'cardId' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'cardId' => 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 = [ + 'cardId' => 'cardId', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'cardId' => 'setCardId', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'cardId' => 'getCardId', + ]; + + /** + * 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('cardId', $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['cardId'] === null) { + $invalidProperties[] = "'cardId' 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 cardId + * + * @return float + */ + public function getCardId(): float + { + return $this->container['cardId']; + } + + /** + * Sets cardId + * + * @param float $cardId cardId + * + * @return $this + */ + public function setCardId(float $cardId): static + { + if (is_null($cardId)) { + throw new InvalidArgumentException('non-nullable cardId cannot be null'); + } + $this->container['cardId'] = $cardId; + + 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/CardQuery.php b/src/Model/CardQuery.php new file mode 100644 index 0000000..f6b090e --- /dev/null +++ b/src/Model/CardQuery.php @@ -0,0 +1,442 @@ + + */ +class CardQuery implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CardQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'cardId' => 'float', + 'history' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'cardId' => null, + 'history' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'cardId' => false, + 'history' => 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 = [ + 'cardId' => 'cardId', + 'history' => 'history', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'cardId' => 'setCardId', + 'history' => 'setHistory', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'cardId' => 'getCardId', + 'history' => 'getHistory', + ]; + + /** + * 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('cardId', $data ?? [], null); + $this->setIfExists('history', $data ?? [], false); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['cardId'] === null) { + $invalidProperties[] = "'cardId' 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 cardId + * + * @return float + */ + public function getCardId(): float + { + return $this->container['cardId']; + } + + /** + * Sets cardId + * + * @param float $cardId cardId + * + * @return $this + */ + public function setCardId(float $cardId): static + { + if (is_null($cardId)) { + throw new InvalidArgumentException('non-nullable cardId cannot be null'); + } + $this->container['cardId'] = $cardId; + + return $this; + } + + /** + * Gets history + * + * @return bool|null + */ + public function getHistory(): ?bool + { + return $this->container['history']; + } + + /** + * Sets history + * + * @param bool|null $history history + * + * @return $this + */ + public function setHistory(?bool $history): static + { + if (is_null($history)) { + throw new InvalidArgumentException('non-nullable history cannot be null'); + } + $this->container['history'] = $history; + + 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/CardStatus.php b/src/Model/CardStatus.php new file mode 100644 index 0000000..fef527b --- /dev/null +++ b/src/Model/CardStatus.php @@ -0,0 +1,42 @@ + + */ +class Cardcancel200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'cardcancel_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'cardId' => 'float', + 'status' => '\Cone\SimplePay\Model\CardStatus', + 'expiry' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'cardId' => null, + 'status' => null, + 'expiry' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'cardId' => 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', + 'cardId' => 'cardId', + 'status' => 'status', + 'expiry' => 'expiry', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'cardId' => 'setCardId', + 'status' => 'setStatus', + 'expiry' => 'setExpiry', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'cardId' => 'getCardId', + '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('cardId', $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 cardId + * + * @return float|null + */ + public function getCardId(): ?float + { + return $this->container['cardId']; + } + + /** + * Sets cardId + * + * @param float|null $cardId cardId + * + * @return $this + */ + public function setCardId(?float $cardId): static + { + if (is_null($cardId)) { + throw new InvalidArgumentException('non-nullable cardId cannot be null'); + } + $this->container['cardId'] = $cardId; + + return $this; + } + + /** + * Gets status + * + * @return \Cone\SimplePay\Model\CardStatus|null + */ + public function getStatus(): ?\Cone\SimplePay\Model\CardStatus + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Cone\SimplePay\Model\CardStatus|null $status status + * + * @return $this + */ + public function setStatus(?\Cone\SimplePay\Model\CardStatus $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/Cardquery200Response.php b/src/Model/Cardquery200Response.php new file mode 100644 index 0000000..19b9175 --- /dev/null +++ b/src/Model/Cardquery200Response.php @@ -0,0 +1,575 @@ + + */ +class Cardquery200Response implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'cardquery_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'salt' => 'string', + 'merchant' => 'string', + 'cardId' => 'float', + 'status' => '\Cone\SimplePay\Model\CardStatus', + 'expiry' => 'string', + 'history' => '\Cone\SimplePay\Model\Cardquery200ResponseHistoryInner[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'salt' => null, + 'merchant' => null, + 'cardId' => null, + 'status' => null, + 'expiry' => null, + 'history' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'salt' => false, + 'merchant' => false, + 'cardId' => false, + 'status' => false, + 'expiry' => false, + 'history' => 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', + 'cardId' => 'cardId', + 'status' => 'status', + 'expiry' => 'expiry', + 'history' => 'history', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'salt' => 'setSalt', + 'merchant' => 'setMerchant', + 'cardId' => 'setCardId', + 'status' => 'setStatus', + 'expiry' => 'setExpiry', + 'history' => 'setHistory', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'salt' => 'getSalt', + 'merchant' => 'getMerchant', + 'cardId' => 'getCardId', + 'status' => 'getStatus', + 'expiry' => 'getExpiry', + 'history' => 'getHistory', + ]; + + /** + * 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('cardId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('expiry', $data ?? [], null); + $this->setIfExists('history', $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 cardId + * + * @return float|null + */ + public function getCardId(): ?float + { + return $this->container['cardId']; + } + + /** + * Sets cardId + * + * @param float|null $cardId cardId + * + * @return $this + */ + public function setCardId(?float $cardId): static + { + if (is_null($cardId)) { + throw new InvalidArgumentException('non-nullable cardId cannot be null'); + } + $this->container['cardId'] = $cardId; + + return $this; + } + + /** + * Gets status + * + * @return \Cone\SimplePay\Model\CardStatus|null + */ + public function getStatus(): ?\Cone\SimplePay\Model\CardStatus + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Cone\SimplePay\Model\CardStatus|null $status status + * + * @return $this + */ + public function setStatus(?\Cone\SimplePay\Model\CardStatus $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; + } + + /** + * Gets history + * + * @return \Cone\SimplePay\Model\Cardquery200ResponseHistoryInner[]|null + */ + public function getHistory(): ?array + { + return $this->container['history']; + } + + /** + * Sets history + * + * @param \Cone\SimplePay\Model\Cardquery200ResponseHistoryInner[]|null $history history + * + * @return $this + */ + public function setHistory(?array $history): static + { + if (is_null($history)) { + throw new InvalidArgumentException('non-nullable history cannot be null'); + } + $this->container['history'] = $history; + + 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/Cardquery200ResponseHistoryInner.php b/src/Model/Cardquery200ResponseHistoryInner.php new file mode 100644 index 0000000..c0133af --- /dev/null +++ b/src/Model/Cardquery200ResponseHistoryInner.php @@ -0,0 +1,541 @@ + + */ +class Cardquery200ResponseHistoryInner implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'cardquery_200_response_history_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'orerRef' => 'string', + 'transactionId' => 'float', + 'status' => '\Cone\SimplePay\Model\TransactionStatus', + 'paymentDate' => 'string', + 'finishDate' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'orerRef' => null, + 'transactionId' => null, + 'status' => null, + 'paymentDate' => null, + 'finishDate' => null, + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'orerRef' => false, + 'transactionId' => false, + 'status' => false, + 'paymentDate' => false, + 'finishDate' => 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 = [ + 'orerRef' => 'orerRef', + 'transactionId' => 'transactionId', + 'status' => 'status', + 'paymentDate' => 'paymentDate', + 'finishDate' => 'finishDate', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'orerRef' => 'setOrerRef', + 'transactionId' => 'setTransactionId', + 'status' => 'setStatus', + 'paymentDate' => 'setPaymentDate', + 'finishDate' => 'setFinishDate', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'orerRef' => 'getOrerRef', + 'transactionId' => 'getTransactionId', + 'status' => 'getStatus', + 'paymentDate' => 'getPaymentDate', + 'finishDate' => 'getFinishDate', + ]; + + /** + * 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('orerRef', $data ?? [], null); + $this->setIfExists('transactionId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('paymentDate', $data ?? [], null); + $this->setIfExists('finishDate', $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 orerRef + * + * @return string|null + */ + public function getOrerRef(): ?string + { + return $this->container['orerRef']; + } + + /** + * Sets orerRef + * + * @param string|null $orerRef orerRef + * + * @return $this + */ + public function setOrerRef(?string $orerRef): static + { + if (is_null($orerRef)) { + throw new InvalidArgumentException('non-nullable orerRef cannot be null'); + } + $this->container['orerRef'] = $orerRef; + + return $this; + } + + /** + * Gets transactionId + * + * @return float|null + */ + public function getTransactionId(): ?float + { + return $this->container['transactionId']; + } + + /** + * Sets transactionId + * + * @param float|null $transactionId transactionId + * + * @return $this + */ + public function setTransactionId(?float $transactionId): static + { + if (is_null($transactionId)) { + throw new InvalidArgumentException('non-nullable transactionId cannot be null'); + } + $this->container['transactionId'] = $transactionId; + + return $this; + } + + /** + * Gets status + * + * @return \Cone\SimplePay\Model\TransactionStatus|null + */ + public function getStatus(): ?\Cone\SimplePay\Model\TransactionStatus + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Cone\SimplePay\Model\TransactionStatus|null $status status + * + * @return $this + */ + public function setStatus(?\Cone\SimplePay\Model\TransactionStatus $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets paymentDate + * + * @return string|null + */ + public function getPaymentDate(): ?string + { + return $this->container['paymentDate']; + } + + /** + * Sets paymentDate + * + * @param string|null $paymentDate The ISO 8601 format of the payment date. + * + * @return $this + */ + public function setPaymentDate(?string $paymentDate): static + { + if (is_null($paymentDate)) { + throw new InvalidArgumentException('non-nullable paymentDate cannot be null'); + } + $this->container['paymentDate'] = $paymentDate; + + return $this; + } + + /** + * Gets finishDate + * + * @return string|null + */ + public function getFinishDate(): ?string + { + return $this->container['finishDate']; + } + + /** + * Sets finishDate + * + * @param string|null $finishDate The ISO 8601 format of the finish date. + * + * @return $this + */ + public function setFinishDate(?string $finishDate): static + { + if (is_null($finishDate)) { + throw new InvalidArgumentException('non-nullable finishDate cannot be null'); + } + $this->container['finishDate'] = $finishDate; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/src/Model/Query200ResponseTransactionsInner.php b/src/Model/Query200ResponseTransactionsInner.php index b136b12..e3cc2b0 100644 --- a/src/Model/Query200ResponseTransactionsInner.php +++ b/src/Model/Query200ResponseTransactionsInner.php @@ -74,7 +74,7 @@ class Query200ResponseTransactionsInner implements ModelInterface, ArrayAccess, 'invoice' => '\Cone\SimplePay\Model\Invoice', 'delivery' => '\Cone\SimplePay\Model\Delivery', 'transactionId' => 'float', - 'status' => '\Cone\SimplePay\Model\Status', + 'status' => '\Cone\SimplePay\Model\TransactionStatus', 'resultCode' => 'string', 'refundStatus' => '\Cone\SimplePay\Model\RefundStatus', 'refunds' => '\Cone\SimplePay\Model\Query200ResponseTransactionsInnerRefundsInner[]', @@ -876,9 +876,9 @@ public function setTransactionId(?float $transactionId): static /** * Gets status * - * @return \Cone\SimplePay\Model\Status|null + * @return \Cone\SimplePay\Model\TransactionStatus|null */ - public function getStatus(): ?\Cone\SimplePay\Model\Status + public function getStatus(): ?\Cone\SimplePay\Model\TransactionStatus { return $this->container['status']; } @@ -886,11 +886,11 @@ public function getStatus(): ?\Cone\SimplePay\Model\Status /** * Sets status * - * @param \Cone\SimplePay\Model\Status|null $status status + * @param \Cone\SimplePay\Model\TransactionStatus|null $status status * * @return $this */ - public function setStatus(?\Cone\SimplePay\Model\Status $status): static + public function setStatus(?\Cone\SimplePay\Model\TransactionStatus $status): static { if (is_null($status)) { throw new InvalidArgumentException('non-nullable status cannot be null'); diff --git a/src/Model/Query200ResponseTransactionsInnerRefundsInner.php b/src/Model/Query200ResponseTransactionsInnerRefundsInner.php index 7f34c55..7bfb73f 100644 --- a/src/Model/Query200ResponseTransactionsInnerRefundsInner.php +++ b/src/Model/Query200ResponseTransactionsInnerRefundsInner.php @@ -61,7 +61,7 @@ class Query200ResponseTransactionsInnerRefundsInner implements ModelInterface, A 'transactionId' => 'float', 'refundTotal' => 'float', 'refundDate' => 'string', - 'status' => '\Cone\SimplePay\Model\Status', + 'status' => '\Cone\SimplePay\Model\TransactionStatus', ]; /** @@ -392,9 +392,9 @@ public function setRefundDate(?string $refundDate): static /** * Gets status * - * @return \Cone\SimplePay\Model\Status|null + * @return \Cone\SimplePay\Model\TransactionStatus|null */ - public function getStatus(): ?\Cone\SimplePay\Model\Status + public function getStatus(): ?\Cone\SimplePay\Model\TransactionStatus { return $this->container['status']; } @@ -402,11 +402,11 @@ public function getStatus(): ?\Cone\SimplePay\Model\Status /** * Sets status * - * @param \Cone\SimplePay\Model\Status|null $status status + * @param \Cone\SimplePay\Model\TransactionStatus|null $status status * * @return $this */ - public function setStatus(?\Cone\SimplePay\Model\Status $status): static + public function setStatus(?\Cone\SimplePay\Model\TransactionStatus $status): static { if (is_null($status)) { throw new InvalidArgumentException('non-nullable status cannot be null'); diff --git a/src/Model/Status.php b/src/Model/TransactionStatus.php similarity index 91% rename from src/Model/Status.php rename to src/Model/TransactionStatus.php index 3f9bc0a..b19d0e5 100644 --- a/src/Model/Status.php +++ b/src/Model/TransactionStatus.php @@ -1,7 +1,7 @@ 'string', 'merchant' => 'string', 'orderRef' => 'string', - 'status' => '\Cone\SimplePay\Model\Status', + 'status' => '\Cone\SimplePay\Model\TransactionStatus', 'transactionId' => 'float', ]; @@ -399,9 +399,9 @@ public function setOrderRef(?string $orderRef): static /** * Gets status * - * @return \Cone\SimplePay\Model\Status|null + * @return \Cone\SimplePay\Model\TransactionStatus|null */ - public function getStatus(): ?\Cone\SimplePay\Model\Status + public function getStatus(): ?\Cone\SimplePay\Model\TransactionStatus { return $this->container['status']; } @@ -409,11 +409,11 @@ public function getStatus(): ?\Cone\SimplePay\Model\Status /** * Sets status * - * @param \Cone\SimplePay\Model\Status|null $status status + * @param \Cone\SimplePay\Model\TransactionStatus|null $status status * * @return $this */ - public function setStatus(?\Cone\SimplePay\Model\Status $status): static + public function setStatus(?\Cone\SimplePay\Model\TransactionStatus $status): static { if (is_null($status)) { throw new InvalidArgumentException('non-nullable status cannot be null'); diff --git a/tests/Api/TransactionApiTest.php b/tests/Api/TransactionApiTest.php index f4969df..09a1673 100644 --- a/tests/Api/TransactionApiTest.php +++ b/tests/Api/TransactionApiTest.php @@ -80,6 +80,30 @@ public function testCallDo() self::markTestIncomplete('Not implemented'); } + /** + * Test case for cardcancel + * + * Cancel a saved card. + * + */ + public function testCardcancel() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for cardquery + * + * Query a saved card. + * + */ + public function testCardquery() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + /** * Test case for dorecurring * diff --git a/tests/Model/CardCancelTest.php b/tests/Model/CardCancelTest.php new file mode 100644 index 0000000..adf33e4 --- /dev/null +++ b/tests/Model/CardCancelTest.php @@ -0,0 +1,87 @@ +