From a3b3497a910a26f148a3d6d47875fe0dc129a2d6 Mon Sep 17 00:00:00 2001 From: Wang Zunjiao Date: Wed, 30 Jul 2025 04:01:32 +0000 Subject: [PATCH] [reformat][antom-sdk-automation] automated change --- Api/DefaultApi.php | 0 ApiException.php | 121 ++ Configuration.php | 522 +++++++ HeaderSelector.php | 109 ++ ObjectSerializer.php | 315 ++++ model/AccountBalance.php | 549 +++++++ model/AccountHolderType.php | 29 +- model/AccountType.php | 28 +- model/AcquirerInfo.php | 522 ++++++- model/Address.php | 540 ++++++- model/AgreementInfo.php | 459 +++++- model/Amount.php | 427 ++++- model/AmountLimit.php | 455 +++++- model/AssociationType.php | 35 +- model/Attachment.php | 475 +++++- model/AttachmentType.php | 59 +- model/AuthCodeForm.php | 413 +++++ model/AuthMetaData.php | 426 ++++- model/AvailablePaymentMethod.php | 395 ++++- model/BrowserInfo.php | 485 +++++- model/BusinessInfo.php | 558 ++++++- model/Buyer.php | 538 ++++++- model/CardBrand.php | 60 +- model/CardInfo.php | 596 +++++++ model/CardPaymentMethodDetail.php | 1375 ++++++++++++++--- model/CardVerificationResult.php | 583 +++++++ model/Certificate.php | 508 +++++- model/CertificateType.php | 41 +- model/ChallengeActionForm.php | 471 +++++- model/ChallengeTriggerSourceType.php | 29 +- model/ChallengeType.php | 31 +- model/ClassType.php | 30 +- model/CodeDetail.php | 456 +++++- model/CodeValueType.php | 30 +- model/Company.php | 672 +++++++- model/CompanyType.php | 48 +- model/CompanyUnitType.php | 28 +- model/Contact.php | 521 ++++++- model/ContactType.php | 80 +- model/CouponPaymentMethodDetail.php | 523 ++++++- model/CreditPayFeeType.php | 28 +- model/CreditPayPlan.php | 472 +++++- model/CustomerBelongsTo.php | 79 +- model/CustomizedInfo.php | 534 +++++++ model/DeliveryEstimate.php | 441 ++++++ model/DeliveryEstimateInfo.php | 447 ++++++ model/Discount.php | 465 +++++- model/DiscountPaymentMethodDetail.php | 496 +++++- model/DisplayType.php | 34 +- model/DisputeEvidenceFormatType.php | 30 +- model/DisputeEvidenceType.php | 28 +- model/EntityAssociations.php | 508 +++++- model/Env.php | 857 ++++++++-- model/ExternalPaymentMethodDetail.php | 471 +++++- model/Gaming.php | 477 +++++- model/Goods.php | 649 +++++++- model/GrantType.php | 29 +- model/InStorePaymentScenario.php | 33 +- model/Individual.php | 552 ++++++- model/Installment.php | 447 ++++++ model/InterestFree.php | 580 +++++++ model/Leg.php | 588 ++++++- model/LegalEntityType.php | 30 +- model/Lodging.php | 556 ++++++- model/Logo.php | 424 ++++- model/Merchant.php | 589 ++++++- model/MerchantInfo.php | 542 ++++++- model/MerchantType.php | 28 +- model/ModelInterface.php | 92 ++ model/MpiData.php | 503 ++++++ model/ObjectSerializer.php | 315 ++++ model/Order.php | 723 +++++++-- model/OrderCodeForm.php | 477 +++++- model/OrderInfo.php | 401 ++++- model/OsType.php | 29 +- model/Passenger.php | 472 +++++- model/PaymentFactor.php | 495 +++++- model/PaymentMethod.php | 519 ++++++- model/PaymentMethodCategoryType.php | 35 +- model/PaymentMethodDetail.php | 608 +++++++- model/PaymentMethodDetailType.php | 33 +- model/PaymentMethodInfo.php | 494 +++++- model/PaymentMethodTypeItem.php | 444 +++++- model/PaymentOption.php | 751 ++++++++- model/PaymentOptionDetail.php | 478 ++++++ model/PaymentResultInfo.php | 910 +++++++++-- model/PaymentVerificationData.php | 423 ++++- model/PeriodRule.php | 427 ++++- model/Plan.php | 580 +++++++ model/PresentmentMode.php | 32 +- model/ProductCodeType.php | 32 +- model/PromotionInfo.php | 475 ++++++ model/PromotionResult.php | 444 ++++++ model/PromotionType.php | 31 + model/PspCustomerInfo.php | 516 ++++++- model/Quote.php | 525 ++++++- model/RedirectActionForm.php | 483 +++++- model/RefundDetail.php | 447 ++++++ model/RefundFromType.php | 32 + model/Result.php | 455 +++++- model/ResultStatusType.php | 30 +- model/RiskAddress.php | 549 +++++++ model/RiskBuyer.php | 515 ++++++ model/RiskData.php | 565 +++++++ model/RiskEnv.php | 413 +++++ model/RiskOrder.php | 447 ++++++ model/RiskSignal.php | 447 ++++++ model/RiskThreeDSResult.php | 515 ++++++ model/ScopeType.php | 40 +- model/SettleToType.php | 28 +- model/SettlementBankAccount.php | 702 ++++++++- model/SettlementDetail.php | 431 +++++- model/SettlementInfo.php | 429 ++++- model/SettlementStrategy.php | 396 ++++- model/Shipping.php | 602 +++++++- model/StockInfo.php | 428 ++++- model/Store.php | 590 ++++++- model/SupportBank.php | 472 ++++++ model/SupportCardBrand.php | 447 ++++++ model/TerminalType.php | 36 +- model/ThreeDSResult.php | 498 +++++- model/Transaction.php | 592 ++++++- model/TransactionStatusType.php | 31 +- model/TransactionType.php | 36 +- model/TransferFromDetail.php | 432 +++++- model/TransferToDetail.php | 565 ++++++- model/Transit.php | 451 +++++- model/TransitType.php | 33 +- model/Trial.php | 452 +++++- model/UserName.php | 470 +++++- model/Wallet.php | 534 +++++++ model/WebSite.php | 470 +++++- request/auth/AlipayAuthApplyTokenRequest.php | 524 ++++++- request/auth/AlipayAuthConsultRequest.php | 689 ++++++++- request/auth/AlipayAuthRevokeTokenRequest.php | 423 ++++- .../dispute/AlipayAcceptDisputeRequest.php | 400 ++++- .../AlipayDownloadDisputeEvidenceRequest.php | 430 +++++- .../AlipaySupplyDefenseDocumentRequest.php | 431 +++++- .../marketplace/AlipayCreatePayoutRequest.php | 457 +++++- .../AlipayCreateTransferRequest.php | 457 +++++- .../AlipayInquireBalanceRequest.php | 400 ++++- request/marketplace/AlipayRegisterRequest.php | 487 +++++- request/marketplace/AlipaySettleRequest.php | 456 +++++- .../AlipaySettlementInfoUpdateRequest.php | 489 +++++- .../AlipaySubmitAttachmentRequest.php | 459 +++++- request/pay/AlipayCaptureRequest.php | 475 +++++- request/pay/AlipayInquiryRefundRequest.php | 444 +++++- request/pay/AlipayPayCancelRequest.php | 442 +++++- request/pay/AlipayPayConsultRequest.php | 821 ++++++++-- request/pay/AlipayPayQueryRequest.php | 442 +++++- request/pay/AlipayPayRequest.php | 984 ++++++++++-- request/pay/AlipayPaymentSessionRequest.php | 894 +++++++++-- request/pay/AlipayRefundRequest.php | 630 +++++++- .../AlipayVaultingPaymentMethodRequest.php | 674 ++++++++ request/pay/AlipayVaultingQueryRequest.php | 414 +++++ request/pay/AlipayVaultingSessionRequest.php | 575 +++++++ .../AmsApiV1PaymentsCapturePostRequest.php | 513 ++++++ ...sApiV1PaymentsInquiryRefundPostRequest.php | 473 ++++++ .../AlipaySubscriptionCancelRequest.php | 451 +++++- .../AlipaySubscriptionChangeRequest.php | 620 +++++++- .../AlipaySubscriptionCreateRequest.php | 776 ++++++++-- .../AlipaySubscriptionUpdateRequest.php | 544 ++++++- .../auth/AlipayAuthApplyTokenResponse.php | 630 ++++++++ response/auth/AlipayAuthConsultResponse.php | 630 ++++++++ .../auth/AlipayAuthRevokeTokenResponse.php | 444 ++++++ .../dispute/AlipayAcceptDisputeResponse.php | 475 ++++++ .../AlipayDownloadDisputeEvidenceResponse.php | 475 ++++++ .../AlipaySupplyDefenseDocumentResponse.php | 475 ++++++ .../AlipayCreatePayoutResponse.php | 537 +++++++ .../AlipayCreateTransferResponse.php | 540 +++++++ .../AlipayInquireBalanceResponse.php | 447 ++++++ .../marketplace/AlipayRegisterResponse.php | 441 ++++++ response/marketplace/AlipaySettleResponse.php | 478 ++++++ .../AlipaySettlementInfoUpdateResponse.php | 441 ++++++ .../AlipaySubmitAttachmentResponse.php | 506 ++++++ response/pay/AlipayCaptureResponse.php | 599 +++++++ response/pay/AlipayInquiryRefundResponse.php | 661 ++++++++ response/pay/AlipayPayCancelResponse.php | 506 ++++++ response/pay/AlipayPayConsultResponse.php | 506 ++++++ response/pay/AlipayPayQueryResponse.php | 1281 +++++++++++++++ response/pay/AlipayPayResponse.php | 1188 ++++++++++++++ response/pay/AlipayPaymentSessionResponse.php | 546 +++++++ response/pay/AlipayRefundResponse.php | 723 +++++++++ .../AlipayVaultingPaymentMethodResponse.php | 571 +++++++ response/pay/AlipayVaultingQueryResponse.php | 602 ++++++++ .../pay/AlipayVaultingSessionResponse.php | 512 ++++++ .../AlipaySubscriptionCancelResponse.php | 413 +++++ .../AlipaySubscriptionChangeResponse.php | 413 +++++ .../AlipaySubscriptionCreateResponse.php | 537 +++++++ .../AlipaySubscriptionUpdateResponse.php | 413 +++++ 190 files changed, 77864 insertions(+), 3683 deletions(-) create mode 100644 Api/DefaultApi.php create mode 100644 ApiException.php create mode 100644 Configuration.php create mode 100644 HeaderSelector.php create mode 100644 ObjectSerializer.php create mode 100644 model/AccountBalance.php create mode 100644 model/AuthCodeForm.php create mode 100644 model/CardInfo.php create mode 100644 model/CardVerificationResult.php create mode 100644 model/CustomizedInfo.php create mode 100644 model/DeliveryEstimate.php create mode 100644 model/DeliveryEstimateInfo.php create mode 100644 model/Installment.php create mode 100644 model/InterestFree.php create mode 100644 model/ModelInterface.php create mode 100644 model/MpiData.php create mode 100644 model/ObjectSerializer.php create mode 100644 model/PaymentOptionDetail.php create mode 100644 model/Plan.php create mode 100644 model/PromotionInfo.php create mode 100644 model/PromotionResult.php create mode 100644 model/PromotionType.php create mode 100644 model/RefundDetail.php create mode 100644 model/RefundFromType.php create mode 100644 model/RiskAddress.php create mode 100644 model/RiskBuyer.php create mode 100644 model/RiskData.php create mode 100644 model/RiskEnv.php create mode 100644 model/RiskOrder.php create mode 100644 model/RiskSignal.php create mode 100644 model/RiskThreeDSResult.php create mode 100644 model/SupportBank.php create mode 100644 model/SupportCardBrand.php create mode 100644 model/Wallet.php create mode 100644 request/pay/AlipayVaultingPaymentMethodRequest.php create mode 100644 request/pay/AlipayVaultingQueryRequest.php create mode 100644 request/pay/AlipayVaultingSessionRequest.php create mode 100644 request/pay/AmsApiV1PaymentsCapturePostRequest.php create mode 100644 request/pay/AmsApiV1PaymentsInquiryRefundPostRequest.php create mode 100644 response/auth/AlipayAuthApplyTokenResponse.php create mode 100644 response/auth/AlipayAuthConsultResponse.php create mode 100644 response/auth/AlipayAuthRevokeTokenResponse.php create mode 100644 response/dispute/AlipayAcceptDisputeResponse.php create mode 100644 response/dispute/AlipayDownloadDisputeEvidenceResponse.php create mode 100644 response/dispute/AlipaySupplyDefenseDocumentResponse.php create mode 100644 response/marketplace/AlipayCreatePayoutResponse.php create mode 100644 response/marketplace/AlipayCreateTransferResponse.php create mode 100644 response/marketplace/AlipayInquireBalanceResponse.php create mode 100644 response/marketplace/AlipayRegisterResponse.php create mode 100644 response/marketplace/AlipaySettleResponse.php create mode 100644 response/marketplace/AlipaySettlementInfoUpdateResponse.php create mode 100644 response/marketplace/AlipaySubmitAttachmentResponse.php create mode 100644 response/pay/AlipayCaptureResponse.php create mode 100644 response/pay/AlipayInquiryRefundResponse.php create mode 100644 response/pay/AlipayPayCancelResponse.php create mode 100644 response/pay/AlipayPayConsultResponse.php create mode 100644 response/pay/AlipayPayQueryResponse.php create mode 100644 response/pay/AlipayPayResponse.php create mode 100644 response/pay/AlipayPaymentSessionResponse.php create mode 100644 response/pay/AlipayRefundResponse.php create mode 100644 response/pay/AlipayVaultingPaymentMethodResponse.php create mode 100644 response/pay/AlipayVaultingQueryResponse.php create mode 100644 response/pay/AlipayVaultingSessionResponse.php create mode 100644 response/subscription/AlipaySubscriptionCancelResponse.php create mode 100644 response/subscription/AlipaySubscriptionChangeResponse.php create mode 100644 response/subscription/AlipaySubscriptionCreateResponse.php create mode 100644 response/subscription/AlipaySubscriptionUpdateResponse.php diff --git a/Api/DefaultApi.php b/Api/DefaultApi.php new file mode 100644 index 0000000..e69de29 diff --git a/ApiException.php b/ApiException.php new file mode 100644 index 0000000..c579f3e --- /dev/null +++ b/ApiException.php @@ -0,0 +1,121 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/Configuration.php b/Configuration.php new file mode 100644 index 0000000..4942568 --- /dev/null +++ b/Configuration.php @@ -0,0 +1,522 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormatForQueryString Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (request) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://open-sea-global.alipay.com/ams/api/v1/vaults/createVaultingSession", + "description" => "正式环境", + ] + ]; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + if (null === $variables) { + $variables = []; + } + + $hosts = $this->getHostSettings(); + + // check array index out of bound + if ($index < 0 || $index >= sizeof($hosts)) { + throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + } + + $host = $hosts[$index]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } +} diff --git a/HeaderSelector.php b/HeaderSelector.php new file mode 100644 index 0000000..0b44c60 --- /dev/null +++ b/HeaderSelector.php @@ -0,0 +1,109 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { + return implode(',', $jsonAccept); + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} diff --git a/ObjectSerializer.php b/ObjectSerializer.php new file mode 100644 index 0000000..b1eceae --- /dev/null +++ b/ObjectSerializer.php @@ -0,0 +1,315 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\request\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } +} diff --git a/model/AccountBalance.php b/model/AccountBalance.php new file mode 100644 index 0000000..aa79247 --- /dev/null +++ b/model/AccountBalance.php @@ -0,0 +1,549 @@ + + */ +class AccountBalance implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AccountBalance'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'accountNo' => 'string', + 'currency' => 'string', + 'availableBalance' => '\request\model\Amount', + 'frozenBalance' => '\request\model\Amount', + 'totalBalance' => '\request\model\Amount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'accountNo' => null, + 'currency' => null, + 'availableBalance' => null, + 'frozenBalance' => null, + 'totalBalance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'accountNo' => false, + 'currency' => false, + 'availableBalance' => false, + 'frozenBalance' => false, + 'totalBalance' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'accountNo' => 'accountNo', + 'currency' => 'currency', + 'availableBalance' => 'availableBalance', + 'frozenBalance' => 'frozenBalance', + 'totalBalance' => 'totalBalance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'accountNo' => 'setAccountNo', + 'currency' => 'setCurrency', + 'availableBalance' => 'setAvailableBalance', + 'frozenBalance' => 'setFrozenBalance', + 'totalBalance' => 'setTotalBalance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'accountNo' => 'getAccountNo', + 'currency' => 'getCurrency', + 'availableBalance' => 'getAvailableBalance', + 'frozenBalance' => 'getFrozenBalance', + 'totalBalance' => 'getTotalBalance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('accountNo', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('availableBalance', $data ?? [], null); + $this->setIfExists('frozenBalance', $data ?? [], null); + $this->setIfExists('totalBalance', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['accountNo'] === null) { + $invalidProperties[] = "'accountNo' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['availableBalance'] === null) { + $invalidProperties[] = "'availableBalance' can't be null"; + } + if ($this->container['frozenBalance'] === null) { + $invalidProperties[] = "'frozenBalance' can't be null"; + } + if ($this->container['totalBalance'] === null) { + $invalidProperties[] = "'totalBalance' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets accountNo + * + * @return string + */ + public function getAccountNo() + { + return $this->container['accountNo']; + } + + /** + * Sets accountNo + * + * @param string $accountNo The balance account number. More information: Maximum length: 32 characters + * + * @return self + */ + public function setAccountNo($accountNo) + { + $this->container['accountNo'] = $accountNo; + + return $this; + } + + /** + * Gets currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency The currency associated with the balance account. The value of this parameter is a 3-letter currency code that follows the ISO 4217 standard. More information: Maximum length: 3 characters + * + * @return self + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets availableBalance + * + * @return \request\model\Amount + */ + public function getAvailableBalance() + { + return $this->container['availableBalance']; + } + + /** + * Sets availableBalance + * + * @param \request\model\Amount $availableBalance availableBalance + * + * @return self + */ + public function setAvailableBalance($availableBalance) + { + $this->container['availableBalance'] = $availableBalance; + + return $this; + } + + /** + * Gets frozenBalance + * + * @return \request\model\Amount + */ + public function getFrozenBalance() + { + return $this->container['frozenBalance']; + } + + /** + * Sets frozenBalance + * + * @param \request\model\Amount $frozenBalance frozenBalance + * + * @return self + */ + public function setFrozenBalance($frozenBalance) + { + $this->container['frozenBalance'] = $frozenBalance; + + return $this; + } + + /** + * Gets totalBalance + * + * @return \request\model\Amount + */ + public function getTotalBalance() + { + return $this->container['totalBalance']; + } + + /** + * Sets totalBalance + * + * @param \request\model\Amount $totalBalance totalBalance + * + * @return self + */ + public function setTotalBalance($totalBalance) + { + $this->container['totalBalance'] = $totalBalance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/AccountHolderType.php b/model/AccountHolderType.php index ed2bc9c..7586dbb 100644 --- a/model/AccountHolderType.php +++ b/model/AccountHolderType.php @@ -1,10 +1,31 @@ + */ +class AcquirerInfo implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AcquirerInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acquirerName' => 'string', + 'referenceRequestId' => 'string', + 'acquirerTransactionId' => 'string', + 'acquirerMerchantId' => 'string', + 'acquirerResultCode' => 'string', + 'acquirerResultMessage' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acquirerName' => null, + 'referenceRequestId' => null, + 'acquirerTransactionId' => null, + 'acquirerMerchantId' => null, + 'acquirerResultCode' => null, + 'acquirerResultMessage' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'acquirerName' => false, + 'referenceRequestId' => false, + 'acquirerTransactionId' => false, + 'acquirerMerchantId' => false, + 'acquirerResultCode' => false, + 'acquirerResultMessage' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } - public $acquirerName; + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $referenceRequestId; + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - public $acquirerTransactionId; + /** + * 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); + } - public $acquirerMerchantId; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'acquirerName' => 'acquirerName', + 'referenceRequestId' => 'referenceRequestId', + 'acquirerTransactionId' => 'acquirerTransactionId', + 'acquirerMerchantId' => 'acquirerMerchantId', + 'acquirerResultCode' => 'acquirerResultCode', + 'acquirerResultMessage' => 'acquirerResultMessage' + ]; - public $acquirerResultCode; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acquirerName' => 'setAcquirerName', + 'referenceRequestId' => 'setReferenceRequestId', + 'acquirerTransactionId' => 'setAcquirerTransactionId', + 'acquirerMerchantId' => 'setAcquirerMerchantId', + 'acquirerResultCode' => 'setAcquirerResultCode', + 'acquirerResultMessage' => 'setAcquirerResultMessage' + ]; - public $acquirerResultMessage; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acquirerName' => 'getAcquirerName', + 'referenceRequestId' => 'getReferenceRequestId', + 'acquirerTransactionId' => 'getAcquirerTransactionId', + 'acquirerMerchantId' => 'getAcquirerMerchantId', + 'acquirerResultCode' => 'getAcquirerResultCode', + 'acquirerResultMessage' => 'getAcquirerResultMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } /** - * @return mixed + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('acquirerName', $data ?? [], null); + $this->setIfExists('referenceRequestId', $data ?? [], null); + $this->setIfExists('acquirerTransactionId', $data ?? [], null); + $this->setIfExists('acquirerMerchantId', $data ?? [], null); + $this->setIfExists('acquirerResultCode', $data ?? [], null); + $this->setIfExists('acquirerResultMessage', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acquirerName + * + * @return string|null */ public function getAcquirerName() { - return $this->acquirerName; + return $this->container['acquirerName']; } /** - * @param mixed $acquirerName + * Sets acquirerName + * + * @param string|null $acquirerName The name of the acquirer. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + * + * @return self */ - public function setAcquirerName($acquirerName) + public function setAcquirerName($acquirerName) { - $this->acquirerName = $acquirerName; + $this->container['acquirerName'] = $acquirerName; + + return $this; } /** - * @return mixed + * Gets referenceRequestId + * + * @return string|null */ public function getReferenceRequestId() { - return $this->referenceRequestId; + return $this->container['referenceRequestId']; } /** - * @param mixed $referenceRequestId + * Sets referenceRequestId + * + * @param string|null $referenceRequestId The unique ID that is assigned by APO to identify a payment request sent to the acquirer. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + * + * @return self */ - public function setReferenceRequestId($referenceRequestId) + public function setReferenceRequestId($referenceRequestId) { - $this->referenceRequestId = $referenceRequestId; + $this->container['referenceRequestId'] = $referenceRequestId; + + return $this; } /** - * @return mixed + * Gets acquirerTransactionId + * + * @return string|null */ public function getAcquirerTransactionId() { - return $this->acquirerTransactionId; + return $this->container['acquirerTransactionId']; } /** - * @param mixed $acquirerTransactionId + * Sets acquirerTransactionId + * + * @param string|null $acquirerTransactionId The unique ID that is assigned by the acquirer to identify a transaction. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + * + * @return self */ - public function setAcquirerTransactionId($acquirerTransactionId) + public function setAcquirerTransactionId($acquirerTransactionId) { - $this->acquirerTransactionId = $acquirerTransactionId; + $this->container['acquirerTransactionId'] = $acquirerTransactionId; + + return $this; } /** - * @return mixed + * Gets acquirerMerchantId + * + * @return string|null */ public function getAcquirerMerchantId() { - return $this->acquirerMerchantId; + return $this->container['acquirerMerchantId']; } /** - * @param mixed $acquirerMerchantId + * Sets acquirerMerchantId + * + * @param string|null $acquirerMerchantId The unique ID that is assigned by the acquirer to identify a merchant. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + * + * @return self */ - public function setAcquirerMerchantId($acquirerMerchantId) + public function setAcquirerMerchantId($acquirerMerchantId) { - $this->acquirerMerchantId = $acquirerMerchantId; + $this->container['acquirerMerchantId'] = $acquirerMerchantId; + + return $this; } /** - * @return mixed + * Gets acquirerResultCode + * + * @return string|null */ public function getAcquirerResultCode() { - return $this->acquirerResultCode; + return $this->container['acquirerResultCode']; } /** - * @param mixed $acquirerResultCode + * Sets acquirerResultCode + * + * @param string|null $acquirerResultCode The acquirer's result code that indicates the transaction process result. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + * + * @return self */ - public function setAcquirerResultCode($acquirerResultCode) + public function setAcquirerResultCode($acquirerResultCode) { - $this->acquirerResultCode = $acquirerResultCode; + $this->container['acquirerResultCode'] = $acquirerResultCode; + + return $this; } /** - * @return mixed + * Gets acquirerResultMessage + * + * @return string|null */ public function getAcquirerResultMessage() { - return $this->acquirerResultMessage; + return $this->container['acquirerResultMessage']; + } + + /** + * Sets acquirerResultMessage + * + * @param string|null $acquirerResultMessage The result message that describes acquirerResultCode in detail. Note: This parameter is returned if you integrate the APO product. More information: Maximum length: 64 characters + * + * @return self + */ + public function setAcquirerResultMessage($acquirerResultMessage) + { + $this->container['acquirerResultMessage'] = $acquirerResultMessage; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $acquirerResultMessage + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setAcquirerResultMessage($acquirerResultMessage) + public function offsetSet($offset, $value): void { - $this->acquirerResultMessage = $acquirerResultMessage; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Address.php b/model/Address.php index e6239b7..d88554f 100644 --- a/model/Address.php +++ b/model/Address.php @@ -1,130 +1,596 @@ + */ +class Address implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Address'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'region' => 'string', + 'state' => 'string', + 'city' => 'string', + 'address1' => 'string', + 'address2' => 'string', + 'zipCode' => 'string', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'region' => null, + 'state' => null, + 'city' => null, + 'address1' => null, + 'address2' => null, + 'zipCode' => null, + 'label' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'region' => false, + 'state' => false, + 'city' => false, + 'address1' => false, + 'address2' => false, + 'zipCode' => false, + 'label' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'region' => 'region', + 'state' => 'state', + 'city' => 'city', + 'address1' => 'address1', + 'address2' => 'address2', + 'zipCode' => 'zipCode', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'region' => 'setRegion', + 'state' => 'setState', + 'city' => 'setCity', + 'address1' => 'setAddress1', + 'address2' => 'setAddress2', + 'zipCode' => 'setZipCode', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'region' => 'getRegion', + 'state' => 'getState', + 'city' => 'getCity', + 'address1' => 'getAddress1', + 'address2' => 'getAddress2', + 'zipCode' => 'getZipCode', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $region; - public $state; - public $city; - public $address1; - public $address2; - public $zipCode; - public $label; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return String + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('region', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('address1', $data ?? [], null); + $this->setIfExists('address2', $data ?? [], null); + $this->setIfExists('zipCode', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets region + * + * @return string|null */ public function getRegion() { - return $this->region; + return $this->container['region']; } /** - * @param String $region + * Sets region + * + * @param string|null $region region + * + * @return self */ public function setRegion($region) { - $this->region = $region; + $this->container['region'] = $region; + + return $this; } /** - * @return String + * Gets state + * + * @return string|null */ public function getState() { - return $this->state; + return $this->container['state']; } /** - * @param String $state + * Sets state + * + * @param string|null $state state + * + * @return self */ public function setState($state) { - $this->state = $state; + $this->container['state'] = $state; + + return $this; } /** - * @return String + * Gets city + * + * @return string|null */ public function getCity() { - return $this->city; + return $this->container['city']; } /** - * @param mixed $city + * Sets city + * + * @param string|null $city city + * + * @return self */ public function setCity($city) { - $this->city = $city; + $this->container['city'] = $city; + + return $this; } /** - * @return Address + * Gets address1 + * + * @return string|null */ public function getAddress1() { - return $this->address1; + return $this->container['address1']; } /** - * @param Address $address1 + * Sets address1 + * + * @param string|null $address1 address1 + * + * @return self */ public function setAddress1($address1) { - $this->address1 = $address1; + $this->container['address1'] = $address1; + + return $this; } /** - * @return Address + * Gets address2 + * + * @return string|null */ public function getAddress2() { - return $this->address2; + return $this->container['address2']; } /** - * @param Address $address2 + * Sets address2 + * + * @param string|null $address2 address2 + * + * @return self */ public function setAddress2($address2) { - $this->address2 = $address2; + $this->container['address2'] = $address2; + + return $this; } /** - * @return String + * Gets zipCode + * + * @return string|null */ public function getZipCode() { - return $this->zipCode; + return $this->container['zipCode']; } /** - * @param String $zipCode + * Sets zipCode + * + * @param string|null $zipCode zipCode + * + * @return self */ public function setZipCode($zipCode) { - $this->zipCode = $zipCode; + $this->container['zipCode'] = $zipCode; + + return $this; } /** - * @return mixed + * Gets label + * + * @return string|null */ public function getLabel() { - return $this->label; + return $this->container['label']; } /** - * @param mixed $label + * Sets label + * + * @param string|null $label label + * + * @return self */ public function setLabel($label) { - $this->label = $label; + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/AgreementInfo.php b/model/AgreementInfo.php index f336fe9..c7554d4 100644 --- a/model/AgreementInfo.php +++ b/model/AgreementInfo.php @@ -1,88 +1,503 @@ + */ +class AgreementInfo implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AgreementInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'authState' => 'string', + 'userLoginId' => 'string', + 'userLoginType' => 'string', + 'displayUserLoginId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'authState' => null, + 'userLoginId' => null, + 'userLoginType' => null, + 'displayUserLoginId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'authState' => false, + 'userLoginId' => false, + 'userLoginType' => false, + 'displayUserLoginId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'authState' => 'authState', + 'userLoginId' => 'userLoginId', + 'userLoginType' => 'userLoginType', + 'displayUserLoginId' => 'displayUserLoginId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'authState' => 'setAuthState', + 'userLoginId' => 'setUserLoginId', + 'userLoginType' => 'setUserLoginType', + 'displayUserLoginId' => 'setDisplayUserLoginId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'authState' => 'getAuthState', + 'userLoginId' => 'getUserLoginId', + 'userLoginType' => 'getUserLoginType', + 'displayUserLoginId' => 'getDisplayUserLoginId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - public $authState; + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('authState', $data ?? [], null); + $this->setIfExists('userLoginId', $data ?? [], null); + $this->setIfExists('userLoginType', $data ?? [], null); + $this->setIfExists('displayUserLoginId', $data ?? [], null); - public $userLoginId; + } + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - public $userLoginType; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; - public $displayUserLoginId; + return $invalidProperties; + } + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } /** - * @return mixed + * Gets authState + * + * @return string|null */ public function getAuthState() { - return $this->authState; + return $this->container['authState']; } /** - * @param mixed $authState + * Sets authState + * + * @param string|null $authState The unique ID generated by the merchant to initiate an Easy Pay authorization + * + * @return self */ public function setAuthState($authState) { - $this->authState = $authState; + $this->container['authState'] = $authState; + + return $this; } /** - * @return mixed + * Gets userLoginId + * + * @return string|null */ public function getUserLoginId() { - return $this->userLoginId; + return $this->container['userLoginId']; } /** - * @param mixed $userLoginId + * Sets userLoginId + * + * @param string|null $userLoginId The login ID that the user used to register in the wallet + * + * @return self */ public function setUserLoginId($userLoginId) { - $this->userLoginId = $userLoginId; + $this->container['userLoginId'] = $userLoginId; + + return $this; } /** - * @return mixed + * Gets userLoginType + * + * @return string|null */ public function getUserLoginType() { - return $this->userLoginType; + return $this->container['userLoginType']; } /** - * @param mixed $userLoginType + * Sets userLoginType + * + * @param string|null $userLoginType The login Type + * + * @return self */ public function setUserLoginType($userLoginType) { - $this->userLoginType = $userLoginType; + $this->container['userLoginType'] = $userLoginType; + + return $this; } /** - * @return mixed + * Gets displayUserLoginId + * + * @return string|null */ public function getDisplayUserLoginId() { - return $this->displayUserLoginId; + return $this->container['displayUserLoginId']; } /** - * @param mixed $displayUserLoginId + * Sets displayUserLoginId + * + * @param string|null $displayUserLoginId The login ID that use to display + * + * @return self */ public function setDisplayUserLoginId($displayUserLoginId) { - $this->displayUserLoginId = $displayUserLoginId; + $this->container['displayUserLoginId'] = $displayUserLoginId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } -} \ No newline at end of file + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Amount.php b/model/Amount.php index 0198806..40ea88c 100644 --- a/model/Amount.php +++ b/model/Amount.php @@ -1,44 +1,447 @@ + */ +class Amount implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Amount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'currency' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $currency; - public $value; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } /** - * @return String + * Gets currency + * + * @return string */ public function getCurrency() { - return $this->currency; + return $this->container['currency']; } /** - * @param String $currency + * Sets currency + * + * @param string $currency currency + * + * @return self */ public function setCurrency($currency) { - $this->currency = $currency; + $this->container['currency'] = $currency; + + return $this; } /** - * @return String + * Gets value + * + * @return string */ public function getValue() { - return $this->value; + return $this->container['value']; } /** - * @param String $value + * Sets value + * + * @param string $value value + * + * @return self */ public function setValue($value) { - $this->value = $value; + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } -} \ No newline at end of file + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/AmountLimit.php b/model/AmountLimit.php index 689b3ce..fa212a4 100644 --- a/model/AmountLimit.php +++ b/model/AmountLimit.php @@ -1,60 +1,481 @@ + */ +class AmountLimit implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AmountLimit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'maxAmount' => 'string', + 'minAmount' => 'string', + 'remainAmount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'maxAmount' => null, + 'minAmount' => null, + 'remainAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'maxAmount' => false, + 'minAmount' => false, + 'remainAmount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'maxAmount' => 'maxAmount', + 'minAmount' => 'minAmount', + 'remainAmount' => 'remainAmount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'maxAmount' => 'setMaxAmount', + 'minAmount' => 'setMinAmount', + 'remainAmount' => 'setRemainAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'maxAmount' => 'getMaxAmount', + 'minAmount' => 'getMinAmount', + 'remainAmount' => 'getRemainAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('maxAmount', $data ?? [], null); + $this->setIfExists('minAmount', $data ?? [], null); + $this->setIfExists('remainAmount', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['maxAmount'] === null) { + $invalidProperties[] = "'maxAmount' can't be null"; + } + if ($this->container['minAmount'] === null) { + $invalidProperties[] = "'minAmount' can't be null"; + } + if ($this->container['remainAmount'] === null) { + $invalidProperties[] = "'remainAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } - public $maxAmount; - public $minAmount; - public $remainAmount; /** - * @return mixed + * Gets maxAmount + * + * @return string */ public function getMaxAmount() { - return $this->maxAmount; + return $this->container['maxAmount']; } /** - * @param mixed $maxAmount + * Sets maxAmount + * + * @param string $maxAmount maxAmount + * + * @return self */ public function setMaxAmount($maxAmount) { - $this->maxAmount = $maxAmount; + $this->container['maxAmount'] = $maxAmount; + + return $this; } /** - * @return mixed + * Gets minAmount + * + * @return string */ public function getMinAmount() { - return $this->minAmount; + return $this->container['minAmount']; } /** - * @param mixed $minAmount + * Sets minAmount + * + * @param string $minAmount minAmount + * + * @return self */ public function setMinAmount($minAmount) { - $this->minAmount = $minAmount; + $this->container['minAmount'] = $minAmount; + + return $this; } /** - * @return mixed + * Gets remainAmount + * + * @return string */ public function getRemainAmount() { - return $this->remainAmount; + return $this->container['remainAmount']; } /** - * @param mixed $remainAmount + * Sets remainAmount + * + * @param string $remainAmount remainAmount + * + * @return self */ public function setRemainAmount($remainAmount) { - $this->remainAmount = $remainAmount; + $this->container['remainAmount'] = $remainAmount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/AssociationType.php b/model/AssociationType.php index 0b21c15..a875270 100644 --- a/model/AssociationType.php +++ b/model/AssociationType.php @@ -1,12 +1,35 @@ + */ +class Attachment implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Attachment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attachmentType' => 'string', + 'file' => 'string', + 'attachmentName' => 'string', + 'fileKey' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attachmentType' => null, + 'file' => null, + 'attachmentName' => null, + 'fileKey' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'attachmentType' => false, + 'file' => false, + 'attachmentName' => false, + 'fileKey' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } - public $attachmentType; - public $file; - public $attachmentName; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } - public $fileKey; + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * @return mixed + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'attachmentType' => 'attachmentType', + 'file' => 'file', + 'attachmentName' => 'attachmentName', + 'fileKey' => 'fileKey' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attachmentType' => 'setAttachmentType', + 'file' => 'setFile', + 'attachmentName' => 'setAttachmentName', + 'fileKey' => 'setFileKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attachmentType' => 'getAttachmentType', + 'file' => 'getFile', + 'attachmentName' => 'getAttachmentName', + 'fileKey' => 'getFileKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('attachmentType', $data ?? [], null); + $this->setIfExists('file', $data ?? [], null); + $this->setIfExists('attachmentName', $data ?? [], null); + $this->setIfExists('fileKey', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['attachmentType'] === null) { + $invalidProperties[] = "'attachmentType' can't be null"; + } + if ($this->container['attachmentName'] === null) { + $invalidProperties[] = "'attachmentName' can't be null"; + } + if ($this->container['fileKey'] === null) { + $invalidProperties[] = "'fileKey' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets attachmentType + * + * @return string */ public function getAttachmentType() { - return $this->attachmentType; + return $this->container['attachmentType']; } /** - * @param mixed $attachmentType + * Sets attachmentType + * + * @param string $attachmentType The type of attachment. Valid values are: SIGNATURE_AUTHORIZATION_LETTER: indicates a document that allows someone to sign on behalf of an individual or a company. ARTICLES_OF_ASSOCIATION: indicates the regulations and rules of a company. LOGO: indicates the merchant's logo. Specify attachmentType as LOGO when the value of paymentMethodType is TRUEMONEY. More information: Maximum length: 64 characters + * + * @return self */ public function setAttachmentType($attachmentType) { - $this->attachmentType = $attachmentType; + $this->container['attachmentType'] = $attachmentType; + + return $this; } /** - * @return mixed + * Gets file + * + * @return string|null */ public function getFile() { - return $this->file; + return $this->container['file']; } /** - * @param mixed $file + * Sets file + * + * @param string|null $file file + * + * @return self */ public function setFile($file) { - $this->file = $file; + $this->container['file'] = $file; + + return $this; } /** - * @return mixed + * Gets attachmentName + * + * @return string */ public function getAttachmentName() { - return $this->attachmentName; + return $this->container['attachmentName']; } /** - * @param mixed $attachmentName + * Sets attachmentName + * + * @param string $attachmentName The name of the attachment file, including the file extension, such as XXX.jpg or XXX.png. More information: Maximum length: 256 characters + * + * @return self */ public function setAttachmentName($attachmentName) { - $this->attachmentName = $attachmentName; + $this->container['attachmentName'] = $attachmentName; + + return $this; } /** - * @return mixed + * Gets fileKey + * + * @return string */ public function getFileKey() { - return $this->fileKey; + return $this->container['fileKey']; } /** - * @param mixed $fileKey + * Sets fileKey + * + * @param string $fileKey The unique key value of the attachment file. Maximum file size: 32MB. The value of this parameter is obtained from the attachmentKey parameter in the submitAttachment API. Prior attachment submission using the submitAttachment API is required. More information: Maximum length: 256 characters + * + * @return self */ public function setFileKey($fileKey) { - $this->fileKey = $fileKey; + $this->container['fileKey'] = $fileKey; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/AttachmentType.php b/model/AttachmentType.php index d345a29..98d085e 100644 --- a/model/AttachmentType.php +++ b/model/AttachmentType.php @@ -1,26 +1,45 @@ + */ +class AuthCodeForm implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AuthCodeForm'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'codeDetails' => '\request\model\CodeDetail[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'codeDetails' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'codeDetails' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'codeDetails' => 'codeDetails' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'codeDetails' => 'setCodeDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'codeDetails' => 'getCodeDetails' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('codeDetails', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['codeDetails'] === null) { + $invalidProperties[] = "'codeDetails' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets codeDetails + * + * @return \request\model\CodeDetail[] + */ + public function getCodeDetails() + { + return $this->container['codeDetails']; + } + + /** + * Sets codeDetails + * + * @param \request\model\CodeDetail[] $codeDetails A list of QR code information. + * + * @return self + */ + public function setCodeDetails($codeDetails) + { + $this->container['codeDetails'] = $codeDetails; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/AuthMetaData.php b/model/AuthMetaData.php index 7818e85..2be0410 100644 --- a/model/AuthMetaData.php +++ b/model/AuthMetaData.php @@ -1,43 +1,441 @@ + */ +class AuthMetaData implements ModelInterface, ArrayAccess, \JsonSerializable { - public $accountHolderName; - public $accountHolderCertNo; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AuthMetaData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'accountHolderName' => 'string', + 'accountHolderCertNo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'accountHolderName' => null, + 'accountHolderCertNo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'accountHolderName' => false, + 'accountHolderCertNo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'accountHolderName' => 'accountHolderName', + 'accountHolderCertNo' => 'accountHolderCertNo' + ]; /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'accountHolderName' => 'setAccountHolderName', + 'accountHolderCertNo' => 'setAccountHolderCertNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'accountHolderName' => 'getAccountHolderName', + 'accountHolderCertNo' => 'getAccountHolderCertNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('accountHolderName', $data ?? [], null); + $this->setIfExists('accountHolderCertNo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets accountHolderName + * + * @return string|null */ public function getAccountHolderName() { - return $this->accountHolderName; + return $this->container['accountHolderName']; } /** - * @param mixed $accountHolderName + * Sets accountHolderName + * + * @param string|null $accountHolderName accountHolderName + * + * @return self */ - public function setAccountHolderName($accountHolderName) + public function setAccountHolderName($accountHolderName) { - $this->accountHolderName = $accountHolderName; + $this->container['accountHolderName'] = $accountHolderName; + + return $this; } /** - * @return mixed + * Gets accountHolderCertNo + * + * @return string|null */ public function getAccountHolderCertNo() { - return $this->accountHolderCertNo; + return $this->container['accountHolderCertNo']; } /** - * @param mixed $accountHolderCertNo + * Sets accountHolderCertNo + * + * @param string|null $accountHolderCertNo accountHolderCertNo + * + * @return self */ - public function setAccountHolderCertNo($accountHolderCertNo) + public function setAccountHolderCertNo($accountHolderCertNo) { - $this->accountHolderCertNo = $accountHolderCertNo; + $this->container['accountHolderCertNo'] = $accountHolderCertNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/AvailablePaymentMethod.php b/model/AvailablePaymentMethod.php index 7c87fe4..778a904 100644 --- a/model/AvailablePaymentMethod.php +++ b/model/AvailablePaymentMethod.php @@ -1,45 +1,410 @@ + */ +class AvailablePaymentMethod implements ModelInterface, ArrayAccess, \JsonSerializable { - public $paymentMethodTypeList; - public $paymentMethodMetaData; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AvailablePaymentMethod'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodTypeList' => '\request\model\PaymentMethodTypeItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodTypeList' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodTypeList' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } /** - * @return mixed + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public function getPaymentMethodMetaData() + public static function isNullable(string $property): bool { - return $this->paymentMethodMetaData; + return self::openAPINullables()[$property] ?? false; } /** - * @param mixed $paymentMethodMetaData + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public function setPaymentMethodMetaData($paymentMethodMetaData) + public function isNullableSetToNull(string $property): bool { - $this->paymentMethodMetaData = $paymentMethodMetaData; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodTypeList' => 'paymentMethodTypeList' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodTypeList' => 'setPaymentMethodTypeList' + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodTypeList' => 'getPaymentMethodTypeList' + ]; /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodTypeList', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodTypeList + * + * @return \request\model\PaymentMethodTypeItem[]|null */ public function getPaymentMethodTypeList() { - return $this->paymentMethodTypeList; + return $this->container['paymentMethodTypeList']; } - /**。/ - * @param mixed $paymentMethodTypeList + /** + * Sets paymentMethodTypeList + * + * @param \request\model\PaymentMethodTypeItem[]|null $paymentMethodTypeList paymentMethodTypeList + * + * @return self */ public function setPaymentMethodTypeList($paymentMethodTypeList) { - $this->paymentMethodTypeList = $paymentMethodTypeList; + $this->container['paymentMethodTypeList'] = $paymentMethodTypeList; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } -} \ No newline at end of file + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/BrowserInfo.php b/model/BrowserInfo.php index 5f8cbf8..e8fbffd 100644 --- a/model/BrowserInfo.php +++ b/model/BrowserInfo.php @@ -1,113 +1,534 @@ + */ +class BrowserInfo implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BrowserInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acceptHeader' => 'string', + 'javaEnabled' => 'bool', + 'javaScriptEnabled' => 'bool', + 'language' => 'string', + 'userAgent' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acceptHeader' => null, + 'javaEnabled' => null, + 'javaScriptEnabled' => null, + 'language' => null, + 'userAgent' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'acceptHeader' => false, + 'javaEnabled' => false, + 'javaScriptEnabled' => false, + 'language' => false, + 'userAgent' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'acceptHeader' => 'acceptHeader', + 'javaEnabled' => 'javaEnabled', + 'javaScriptEnabled' => 'javaScriptEnabled', + 'language' => 'language', + 'userAgent' => 'userAgent' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acceptHeader' => 'setAcceptHeader', + 'javaEnabled' => 'setJavaEnabled', + 'javaScriptEnabled' => 'setJavaScriptEnabled', + 'language' => 'setLanguage', + 'userAgent' => 'setUserAgent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acceptHeader' => 'getAcceptHeader', + 'javaEnabled' => 'getJavaEnabled', + 'javaScriptEnabled' => 'getJavaScriptEnabled', + 'language' => 'getLanguage', + 'userAgent' => 'getUserAgent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } /** - * The accept header of the user's browser + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public $acceptHeader; + public static function setters() + { + return self::$setters; + } /** - * Indicates whether the user's browser is able to run Java + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public $javaEnabled; + public static function getters() + { + return self::$getters; + } /** - * Indicates whether the user's browser is able to run Java + * The original name of the model. + * + * @return string */ - public $javaScriptEnabled; + public function getModelName() + { + return self::$openAPIModelName; + } + /** - * The language of the user's browser + * Associative array for storing property values + * + * @var mixed[] */ - public $language; + protected $container = []; /** - * The user agent of the user's browser + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public $userAgent; + public function __construct(?array $data = null) + { + $this->setIfExists('acceptHeader', $data ?? [], null); + $this->setIfExists('javaEnabled', $data ?? [], null); + $this->setIfExists('javaScriptEnabled', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('userAgent', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } /** - * @return mixed + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets acceptHeader + * + * @return string|null */ public function getAcceptHeader() { - return $this->acceptHeader; + return $this->container['acceptHeader']; } /** - * @param mixed $acceptHeader + * Sets acceptHeader + * + * @param string|null $acceptHeader The accept header of the user's browser + * + * @return self */ public function setAcceptHeader($acceptHeader) { - $this->acceptHeader = $acceptHeader; + $this->container['acceptHeader'] = $acceptHeader; + + return $this; } /** - * @return mixed + * Gets javaEnabled + * + * @return bool|null */ public function getJavaEnabled() { - return $this->javaEnabled; + return $this->container['javaEnabled']; } /** - * @param mixed $javaEnabled + * Sets javaEnabled + * + * @param bool|null $javaEnabled Indicates whether the user's browser is able to run Java + * + * @return self */ public function setJavaEnabled($javaEnabled) { - $this->javaEnabled = $javaEnabled; + $this->container['javaEnabled'] = $javaEnabled; + + return $this; } /** - * @return mixed + * Gets javaScriptEnabled + * + * @return bool|null */ public function getJavaScriptEnabled() { - return $this->javaScriptEnabled; + return $this->container['javaScriptEnabled']; } /** - * @param mixed $javaScriptEnabled + * Sets javaScriptEnabled + * + * @param bool|null $javaScriptEnabled Indicates whether the user's browser is able to run Java + * + * @return self */ public function setJavaScriptEnabled($javaScriptEnabled) { - $this->javaScriptEnabled = $javaScriptEnabled; + $this->container['javaScriptEnabled'] = $javaScriptEnabled; + + return $this; } /** - * @return mixed + * Gets language + * + * @return string|null */ public function getLanguage() { - return $this->language; + return $this->container['language']; } /** - * @param mixed $language + * Sets language + * + * @param string|null $language The language of the user's browser + * + * @return self */ public function setLanguage($language) { - $this->language = $language; + $this->container['language'] = $language; + + return $this; } /** - * @return mixed + * Gets userAgent + * + * @return string|null */ public function getUserAgent() { - return $this->userAgent; + return $this->container['userAgent']; } /** - * @param mixed $userAgent + * Sets userAgent + * + * @param string|null $userAgent The user agent of the user's browser + * + * @return self */ public function setUserAgent($userAgent) { - $this->userAgent = $userAgent; + $this->container['userAgent'] = $userAgent; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/BusinessInfo.php b/model/BusinessInfo.php index 5daad35..1f6e2c7 100644 --- a/model/BusinessInfo.php +++ b/model/BusinessInfo.php @@ -1,129 +1,599 @@ + */ +class BusinessInfo implements ModelInterface, ArrayAccess, \JsonSerializable { - public $mcc; - public $websites; - public $englishName; - public $doingBusinessAs; - public $mainSalesCountry; - public $appName; - public $serviceDescription; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BusinessInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mcc' => 'string', + 'websites' => '\request\model\WebSite[]', + 'englishName' => 'string', + 'doingBusinessAs' => 'string', + 'mainSalesCountry' => 'string', + 'appName' => 'string', + 'serviceDescription' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mcc' => null, + 'websites' => null, + 'englishName' => null, + 'doingBusinessAs' => null, + 'mainSalesCountry' => null, + 'appName' => null, + 'serviceDescription' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'mcc' => false, + 'websites' => false, + 'englishName' => false, + 'doingBusinessAs' => false, + 'mainSalesCountry' => false, + 'appName' => false, + 'serviceDescription' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mcc' => 'mcc', + 'websites' => 'websites', + 'englishName' => 'englishName', + 'doingBusinessAs' => 'doingBusinessAs', + 'mainSalesCountry' => 'mainSalesCountry', + 'appName' => 'appName', + 'serviceDescription' => 'serviceDescription' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mcc' => 'setMcc', + 'websites' => 'setWebsites', + 'englishName' => 'setEnglishName', + 'doingBusinessAs' => 'setDoingBusinessAs', + 'mainSalesCountry' => 'setMainSalesCountry', + 'appName' => 'setAppName', + 'serviceDescription' => 'setServiceDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mcc' => 'getMcc', + 'websites' => 'getWebsites', + 'englishName' => 'getEnglishName', + 'doingBusinessAs' => 'getDoingBusinessAs', + 'mainSalesCountry' => 'getMainSalesCountry', + 'appName' => 'getAppName', + 'serviceDescription' => 'getServiceDescription' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mcc', $data ?? [], null); + $this->setIfExists('websites', $data ?? [], null); + $this->setIfExists('englishName', $data ?? [], null); + $this->setIfExists('doingBusinessAs', $data ?? [], null); + $this->setIfExists('mainSalesCountry', $data ?? [], null); + $this->setIfExists('appName', $data ?? [], null); + $this->setIfExists('serviceDescription', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['doingBusinessAs'] === null) { + $invalidProperties[] = "'doingBusinessAs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mcc + * + * @return string|null */ public function getMcc() { - return $this->mcc; + return $this->container['mcc']; } /** - * @param mixed $mcc + * Sets mcc + * + * @param string|null $mcc mcc String The merchant category code (MCC). See MCC list to check valid values. More information: Maximum length: 32 characters + * + * @return self */ - public function setMcc($mcc) + public function setMcc($mcc) { - $this->mcc = $mcc; + $this->container['mcc'] = $mcc; + + return $this; } /** - * @return mixed + * Gets websites + * + * @return \request\model\WebSite[]|null */ public function getWebsites() { - return $this->websites; + return $this->container['websites']; } /** - * @param mixed $websites + * Sets websites + * + * @param \request\model\WebSite[]|null $websites The list of merchant websites. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR. More information: Maximum size: 10 elements + * + * @return self */ - public function setWebsites($websites) + public function setWebsites($websites) { - $this->websites = $websites; + $this->container['websites'] = $websites; + + return $this; } /** - * @return mixed + * Gets englishName + * + * @return string|null */ public function getEnglishName() { - return $this->englishName; + return $this->container['englishName']; } /** - * @param mixed $englishName + * Sets englishName + * + * @param string|null $englishName The English name of the company. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is JP. More information: Maximum length: 256 characters + * + * @return self */ - public function setEnglishName($englishName) + public function setEnglishName($englishName) { - $this->englishName = $englishName; + $this->container['englishName'] = $englishName; + + return $this; } /** - * @return mixed + * Gets doingBusinessAs + * + * @return string */ public function getDoingBusinessAs() { - return $this->doingBusinessAs; + return $this->container['doingBusinessAs']; } /** - * @param mixed $doingBusinessAs + * Sets doingBusinessAs + * + * @param string $doingBusinessAs The customer-facing business name. Consider user interface limitations when choosing this name. More information: Maximum length: 256 characters + * + * @return self */ - public function setDoingBusinessAs($doingBusinessAs) + public function setDoingBusinessAs($doingBusinessAs) { - $this->doingBusinessAs = $doingBusinessAs; + $this->container['doingBusinessAs'] = $doingBusinessAs; + + return $this; } /** - * @return mixed + * Gets mainSalesCountry + * + * @return string|null */ public function getMainSalesCountry() { - return $this->mainSalesCountry; + return $this->container['mainSalesCountry']; } /** - * @param mixed $mainSalesCountry + * Sets mainSalesCountry + * + * @param string|null $mainSalesCountry The country where your primary sales activities take place. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is US. More information: Maximum length: 2 characters + * + * @return self */ - public function setMainSalesCountry($mainSalesCountry) + public function setMainSalesCountry($mainSalesCountry) { - $this->mainSalesCountry = $mainSalesCountry; + $this->container['mainSalesCountry'] = $mainSalesCountry; + + return $this; } /** - * @return mixed + * Gets appName + * + * @return string|null */ public function getAppName() { - return $this->appName; + return $this->container['appName']; } /** - * @param mixed $appName + * Sets appName + * + * @param string|null $appName The App name. Specify this parameter when the value of paymentMethodType is TRUEMONEY. More information: Maximum length: 256 characters + * + * @return self */ - public function setAppName($appName) + public function setAppName($appName) { - $this->appName = $appName; + $this->container['appName'] = $appName; + + return $this; } /** - * @return mixed + * Gets serviceDescription + * + * @return string|null */ public function getServiceDescription() { - return $this->serviceDescription; + return $this->container['serviceDescription']; + } + + /** + * Sets serviceDescription + * + * @param string|null $serviceDescription A clear and detailed description of the product or service. Specify this parameter when the value of paymentMethodType is TRUEMONEY. More information: Maximum length: 256 characters + * + * @return self + */ + public function setServiceDescription($serviceDescription) + { + $this->container['serviceDescription'] = $serviceDescription; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $serviceDescription + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setServiceDescription($serviceDescription) + public function offsetSet($offset, $value): void { - $this->serviceDescription = $serviceDescription; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Buyer.php b/model/Buyer.php index 9f50a09..aefdd9b 100644 --- a/model/Buyer.php +++ b/model/Buyer.php @@ -1,132 +1,596 @@ + */ +class Buyer implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Buyer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'referenceBuyerId' => 'string', + 'buyerName' => '\request\model\UserName', + 'buyerPhoneNo' => 'string', + 'buyerEmail' => 'string', + 'buyerRegistrationTime' => 'string', + 'isAccountVerified' => 'bool', + 'successfulOrderCount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'referenceBuyerId' => null, + 'buyerName' => null, + 'buyerPhoneNo' => null, + 'buyerEmail' => null, + 'buyerRegistrationTime' => null, + 'isAccountVerified' => null, + 'successfulOrderCount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'referenceBuyerId' => false, + 'buyerName' => false, + 'buyerPhoneNo' => false, + 'buyerEmail' => false, + 'buyerRegistrationTime' => false, + 'isAccountVerified' => false, + 'successfulOrderCount' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'referenceBuyerId' => 'referenceBuyerId', + 'buyerName' => 'buyerName', + 'buyerPhoneNo' => 'buyerPhoneNo', + 'buyerEmail' => 'buyerEmail', + 'buyerRegistrationTime' => 'buyerRegistrationTime', + 'isAccountVerified' => 'isAccountVerified', + 'successfulOrderCount' => 'successfulOrderCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'referenceBuyerId' => 'setReferenceBuyerId', + 'buyerName' => 'setBuyerName', + 'buyerPhoneNo' => 'setBuyerPhoneNo', + 'buyerEmail' => 'setBuyerEmail', + 'buyerRegistrationTime' => 'setBuyerRegistrationTime', + 'isAccountVerified' => 'setIsAccountVerified', + 'successfulOrderCount' => 'setSuccessfulOrderCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'referenceBuyerId' => 'getReferenceBuyerId', + 'buyerName' => 'getBuyerName', + 'buyerPhoneNo' => 'getBuyerPhoneNo', + 'buyerEmail' => 'getBuyerEmail', + 'buyerRegistrationTime' => 'getBuyerRegistrationTime', + 'isAccountVerified' => 'getIsAccountVerified', + 'successfulOrderCount' => 'getSuccessfulOrderCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('referenceBuyerId', $data ?? [], null); + $this->setIfExists('buyerName', $data ?? [], null); + $this->setIfExists('buyerPhoneNo', $data ?? [], null); + $this->setIfExists('buyerEmail', $data ?? [], null); + $this->setIfExists('buyerRegistrationTime', $data ?? [], null); + $this->setIfExists('isAccountVerified', $data ?? [], null); + $this->setIfExists('successfulOrderCount', $data ?? [], null); - public $referenceBuyerId; - public $buyerName; - public $buyerPhoneNo; - public $buyerEmail; + } - public $buyerRegistrationTime; + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - public $isAccountVerified; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } - public $successfulOrderCount; + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } /** - * @return String + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets referenceBuyerId + * + * @return string|null */ public function getReferenceBuyerId() { - return $this->referenceBuyerId; + return $this->container['referenceBuyerId']; } /** - * @param String $referenceBuyerId + * Sets referenceBuyerId + * + * @param string|null $referenceBuyerId The unique ID to identify the buyer. Specify this parameter: When you require risk control. When the value of paymentMethodType is CARD. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + * + * @return self */ public function setReferenceBuyerId($referenceBuyerId) { - $this->referenceBuyerId = $referenceBuyerId; + $this->container['referenceBuyerId'] = $referenceBuyerId; + + return $this; } /** - * @return UserName + * Gets buyerName + * + * @return \request\model\UserName|null */ public function getBuyerName() { - return $this->buyerName; + return $this->container['buyerName']; } /** - * @param UserName $buyerName + * Sets buyerName + * + * @param \request\model\UserName|null $buyerName buyerName + * + * @return self */ public function setBuyerName($buyerName) { - $this->buyerName = $buyerName; + $this->container['buyerName'] = $buyerName; + + return $this; } /** - * @return String + * Gets buyerPhoneNo + * + * @return string|null */ public function getBuyerPhoneNo() { - return $this->buyerPhoneNo; + return $this->container['buyerPhoneNo']; } /** - * @param String $buyerPhoneNo + * Sets buyerPhoneNo + * + * @param string|null $buyerPhoneNo The mobile phone number of the buyer. Specify this parameter when one of the following conditions is met: You require risk control. The value of paymentMethodType is CARD. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 24 characters + * + * @return self */ public function setBuyerPhoneNo($buyerPhoneNo) { - $this->buyerPhoneNo = $buyerPhoneNo; + $this->container['buyerPhoneNo'] = $buyerPhoneNo; + + return $this; } /** - * @return String + * Gets buyerEmail + * + * @return string|null */ public function getBuyerEmail() { - return $this->buyerEmail; + return $this->container['buyerEmail']; } /** - * @param String $buyerEmail + * Sets buyerEmail + * + * @param string|null $buyerEmail The email of the buyer. Specify this parameter: When you require risk control. When the value of paymentMethodType is CARD. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + * + * @return self */ public function setBuyerEmail($buyerEmail) { - $this->buyerEmail = $buyerEmail; + $this->container['buyerEmail'] = $buyerEmail; + + return $this; } /** - * @return mixed + * Gets buyerRegistrationTime + * + * @return string|null */ public function getBuyerRegistrationTime() { - return $this->buyerRegistrationTime; + return $this->container['buyerRegistrationTime']; } /** - * @param mixed $buyerRegistrationTime + * Sets buyerRegistrationTime + * + * @param string|null $buyerRegistrationTime The time when the buyer registered your account. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setBuyerRegistrationTime($buyerRegistrationTime) { - $this->buyerRegistrationTime = $buyerRegistrationTime; + $this->container['buyerRegistrationTime'] = $buyerRegistrationTime; + + return $this; } /** - * @return mixed + * Gets isAccountVerified + * + * @return bool|null */ public function getIsAccountVerified() { - return $this->isAccountVerified; + return $this->container['isAccountVerified']; } /** - * @param mixed $isAccountVerified + * Sets isAccountVerified + * + * @param bool|null $isAccountVerified isAccountVerified + * + * @return self */ public function setIsAccountVerified($isAccountVerified) { - $this->isAccountVerified = $isAccountVerified; + $this->container['isAccountVerified'] = $isAccountVerified; + + return $this; } /** - * @return mixed + * Gets successfulOrderCount + * + * @return int|null */ public function getSuccessfulOrderCount() { - return $this->successfulOrderCount; + return $this->container['successfulOrderCount']; } /** - * @param mixed $successfulOrderCount + * Sets successfulOrderCount + * + * @param int|null $successfulOrderCount successfulOrderCount + * + * @return self */ public function setSuccessfulOrderCount($successfulOrderCount) { - $this->successfulOrderCount = $successfulOrderCount; + $this->container['successfulOrderCount'] = $successfulOrderCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CardBrand.php b/model/CardBrand.php index 1689342..7938fc0 100644 --- a/model/CardBrand.php +++ b/model/CardBrand.php @@ -1,31 +1,41 @@ + */ +class CardInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cardNo' => 'string', + 'cardBrand' => 'string', + 'cardToken' => 'string', + 'issuingCountry' => 'string', + 'funding' => 'string', + 'paymentMethodRegion' => 'string', + 'threeDSResult' => '\request\model\ThreeDSResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cardNo' => null, + 'cardBrand' => null, + 'cardToken' => null, + 'issuingCountry' => null, + 'funding' => null, + 'paymentMethodRegion' => null, + 'threeDSResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'cardNo' => false, + 'cardBrand' => false, + 'cardToken' => false, + 'issuingCountry' => false, + 'funding' => false, + 'paymentMethodRegion' => false, + 'threeDSResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'cardNo' => 'cardNo', + 'cardBrand' => 'cardBrand', + 'cardToken' => 'cardToken', + 'issuingCountry' => 'issuingCountry', + 'funding' => 'funding', + 'paymentMethodRegion' => 'paymentMethodRegion', + 'threeDSResult' => 'threeDSResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cardNo' => 'setCardNo', + 'cardBrand' => 'setCardBrand', + 'cardToken' => 'setCardToken', + 'issuingCountry' => 'setIssuingCountry', + 'funding' => 'setFunding', + 'paymentMethodRegion' => 'setPaymentMethodRegion', + 'threeDSResult' => 'setThreeDSResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cardNo' => 'getCardNo', + 'cardBrand' => 'getCardBrand', + 'cardToken' => 'getCardToken', + 'issuingCountry' => 'getIssuingCountry', + 'funding' => 'getFunding', + 'paymentMethodRegion' => 'getPaymentMethodRegion', + 'threeDSResult' => 'getThreeDSResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('cardNo', $data ?? [], null); + $this->setIfExists('cardBrand', $data ?? [], null); + $this->setIfExists('cardToken', $data ?? [], null); + $this->setIfExists('issuingCountry', $data ?? [], null); + $this->setIfExists('funding', $data ?? [], null); + $this->setIfExists('paymentMethodRegion', $data ?? [], null); + $this->setIfExists('threeDSResult', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets cardNo + * + * @return string|null + */ + public function getCardNo() + { + return $this->container['cardNo']; + } + + /** + * Sets cardNo + * + * @param string|null $cardNo The masked card number, which just shows part of the card number and can be used to display to the user + * + * @return self + */ + public function setCardNo($cardNo) + { + $this->container['cardNo'] = $cardNo; + + return $this; + } + + /** + * Gets cardBrand + * + * @return string|null + */ + public function getCardBrand() + { + return $this->container['cardBrand']; + } + + /** + * Sets cardBrand + * + * @param string|null $cardBrand The card brand + * + * @return self + */ + public function setCardBrand($cardBrand) + { + $this->container['cardBrand'] = $cardBrand; + + return $this; + } + + /** + * Gets cardToken + * + * @return string|null + */ + public function getCardToken() + { + return $this->container['cardToken']; + } + + /** + * Sets cardToken + * + * @param string|null $cardToken The token of the card + * + * @return self + */ + public function setCardToken($cardToken) + { + $this->container['cardToken'] = $cardToken; + + return $this; + } + + /** + * Gets issuingCountry + * + * @return string|null + */ + public function getIssuingCountry() + { + return $this->container['issuingCountry']; + } + + /** + * Sets issuingCountry + * + * @param string|null $issuingCountry The issuing country of the card + * + * @return self + */ + public function setIssuingCountry($issuingCountry) + { + $this->container['issuingCountry'] = $issuingCountry; + + return $this; + } + + /** + * Gets funding + * + * @return string|null + */ + public function getFunding() + { + return $this->container['funding']; + } + + /** + * Sets funding + * + * @param string|null $funding The funding type of the card + * + * @return self + */ + public function setFunding($funding) + { + $this->container['funding'] = $funding; + + return $this; + } + + /** + * Gets paymentMethodRegion + * + * @return string|null + */ + public function getPaymentMethodRegion() + { + return $this->container['paymentMethodRegion']; + } + + /** + * Sets paymentMethodRegion + * + * @param string|null $paymentMethodRegion The region code that represents the country or region of the payment method + * + * @return self + */ + public function setPaymentMethodRegion($paymentMethodRegion) + { + $this->container['paymentMethodRegion'] = $paymentMethodRegion; + + return $this; + } + + /** + * Gets threeDSResult + * + * @return \request\model\ThreeDSResult|null + */ + public function getThreeDSResult() + { + return $this->container['threeDSResult']; + } + + /** + * Sets threeDSResult + * + * @param \request\model\ThreeDSResult|null $threeDSResult threeDSResult + * + * @return self + */ + public function setThreeDSResult($threeDSResult) + { + $this->container['threeDSResult'] = $threeDSResult; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CardPaymentMethodDetail.php b/model/CardPaymentMethodDetail.php index bc470aa..d5a38d7 100644 --- a/model/CardPaymentMethodDetail.php +++ b/model/CardPaymentMethodDetail.php @@ -1,563 +1,1504 @@ + */ +class CardPaymentMethodDetail implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; - public $cardToken; - public $cardNo; - public $brand; - public $selectedCardBrand; - public $cardIssuer; - public $countryIssue; - public $instUserName; - public $expiryYear; - public $expiryMonth; - public $billingAddress; - public $mask; - public $last4; - public $paymentMethodDetailMetadata; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardPaymentMethodDetail'; - public $maskedCardNo; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cardToken' => 'string', + 'cardNo' => 'string', + 'brand' => '\request\model\CardBrand', + 'selectedCardBrand' => '\request\model\CardBrand', + 'cardIssuer' => 'string', + 'countryIssue' => 'string', + 'instUserName' => '\request\model\UserName', + 'expiryYear' => 'string', + 'expiryMonth' => 'string', + 'billingAddress' => '\request\model\Address', + 'mask' => 'string', + 'last4' => 'string', + 'paymentMethodDetailMetadata' => 'string', + 'maskedCardNo' => 'string', + 'fingerprint' => 'string', + 'authenticationFlow' => 'string', + 'funding' => 'string', + 'avsResultRaw' => 'string', + 'cvvResultRaw' => 'string', + 'bin' => 'string', + 'issuerName' => 'string', + 'issuingCountry' => 'string', + 'lastFour' => 'string', + 'cardholderName' => '\request\model\UserName', + 'cvv' => 'string', + 'dateOfBirth' => 'string', + 'businessNo' => 'string', + 'cardPasswordDigest' => 'string', + 'cpf' => 'string', + 'payerEmail' => 'string', + 'networkTransactionId' => 'string', + 'is3DSAuthentication' => 'bool', + 'request3DS' => 'string', + 'scaExemptionIndicator' => 'string', + 'enableAuthenticationUpgrade' => 'string', + 'mpiData' => '\request\model\MpiData' + ]; - public $fingerprint; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cardToken' => null, + 'cardNo' => null, + 'brand' => null, + 'selectedCardBrand' => null, + 'cardIssuer' => null, + 'countryIssue' => null, + 'instUserName' => null, + 'expiryYear' => null, + 'expiryMonth' => null, + 'billingAddress' => null, + 'mask' => null, + 'last4' => null, + 'paymentMethodDetailMetadata' => null, + 'maskedCardNo' => null, + 'fingerprint' => null, + 'authenticationFlow' => null, + 'funding' => null, + 'avsResultRaw' => null, + 'cvvResultRaw' => null, + 'bin' => null, + 'issuerName' => null, + 'issuingCountry' => null, + 'lastFour' => null, + 'cardholderName' => null, + 'cvv' => null, + 'dateOfBirth' => null, + 'businessNo' => null, + 'cardPasswordDigest' => null, + 'cpf' => null, + 'payerEmail' => null, + 'networkTransactionId' => null, + 'is3DSAuthentication' => null, + 'request3DS' => null, + 'scaExemptionIndicator' => null, + 'enableAuthenticationUpgrade' => null, + 'mpiData' => null + ]; - public $authenticationFlow; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'cardToken' => false, + 'cardNo' => false, + 'brand' => false, + 'selectedCardBrand' => false, + 'cardIssuer' => false, + 'countryIssue' => false, + 'instUserName' => false, + 'expiryYear' => false, + 'expiryMonth' => false, + 'billingAddress' => false, + 'mask' => false, + 'last4' => false, + 'paymentMethodDetailMetadata' => false, + 'maskedCardNo' => false, + 'fingerprint' => false, + 'authenticationFlow' => false, + 'funding' => false, + 'avsResultRaw' => false, + 'cvvResultRaw' => false, + 'bin' => false, + 'issuerName' => false, + 'issuingCountry' => false, + 'lastFour' => false, + 'cardholderName' => false, + 'cvv' => false, + 'dateOfBirth' => false, + 'businessNo' => false, + 'cardPasswordDigest' => false, + 'cpf' => false, + 'payerEmail' => false, + 'networkTransactionId' => false, + 'is3DSAuthentication' => false, + 'request3DS' => false, + 'scaExemptionIndicator' => false, + 'enableAuthenticationUpgrade' => false, + 'mpiData' => false + ]; - public $funding; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - public $avsResultRaw; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } - public $bin; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } - public $issuerName; + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } - public $issuingCountry; + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } - public $lastFour; + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $cardholderName; + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - public $cvv; + /** + * 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); + } - public $dateOfBirth; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'cardToken' => 'cardToken', + 'cardNo' => 'cardNo', + 'brand' => 'brand', + 'selectedCardBrand' => 'selectedCardBrand', + 'cardIssuer' => 'cardIssuer', + 'countryIssue' => 'countryIssue', + 'instUserName' => 'instUserName', + 'expiryYear' => 'expiryYear', + 'expiryMonth' => 'expiryMonth', + 'billingAddress' => 'billingAddress', + 'mask' => 'mask', + 'last4' => 'last4', + 'paymentMethodDetailMetadata' => 'paymentMethodDetailMetadata', + 'maskedCardNo' => 'maskedCardNo', + 'fingerprint' => 'fingerprint', + 'authenticationFlow' => 'authenticationFlow', + 'funding' => 'funding', + 'avsResultRaw' => 'avsResultRaw', + 'cvvResultRaw' => 'cvvResultRaw', + 'bin' => 'bin', + 'issuerName' => 'issuerName', + 'issuingCountry' => 'issuingCountry', + 'lastFour' => 'lastFour', + 'cardholderName' => 'cardholderName', + 'cvv' => 'cvv', + 'dateOfBirth' => 'dateOfBirth', + 'businessNo' => 'businessNo', + 'cardPasswordDigest' => 'cardPasswordDigest', + 'cpf' => 'cpf', + 'payerEmail' => 'payerEmail', + 'networkTransactionId' => 'networkTransactionId', + 'is3DSAuthentication' => 'is3DSAuthentication', + 'request3DS' => 'request3DS', + 'scaExemptionIndicator' => 'scaExemptionIndicator', + 'enableAuthenticationUpgrade' => 'enableAuthenticationUpgrade', + 'mpiData' => 'mpiData' + ]; - public $businessNo; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cardToken' => 'setCardToken', + 'cardNo' => 'setCardNo', + 'brand' => 'setBrand', + 'selectedCardBrand' => 'setSelectedCardBrand', + 'cardIssuer' => 'setCardIssuer', + 'countryIssue' => 'setCountryIssue', + 'instUserName' => 'setInstUserName', + 'expiryYear' => 'setExpiryYear', + 'expiryMonth' => 'setExpiryMonth', + 'billingAddress' => 'setBillingAddress', + 'mask' => 'setMask', + 'last4' => 'setLast4', + 'paymentMethodDetailMetadata' => 'setPaymentMethodDetailMetadata', + 'maskedCardNo' => 'setMaskedCardNo', + 'fingerprint' => 'setFingerprint', + 'authenticationFlow' => 'setAuthenticationFlow', + 'funding' => 'setFunding', + 'avsResultRaw' => 'setAvsResultRaw', + 'cvvResultRaw' => 'setCvvResultRaw', + 'bin' => 'setBin', + 'issuerName' => 'setIssuerName', + 'issuingCountry' => 'setIssuingCountry', + 'lastFour' => 'setLastFour', + 'cardholderName' => 'setCardholderName', + 'cvv' => 'setCvv', + 'dateOfBirth' => 'setDateOfBirth', + 'businessNo' => 'setBusinessNo', + 'cardPasswordDigest' => 'setCardPasswordDigest', + 'cpf' => 'setCpf', + 'payerEmail' => 'setPayerEmail', + 'networkTransactionId' => 'setNetworkTransactionId', + 'is3DSAuthentication' => 'setIs3DSAuthentication', + 'request3DS' => 'setRequest3DS', + 'scaExemptionIndicator' => 'setScaExemptionIndicator', + 'enableAuthenticationUpgrade' => 'setEnableAuthenticationUpgrade', + 'mpiData' => 'setMpiData' + ]; - public $cardPasswordDigest; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cardToken' => 'getCardToken', + 'cardNo' => 'getCardNo', + 'brand' => 'getBrand', + 'selectedCardBrand' => 'getSelectedCardBrand', + 'cardIssuer' => 'getCardIssuer', + 'countryIssue' => 'getCountryIssue', + 'instUserName' => 'getInstUserName', + 'expiryYear' => 'getExpiryYear', + 'expiryMonth' => 'getExpiryMonth', + 'billingAddress' => 'getBillingAddress', + 'mask' => 'getMask', + 'last4' => 'getLast4', + 'paymentMethodDetailMetadata' => 'getPaymentMethodDetailMetadata', + 'maskedCardNo' => 'getMaskedCardNo', + 'fingerprint' => 'getFingerprint', + 'authenticationFlow' => 'getAuthenticationFlow', + 'funding' => 'getFunding', + 'avsResultRaw' => 'getAvsResultRaw', + 'cvvResultRaw' => 'getCvvResultRaw', + 'bin' => 'getBin', + 'issuerName' => 'getIssuerName', + 'issuingCountry' => 'getIssuingCountry', + 'lastFour' => 'getLastFour', + 'cardholderName' => 'getCardholderName', + 'cvv' => 'getCvv', + 'dateOfBirth' => 'getDateOfBirth', + 'businessNo' => 'getBusinessNo', + 'cardPasswordDigest' => 'getCardPasswordDigest', + 'cpf' => 'getCpf', + 'payerEmail' => 'getPayerEmail', + 'networkTransactionId' => 'getNetworkTransactionId', + 'is3DSAuthentication' => 'getIs3DSAuthentication', + 'request3DS' => 'getRequest3DS', + 'scaExemptionIndicator' => 'getScaExemptionIndicator', + 'enableAuthenticationUpgrade' => 'getEnableAuthenticationUpgrade', + 'mpiData' => 'getMpiData' + ]; - public $cpf; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } - public $payerEmail; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $networkTransactionId; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $is3DSAuthentication; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return mixed + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function getIs3DSAuthentication() + public function __construct(?array $data = null) { - return $this->is3DSAuthentication; + $this->setIfExists('cardToken', $data ?? [], null); + $this->setIfExists('cardNo', $data ?? [], null); + $this->setIfExists('brand', $data ?? [], null); + $this->setIfExists('selectedCardBrand', $data ?? [], null); + $this->setIfExists('cardIssuer', $data ?? [], null); + $this->setIfExists('countryIssue', $data ?? [], null); + $this->setIfExists('instUserName', $data ?? [], null); + $this->setIfExists('expiryYear', $data ?? [], null); + $this->setIfExists('expiryMonth', $data ?? [], null); + $this->setIfExists('billingAddress', $data ?? [], null); + $this->setIfExists('mask', $data ?? [], null); + $this->setIfExists('last4', $data ?? [], null); + $this->setIfExists('paymentMethodDetailMetadata', $data ?? [], null); + $this->setIfExists('maskedCardNo', $data ?? [], null); + $this->setIfExists('fingerprint', $data ?? [], null); + $this->setIfExists('authenticationFlow', $data ?? [], null); + $this->setIfExists('funding', $data ?? [], null); + $this->setIfExists('avsResultRaw', $data ?? [], null); + $this->setIfExists('cvvResultRaw', $data ?? [], null); + $this->setIfExists('bin', $data ?? [], null); + $this->setIfExists('issuerName', $data ?? [], null); + $this->setIfExists('issuingCountry', $data ?? [], null); + $this->setIfExists('lastFour', $data ?? [], null); + $this->setIfExists('cardholderName', $data ?? [], null); + $this->setIfExists('cvv', $data ?? [], null); + $this->setIfExists('dateOfBirth', $data ?? [], null); + $this->setIfExists('businessNo', $data ?? [], null); + $this->setIfExists('cardPasswordDigest', $data ?? [], null); + $this->setIfExists('cpf', $data ?? [], null); + $this->setIfExists('payerEmail', $data ?? [], null); + $this->setIfExists('networkTransactionId', $data ?? [], null); + $this->setIfExists('is3DSAuthentication', $data ?? [], null); + $this->setIfExists('request3DS', $data ?? [], null); + $this->setIfExists('scaExemptionIndicator', $data ?? [], null); + $this->setIfExists('enableAuthenticationUpgrade', $data ?? [], null); + $this->setIfExists('mpiData', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['cardToken'] === null) { + $invalidProperties[] = "'cardToken' can't be null"; + } + if ($this->container['brand'] === null) { + $invalidProperties[] = "'brand' can't be null"; + } + if ($this->container['maskedCardNo'] === null) { + $invalidProperties[] = "'maskedCardNo' can't be null"; + } + return $invalidProperties; + } /** - * @param mixed $is3DSAuthentication + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid */ - public function setIs3DSAuthentication($is3DSAuthentication) + public function valid() { - $this->is3DSAuthentication = $is3DSAuthentication; + return count($this->listInvalidProperties()) === 0; } /** - * @return mixed + * Gets cardToken + * + * @return string */ - public function getNetworkTransactionId() + public function getCardToken() { - return $this->networkTransactionId; + return $this->container['cardToken']; } /** - * @param mixed $networkTransactionId + * Sets cardToken + * + * @param string $cardToken The token of the card. The value of this parameter is used by paymentMethodId in the pay (Checkout Payment) API when initiating payments. More information: Maximum length: 2048 characters + * + * @return self */ - public function setNetworkTransactionId($networkTransactionId) + public function setCardToken($cardToken) { - $this->networkTransactionId = $networkTransactionId; + $this->container['cardToken'] = $cardToken; + + return $this; } + /** + * Gets cardNo + * + * @return string|null + */ + public function getCardNo() + { + return $this->container['cardNo']; + } + /** + * Sets cardNo + * + * @param string|null $cardNo cardNo + * + * @return self + */ + public function setCardNo($cardNo) + { + $this->container['cardNo'] = $cardNo; + return $this; + } /** - * @return mixed + * Gets brand + * + * @return \request\model\CardBrand + */ + public function getBrand() + { + return $this->container['brand']; + } + + /** + * Sets brand + * + * @param \request\model\CardBrand $brand brand + * + * @return self + */ + public function setBrand($brand) + { + $this->container['brand'] = $brand; + + return $this; + } + + /** + * Gets selectedCardBrand + * + * @return \request\model\CardBrand|null */ public function getSelectedCardBrand() { - return $this->selectedCardBrand; + return $this->container['selectedCardBrand']; } /** - * @param mixed $selectedCardBrand + * Sets selectedCardBrand + * + * @param \request\model\CardBrand|null $selectedCardBrand selectedCardBrand + * + * @return self */ public function setSelectedCardBrand($selectedCardBrand) { - $this->selectedCardBrand = $selectedCardBrand; + $this->container['selectedCardBrand'] = $selectedCardBrand; + + return $this; } /** - * @return mixed + * Gets cardIssuer + * + * @return string|null */ - public function getMaskedCardNo() + public function getCardIssuer() { - return $this->maskedCardNo; + return $this->container['cardIssuer']; } /** - * @param mixed $maskedCardNo + * Sets cardIssuer + * + * @param string|null $cardIssuer cardIssuer + * + * @return self */ - public function setMaskedCardNo($maskedCardNo) + public function setCardIssuer($cardIssuer) { - $this->maskedCardNo = $maskedCardNo; + $this->container['cardIssuer'] = $cardIssuer; + + return $this; } /** - * @return mixed + * Gets countryIssue + * + * @return string|null */ - public function getFingerprint() + public function getCountryIssue() { - return $this->fingerprint; + return $this->container['countryIssue']; } /** - * @param mixed $fingerprint + * Sets countryIssue + * + * @param string|null $countryIssue countryIssue + * + * @return self */ - public function setFingerprint($fingerprint) + public function setCountryIssue($countryIssue) { - $this->fingerprint = $fingerprint; + $this->container['countryIssue'] = $countryIssue; + + return $this; } /** - * @return mixed + * Gets instUserName + * + * @return \request\model\UserName|null */ - public function getAuthenticationFlow() + public function getInstUserName() { - return $this->authenticationFlow; + return $this->container['instUserName']; } /** - * @param mixed $authenticationFlow + * Sets instUserName + * + * @param \request\model\UserName|null $instUserName instUserName + * + * @return self */ - public function setAuthenticationFlow($authenticationFlow) + public function setInstUserName($instUserName) { - $this->authenticationFlow = $authenticationFlow; + $this->container['instUserName'] = $instUserName; + + return $this; } /** - * @return mixed + * Gets expiryYear + * + * @return string|null */ - public function getFunding() + public function getExpiryYear() { - return $this->funding; + return $this->container['expiryYear']; } /** - * @param mixed $funding + * Sets expiryYear + * + * @param string|null $expiryYear expiryYear + * + * @return self */ - public function setFunding($funding) + public function setExpiryYear($expiryYear) { - $this->funding = $funding; + $this->container['expiryYear'] = $expiryYear; + + return $this; } /** - * @return mixed + * Gets expiryMonth + * + * @return string|null */ - public function getAvsResultRaw() + public function getExpiryMonth() { - return $this->avsResultRaw; + return $this->container['expiryMonth']; } /** - * @param mixed $avsResultRaw + * Sets expiryMonth + * + * @param string|null $expiryMonth expiryMonth + * + * @return self */ - public function setAvsResultRaw($avsResultRaw) + public function setExpiryMonth($expiryMonth) { - $this->avsResultRaw = $avsResultRaw; + $this->container['expiryMonth'] = $expiryMonth; + + return $this; } /** - * @return mixed + * Gets billingAddress + * + * @return \request\model\Address|null */ - public function getBin() + public function getBillingAddress() { - return $this->bin; + return $this->container['billingAddress']; } /** - * @param mixed $bin + * Sets billingAddress + * + * @param \request\model\Address|null $billingAddress billingAddress + * + * @return self */ - public function setBin($bin) + public function setBillingAddress($billingAddress) { - $this->bin = $bin; + $this->container['billingAddress'] = $billingAddress; + + return $this; } /** - * @return mixed + * Gets mask + * + * @return string|null */ - public function getIssuerName() + public function getMask() { - return $this->issuerName; + return $this->container['mask']; } /** - * @param mixed $issuerName + * Sets mask + * + * @param string|null $mask mask + * + * @return self */ - public function setIssuerName($issuerName) + public function setMask($mask) { - $this->issuerName = $issuerName; + $this->container['mask'] = $mask; + + return $this; } /** - * @return mixed + * Gets last4 + * + * @return string|null */ - public function getIssuingCountry() + public function getLast4() { - return $this->issuingCountry; + return $this->container['last4']; } /** - * @param mixed $issuingCountry + * Sets last4 + * + * @param string|null $last4 last4 + * + * @return self */ - public function setIssuingCountry($issuingCountry) + public function setLast4($last4) { - $this->issuingCountry = $issuingCountry; + $this->container['last4'] = $last4; + + return $this; } /** - * @return mixed + * Gets paymentMethodDetailMetadata + * + * @return string|null */ - public function getLastFour() + public function getPaymentMethodDetailMetadata() { - return $this->lastFour; + return $this->container['paymentMethodDetailMetadata']; } /** - * @param mixed $lastFour + * Sets paymentMethodDetailMetadata + * + * @param string|null $paymentMethodDetailMetadata paymentMethodDetailMetadata + * + * @return self */ - public function setLastFour($lastFour) + public function setPaymentMethodDetailMetadata($paymentMethodDetailMetadata) { - $this->lastFour = $lastFour; + $this->container['paymentMethodDetailMetadata'] = $paymentMethodDetailMetadata; + + return $this; } /** - * @return mixed + * Gets maskedCardNo + * + * @return string */ - public function getCardholderName() + public function getMaskedCardNo() { - return $this->cardholderName; + return $this->container['maskedCardNo']; } /** - * @param mixed $cardholderName + * Sets maskedCardNo + * + * @param string $maskedCardNo The masked card number, showing only a few digits and hiding the rest. More information: Maximum length: 64 characters + * + * @return self */ - public function setCardholderName($cardholderName) + public function setMaskedCardNo($maskedCardNo) { - $this->cardholderName = $cardholderName; + $this->container['maskedCardNo'] = $maskedCardNo; + + return $this; } /** - * @return mixed + * Gets fingerprint + * + * @return string|null */ - public function getCvv() + public function getFingerprint() { - return $this->cvv; + return $this->container['fingerprint']; } /** - * @param mixed $cvv + * Sets fingerprint + * + * @param string|null $fingerprint fingerprint + * + * @return self */ - public function setCvv($cvv) + public function setFingerprint($fingerprint) { - $this->cvv = $cvv; + $this->container['fingerprint'] = $fingerprint; + + return $this; } /** - * @return mixed + * Gets authenticationFlow + * + * @return string|null */ - public function getDateOfBirth() + public function getAuthenticationFlow() { - return $this->dateOfBirth; + return $this->container['authenticationFlow']; } /** - * @param mixed $dateOfBirth + * Sets authenticationFlow + * + * @param string|null $authenticationFlow authenticationFlow + * + * @return self */ - public function setDateOfBirth($dateOfBirth) + public function setAuthenticationFlow($authenticationFlow) { - $this->dateOfBirth = $dateOfBirth; + $this->container['authenticationFlow'] = $authenticationFlow; + + return $this; } /** - * @return mixed + * Gets funding + * + * @return string|null */ - public function getBusinessNo() + public function getFunding() { - return $this->businessNo; + return $this->container['funding']; } /** - * @param mixed $businessNo + * Sets funding + * + * @param string|null $funding funding + * + * @return self */ - public function setBusinessNo($businessNo) + public function setFunding($funding) { - $this->businessNo = $businessNo; + $this->container['funding'] = $funding; + + return $this; } /** - * @return mixed + * Gets avsResultRaw + * + * @return string|null */ - public function getCardPasswordDigest() + public function getAvsResultRaw() { - return $this->cardPasswordDigest; + return $this->container['avsResultRaw']; } /** - * @param mixed $cardPasswordDigest + * Sets avsResultRaw + * + * @param string|null $avsResultRaw avsResultRaw + * + * @return self */ - public function setCardPasswordDigest($cardPasswordDigest) + public function setAvsResultRaw($avsResultRaw) { - $this->cardPasswordDigest = $cardPasswordDigest; + $this->container['avsResultRaw'] = $avsResultRaw; + + return $this; } /** - * @return mixed + * Gets cvvResultRaw + * + * @return string|null */ - public function getCpf() + public function getCvvResultRaw() { - return $this->cpf; + return $this->container['cvvResultRaw']; } /** - * @param mixed $cpf + * Sets cvvResultRaw + * + * @param string|null $cvvResultRaw cvvResultRaw + * + * @return self */ - public function setCpf($cpf) + public function setCvvResultRaw($cvvResultRaw) { - $this->cpf = $cpf; + $this->container['cvvResultRaw'] = $cvvResultRaw; + + return $this; } /** - * @return mixed + * Gets bin + * + * @return string|null */ - public function getPayerEmail() + public function getBin() { - return $this->payerEmail; + return $this->container['bin']; } /** - * @param mixed $payerEmail + * Sets bin + * + * @param string|null $bin bin + * + * @return self */ - public function setPayerEmail($payerEmail) + public function setBin($bin) { - $this->payerEmail = $payerEmail; + $this->container['bin'] = $bin; + + return $this; } + /** + * Gets issuerName + * + * @return string|null + */ + public function getIssuerName() + { + return $this->container['issuerName']; + } + /** + * Sets issuerName + * + * @param string|null $issuerName issuerName + * + * @return self + */ + public function setIssuerName($issuerName) + { + $this->container['issuerName'] = $issuerName; + return $this; + } /** - * @return mixed + * Gets issuingCountry + * + * @return string|null */ - public function getCardToken() + public function getIssuingCountry() { - return $this->cardToken; + return $this->container['issuingCountry']; } /** - * @param mixed $cardToken + * Sets issuingCountry + * + * @param string|null $issuingCountry issuingCountry + * + * @return self */ - public function setCardToken($cardToken) + public function setIssuingCountry($issuingCountry) { - $this->cardToken = $cardToken; + $this->container['issuingCountry'] = $issuingCountry; + + return $this; } /** - * @return mixed + * Gets lastFour + * + * @return string|null */ - public function getCardNo() + public function getLastFour() { - return $this->cardNo; + return $this->container['lastFour']; } /** - * @param mixed $cardNo + * Sets lastFour + * + * @param string|null $lastFour lastFour + * + * @return self */ - public function setCardNo($cardNo) + public function setLastFour($lastFour) { - $this->cardNo = $cardNo; + $this->container['lastFour'] = $lastFour; + + return $this; } /** - * @return mixed + * Gets cardholderName + * + * @return \request\model\UserName|null */ - public function getBrand() + public function getCardholderName() { - return $this->brand; + return $this->container['cardholderName']; } /** - * @param mixed $brand + * Sets cardholderName + * + * @param \request\model\UserName|null $cardholderName cardholderName + * + * @return self */ - public function setBrand($brand) + public function setCardholderName($cardholderName) { - $this->brand = $brand; + $this->container['cardholderName'] = $cardholderName; + + return $this; } /** - * @return mixed + * Gets cvv + * + * @return string|null */ - public function getCardIssuer() + public function getCvv() { - return $this->cardIssuer; + return $this->container['cvv']; } /** - * @param mixed $cardIssuer + * Sets cvv + * + * @param string|null $cvv cvv + * + * @return self */ - public function setCardIssuer($cardIssuer) + public function setCvv($cvv) { - $this->cardIssuer = $cardIssuer; + $this->container['cvv'] = $cvv; + + return $this; } /** - * @return mixed + * Gets dateOfBirth + * + * @return string|null */ - public function getCountryIssue() + public function getDateOfBirth() { - return $this->countryIssue; + return $this->container['dateOfBirth']; } /** - * @param mixed $countryIssue + * Sets dateOfBirth + * + * @param string|null $dateOfBirth dateOfBirth + * + * @return self */ - public function setCountryIssue($countryIssue) + public function setDateOfBirth($dateOfBirth) { - $this->countryIssue = $countryIssue; + $this->container['dateOfBirth'] = $dateOfBirth; + + return $this; } /** - * @return mixed + * Gets businessNo + * + * @return string|null */ - public function getInstUserName() + public function getBusinessNo() { - return $this->instUserName; + return $this->container['businessNo']; } /** - * @param mixed $instUserName + * Sets businessNo + * + * @param string|null $businessNo businessNo + * + * @return self */ - public function setInstUserName($instUserName) + public function setBusinessNo($businessNo) { - $this->instUserName = $instUserName; + $this->container['businessNo'] = $businessNo; + + return $this; } /** - * @return mixed + * Gets cardPasswordDigest + * + * @return string|null */ - public function getExpiryYear() + public function getCardPasswordDigest() { - return $this->expiryYear; + return $this->container['cardPasswordDigest']; } /** - * @param mixed $expiryYear + * Sets cardPasswordDigest + * + * @param string|null $cardPasswordDigest cardPasswordDigest + * + * @return self */ - public function setExpiryYear($expiryYear) + public function setCardPasswordDigest($cardPasswordDigest) { - $this->expiryYear = $expiryYear; + $this->container['cardPasswordDigest'] = $cardPasswordDigest; + + return $this; } /** - * @return mixed + * Gets cpf + * + * @return string|null */ - public function getExpiryMonth() + public function getCpf() { - return $this->expiryMonth; + return $this->container['cpf']; } /** - * @param mixed $expiryMonth + * Sets cpf + * + * @param string|null $cpf cpf + * + * @return self */ - public function setExpiryMonth($expiryMonth) + public function setCpf($cpf) { - $this->expiryMonth = $expiryMonth; + $this->container['cpf'] = $cpf; + + return $this; } /** - * @return mixed + * Gets payerEmail + * + * @return string|null */ - public function getBillingAddress() + public function getPayerEmail() { - return $this->billingAddress; + return $this->container['payerEmail']; } /** - * @param mixed $billingAddress + * Sets payerEmail + * + * @param string|null $payerEmail payerEmail + * + * @return self */ - public function setBillingAddress($billingAddress) + public function setPayerEmail($payerEmail) { - $this->billingAddress = $billingAddress; + $this->container['payerEmail'] = $payerEmail; + + return $this; } /** - * @return mixed + * Gets networkTransactionId + * + * @return string|null */ - public function getMask() + public function getNetworkTransactionId() { - return $this->mask; + return $this->container['networkTransactionId']; } /** - * @param mixed $mask + * Sets networkTransactionId + * + * @param string|null $networkTransactionId The unique ID assigned by the card scheme to identify a transaction. More information: Maximum length: 256 characters + * + * @return self */ - public function setMask($mask) + public function setNetworkTransactionId($networkTransactionId) { - $this->mask = $mask; + $this->container['networkTransactionId'] = $networkTransactionId; + + return $this; } /** - * @return mixed + * Gets is3DSAuthentication + * + * @return bool|null */ - public function getLast4() + public function getIs3DSAuthentication() { - return $this->last4; + return $this->container['is3DSAuthentication']; } /** - * @param mixed $last4 + * Sets is3DSAuthentication + * + * @param bool|null $is3DSAuthentication is3DSAuthentication + * + * @return self */ - public function setLast4($last4) + public function setIs3DSAuthentication($is3DSAuthentication) { - $this->last4 = $last4; + $this->container['is3DSAuthentication'] = $is3DSAuthentication; + + return $this; } /** - * @return mixed + * Gets request3DS + * + * @return string|null */ - public function getPaymentMethodDetailMetadata() + public function getRequest3DS() { - return $this->paymentMethodDetailMetadata; + return $this->container['request3DS']; } /** - * @param mixed $paymentMethodDetailMetadata + * Sets request3DS + * + * @param string|null $request3DS request3DS + * + * @return self */ - public function setPaymentMethodDetailMetadata($paymentMethodDetailMetadata) + public function setRequest3DS($request3DS) + { + $this->container['request3DS'] = $request3DS; + + return $this; + } + + /** + * Gets scaExemptionIndicator + * + * @return string|null + */ + public function getScaExemptionIndicator() { - $this->paymentMethodDetailMetadata = $paymentMethodDetailMetadata; + return $this->container['scaExemptionIndicator']; } -} \ No newline at end of file + /** + * Sets scaExemptionIndicator + * + * @param string|null $scaExemptionIndicator scaExemptionIndicator + * + * @return self + */ + public function setScaExemptionIndicator($scaExemptionIndicator) + { + $this->container['scaExemptionIndicator'] = $scaExemptionIndicator; + + return $this; + } + + /** + * Gets enableAuthenticationUpgrade + * + * @return string|null + */ + public function getEnableAuthenticationUpgrade() + { + return $this->container['enableAuthenticationUpgrade']; + } + + /** + * Sets enableAuthenticationUpgrade + * + * @param string|null $enableAuthenticationUpgrade enableAuthenticationUpgrade + * + * @return self + */ + public function setEnableAuthenticationUpgrade($enableAuthenticationUpgrade) + { + $this->container['enableAuthenticationUpgrade'] = $enableAuthenticationUpgrade; + + return $this; + } + + /** + * Gets mpiData + * + * @return \request\model\MpiData|null + */ + public function getMpiData() + { + return $this->container['mpiData']; + } + + /** + * Sets mpiData + * + * @param \request\model\MpiData|null $mpiData mpiData + * + * @return self + */ + public function setMpiData($mpiData) + { + $this->container['mpiData'] = $mpiData; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CardVerificationResult.php b/model/CardVerificationResult.php new file mode 100644 index 0000000..871767e --- /dev/null +++ b/model/CardVerificationResult.php @@ -0,0 +1,583 @@ + + */ +class CardVerificationResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CardVerificationResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'authenticationType' => 'string', + 'authenticationMethod' => 'string', + 'cvvResult' => 'string', + 'avsResult' => 'string', + 'authorizationCode' => 'string', + 'threeDSResult' => '\request\model\RiskThreeDSResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'authenticationType' => null, + 'authenticationMethod' => null, + 'cvvResult' => null, + 'avsResult' => null, + 'authorizationCode' => null, + 'threeDSResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'authenticationType' => false, + 'authenticationMethod' => false, + 'cvvResult' => false, + 'avsResult' => false, + 'authorizationCode' => false, + 'threeDSResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'authenticationType' => 'authenticationType', + 'authenticationMethod' => 'authenticationMethod', + 'cvvResult' => 'cvvResult', + 'avsResult' => 'avsResult', + 'authorizationCode' => 'authorizationCode', + 'threeDSResult' => 'threeDSResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'authenticationType' => 'setAuthenticationType', + 'authenticationMethod' => 'setAuthenticationMethod', + 'cvvResult' => 'setCvvResult', + 'avsResult' => 'setAvsResult', + 'authorizationCode' => 'setAuthorizationCode', + 'threeDSResult' => 'setThreeDSResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'authenticationType' => 'getAuthenticationType', + 'authenticationMethod' => 'getAuthenticationMethod', + 'cvvResult' => 'getCvvResult', + 'avsResult' => 'getAvsResult', + 'authorizationCode' => 'getAuthorizationCode', + 'threeDSResult' => 'getThreeDSResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('authenticationType', $data ?? [], null); + $this->setIfExists('authenticationMethod', $data ?? [], null); + $this->setIfExists('cvvResult', $data ?? [], null); + $this->setIfExists('avsResult', $data ?? [], null); + $this->setIfExists('authorizationCode', $data ?? [], null); + $this->setIfExists('threeDSResult', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['authenticationType'] === null) { + $invalidProperties[] = "'authenticationType' can't be null"; + } + if ($this->container['authenticationMethod'] === null) { + $invalidProperties[] = "'authenticationMethod' can't be null"; + } + if ($this->container['cvvResult'] === null) { + $invalidProperties[] = "'cvvResult' can't be null"; + } + if ($this->container['avsResult'] === null) { + $invalidProperties[] = "'avsResult' can't be null"; + } + if ($this->container['authorizationCode'] === null) { + $invalidProperties[] = "'authorizationCode' can't be null"; + } + if ($this->container['threeDSResult'] === null) { + $invalidProperties[] = "'threeDSResult' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets authenticationType + * + * @return string + */ + public function getAuthenticationType() + { + return $this->container['authenticationType']; + } + + /** + * Sets authenticationType + * + * @param string $authenticationType Authentication type + * + * @return self + */ + public function setAuthenticationType($authenticationType) + { + $this->container['authenticationType'] = $authenticationType; + + return $this; + } + + /** + * Gets authenticationMethod + * + * @return string + */ + public function getAuthenticationMethod() + { + return $this->container['authenticationMethod']; + } + + /** + * Sets authenticationMethod + * + * @param string $authenticationMethod The authentication method that a merchant uses for a card payment + * + * @return self + */ + public function setAuthenticationMethod($authenticationMethod) + { + $this->container['authenticationMethod'] = $authenticationMethod; + + return $this; + } + + /** + * Gets cvvResult + * + * @return string + */ + public function getCvvResult() + { + return $this->container['cvvResult']; + } + + /** + * Sets cvvResult + * + * @param string $cvvResult The verification result of the card verification value (CVV) + * + * @return self + */ + public function setCvvResult($cvvResult) + { + $this->container['cvvResult'] = $cvvResult; + + return $this; + } + + /** + * Gets avsResult + * + * @return string + */ + public function getAvsResult() + { + return $this->container['avsResult']; + } + + /** + * Sets avsResult + * + * @param string $avsResult The address verification result. + * + * @return self + */ + public function setAvsResult($avsResult) + { + $this->container['avsResult'] = $avsResult; + + return $this; + } + + /** + * Gets authorizationCode + * + * @return string + */ + public function getAuthorizationCode() + { + return $this->container['authorizationCode']; + } + + /** + * Sets authorizationCode + * + * @param string $authorizationCode The authorization code granted by the payment method provider for a successful 3D authentication. + * + * @return self + */ + public function setAuthorizationCode($authorizationCode) + { + $this->container['authorizationCode'] = $authorizationCode; + + return $this; + } + + /** + * Gets threeDSResult + * + * @return \request\model\RiskThreeDSResult + */ + public function getThreeDSResult() + { + return $this->container['threeDSResult']; + } + + /** + * Sets threeDSResult + * + * @param \request\model\RiskThreeDSResult $threeDSResult threeDSResult + * + * @return self + */ + public function setThreeDSResult($threeDSResult) + { + $this->container['threeDSResult'] = $threeDSResult; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Certificate.php b/model/Certificate.php index 32b7a64..92de1a0 100644 --- a/model/Certificate.php +++ b/model/Certificate.php @@ -1,94 +1,540 @@ + */ +class Certificate implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Certificate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'certificateType' => '\request\model\CertificateType', + 'certificateNo' => 'string', + 'holderName' => '\request\model\UserName', + 'fileKeys' => 'string[]', + 'certificateAuthority' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'certificateType' => null, + 'certificateNo' => null, + 'holderName' => null, + 'fileKeys' => null, + 'certificateAuthority' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'certificateType' => false, + 'certificateNo' => false, + 'holderName' => false, + 'fileKeys' => false, + 'certificateAuthority' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'certificateType' => 'certificateType', + 'certificateNo' => 'certificateNo', + 'holderName' => 'holderName', + 'fileKeys' => 'fileKeys', + 'certificateAuthority' => 'certificateAuthority' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'certificateType' => 'setCertificateType', + 'certificateNo' => 'setCertificateNo', + 'holderName' => 'setHolderName', + 'fileKeys' => 'setFileKeys', + 'certificateAuthority' => 'setCertificateAuthority' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'certificateType' => 'getCertificateType', + 'certificateNo' => 'getCertificateNo', + 'holderName' => 'getHolderName', + 'fileKeys' => 'getFileKeys', + 'certificateAuthority' => 'getCertificateAuthority' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - public $certificateType; - public $certificateNo; - public $holderName; - public $fileKeys; - public $certificateAuthority; /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('certificateType', $data ?? [], null); + $this->setIfExists('certificateNo', $data ?? [], null); + $this->setIfExists('holderName', $data ?? [], null); + $this->setIfExists('fileKeys', $data ?? [], null); + $this->setIfExists('certificateAuthority', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['certificateType'] === null) { + $invalidProperties[] = "'certificateType' can't be null"; + } + if ($this->container['certificateNo'] === null) { + $invalidProperties[] = "'certificateNo' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets certificateType + * + * @return \request\model\CertificateType */ public function getCertificateType() { - return $this->certificateType; + return $this->container['certificateType']; } /** - * @param mixed $certificateType + * Sets certificateType + * + * @param \request\model\CertificateType $certificateType certificateType + * + * @return self */ public function setCertificateType($certificateType) { - $this->certificateType = $certificateType; + $this->container['certificateType'] = $certificateType; + + return $this; } /** - * @return mixed + * Gets certificateNo + * + * @return string */ public function getCertificateNo() { - return $this->certificateNo; + return $this->container['certificateNo']; } /** - * @param mixed $certificateNo + * Sets certificateNo + * + * @param string $certificateNo The unique identification number of the certificate. More information: Maximum length: 64 characters + * + * @return self */ - public function setCertificateNo($certificateNo) + public function setCertificateNo($certificateNo) { - $this->certificateNo = $certificateNo; + $this->container['certificateNo'] = $certificateNo; + + return $this; } /** - * @return mixed + * Gets holderName + * + * @return \request\model\UserName|null */ public function getHolderName() { - return $this->holderName; + return $this->container['holderName']; } /** - * @param mixed $holderName + * Sets holderName + * + * @param \request\model\UserName|null $holderName holderName + * + * @return self */ - public function setHolderName($holderName) + public function setHolderName($holderName) { - $this->holderName = $holderName; + $this->container['holderName'] = $holderName; + + return $this; } /** - * @return mixed + * Gets fileKeys + * + * @return string[]|null */ public function getFileKeys() { - return $this->fileKeys; + return $this->container['fileKeys']; } /** - * @param mixed $fileKeys + * Sets fileKeys + * + * @param string[]|null $fileKeys A list of the unique key values of attachment files. Maximum file size: 32MB. The value of this parameter is obtained from the attachmentKey parameter in the submitAttachment API. Prior attachment submission using the submitAttachment API is required. Specify this parameter when the value of merchantInfo.company.certificates.certificateType is ENTERPRISE_REGISTRATION and the value of merchantInfo.company.registeredAddress.region is AU, SG, HK, GB, MY, US or the company's registered region belongs to the European Union. More information: Maximum size: 10 elements + * + * @return self */ - public function setFileKeys($fileKeys) + public function setFileKeys($fileKeys) { - $this->fileKeys = $fileKeys; + $this->container['fileKeys'] = $fileKeys; + + return $this; } /** - * @return mixed + * Gets certificateAuthority + * + * @return string|null */ public function getCertificateAuthority() { - return $this->certificateAuthority; + return $this->container['certificateAuthority']; + } + + /** + * Sets certificateAuthority + * + * @param string|null $certificateAuthority The country that authorizes the certificate. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is US. More information: Maximum length: 64 characters + * + * @return self + */ + public function setCertificateAuthority($certificateAuthority) + { + $this->container['certificateAuthority'] = $certificateAuthority; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $certificateAuthority + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setCertificateAuthority($certificateAuthority) + public function offsetSet($offset, $value): void { - $this->certificateAuthority = $certificateAuthority; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CertificateType.php b/model/CertificateType.php index 8fffb4a..eb1754f 100644 --- a/model/CertificateType.php +++ b/model/CertificateType.php @@ -1,15 +1,36 @@ + */ +class ChallengeActionForm implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChallengeActionForm'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'challengeType' => '\request\model\ChallengeType', + 'challengeRenderValue' => 'string', + 'triggerSource' => '\request\model\ChallengeTriggerSourceType', + 'extendInfo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'challengeType' => null, + 'challengeRenderValue' => null, + 'triggerSource' => null, + 'extendInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'challengeType' => false, + 'challengeRenderValue' => false, + 'triggerSource' => false, + 'extendInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'challengeType' => 'challengeType', + 'challengeRenderValue' => 'challengeRenderValue', + 'triggerSource' => 'triggerSource', + 'extendInfo' => 'extendInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'challengeType' => 'setChallengeType', + 'challengeRenderValue' => 'setChallengeRenderValue', + 'triggerSource' => 'setTriggerSource', + 'extendInfo' => 'setExtendInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'challengeType' => 'getChallengeType', + 'challengeRenderValue' => 'getChallengeRenderValue', + 'triggerSource' => 'getTriggerSource', + 'extendInfo' => 'getExtendInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - public $challengeType; - public $challengeRenderValue; - public $triggerSource; - public $extendInfo; /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('challengeType', $data ?? [], null); + $this->setIfExists('challengeRenderValue', $data ?? [], null); + $this->setIfExists('triggerSource', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets challengeType + * + * @return \request\model\ChallengeType|null */ public function getChallengeType() { - return $this->challengeType; + return $this->container['challengeType']; } /** - * @param mixed $challengeType + * Sets challengeType + * + * @param \request\model\ChallengeType|null $challengeType challengeType + * + * @return self */ public function setChallengeType($challengeType) { - $this->challengeType = $challengeType; + $this->container['challengeType'] = $challengeType; + + return $this; } /** - * @return mixed + * Gets challengeRenderValue + * + * @return string|null */ public function getChallengeRenderValue() { - return $this->challengeRenderValue; + return $this->container['challengeRenderValue']; } /** - * @param mixed $challengeRenderValue + * Sets challengeRenderValue + * + * @param string|null $challengeRenderValue challengeRenderValue + * + * @return self */ public function setChallengeRenderValue($challengeRenderValue) { - $this->challengeRenderValue = $challengeRenderValue; + $this->container['challengeRenderValue'] = $challengeRenderValue; + + return $this; } /** - * @return mixed + * Gets triggerSource + * + * @return \request\model\ChallengeTriggerSourceType|null */ public function getTriggerSource() { - return $this->triggerSource; + return $this->container['triggerSource']; } /** - * @param mixed $triggerSource + * Sets triggerSource + * + * @param \request\model\ChallengeTriggerSourceType|null $triggerSource triggerSource + * + * @return self */ public function setTriggerSource($triggerSource) { - $this->triggerSource = $triggerSource; + $this->container['triggerSource'] = $triggerSource; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/ChallengeTriggerSourceType.php b/model/ChallengeTriggerSourceType.php index 017f009..9a95bcc 100644 --- a/model/ChallengeTriggerSourceType.php +++ b/model/ChallengeTriggerSourceType.php @@ -1,8 +1,31 @@ + */ +class CodeDetail implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CodeDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'codeValueType' => '\request\model\CodeValueType', + 'codeValue' => 'string', + 'displayType' => '\request\model\DisplayType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'codeValueType' => null, + 'codeValue' => null, + 'displayType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'codeValueType' => false, + 'codeValue' => false, + 'displayType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - public $codeValueType; - public $codeValue; - public $displayType; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * @return mixed + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'codeValueType' => 'codeValueType', + 'codeValue' => 'codeValue', + 'displayType' => 'displayType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'codeValueType' => 'setCodeValueType', + 'codeValue' => 'setCodeValue', + 'displayType' => 'setDisplayType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'codeValueType' => 'getCodeValueType', + 'codeValue' => 'getCodeValue', + 'displayType' => 'getDisplayType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('codeValueType', $data ?? [], null); + $this->setIfExists('codeValue', $data ?? [], null); + $this->setIfExists('displayType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['codeValueType'] === null) { + $invalidProperties[] = "'codeValueType' can't be null"; + } + if ($this->container['codeValue'] === null) { + $invalidProperties[] = "'codeValue' can't be null"; + } + if ($this->container['displayType'] === null) { + $invalidProperties[] = "'displayType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets codeValueType + * + * @return \request\model\CodeValueType */ public function getCodeValueType() { - return $this->codeValueType; + return $this->container['codeValueType']; } /** - * @param mixed $codeValueType + * Sets codeValueType + * + * @param \request\model\CodeValueType $codeValueType codeValueType + * + * @return self */ public function setCodeValueType($codeValueType) { - $this->codeValueType = $codeValueType; + $this->container['codeValueType'] = $codeValueType; + + return $this; } /** - * @return mixed + * Gets codeValue + * + * @return string */ public function getCodeValue() { - return $this->codeValue; + return $this->container['codeValue']; } /** - * @param mixed $codeValue + * Sets codeValue + * + * @param string $codeValue The value of the code. If the value of displayType is set toSMALLIMAGE, MIDDLEIMAGE, or BIGIMAGE, this parameter indicates a plain or Base64-encoded image URL. If the value of displayType is set to TEXT, this parameter indicates a text string. More information: Maximum length: 2048 characters + * + * @return self */ public function setCodeValue($codeValue) { - $this->codeValue = $codeValue; + $this->container['codeValue'] = $codeValue; + + return $this; } /** - * @return mixed + * Gets displayType + * + * @return \request\model\DisplayType */ public function getDisplayType() { - return $this->displayType; + return $this->container['displayType']; } /** - * @param mixed $displayType + * Sets displayType + * + * @param \request\model\DisplayType $displayType displayType + * + * @return self */ public function setDisplayType($displayType) { - $this->displayType = $displayType; + $this->container['displayType'] = $displayType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CodeValueType.php b/model/CodeValueType.php index 665c2ba..195adef 100644 --- a/model/CodeValueType.php +++ b/model/CodeValueType.php @@ -1,9 +1,31 @@ + */ +class Company implements ModelInterface, ArrayAccess, \JsonSerializable { - public $legalName; - public $companyType; - public $registeredAddress; - public $operatingAddress; - public $incorporationDate; - public $stockInfo; - public $certificates; - public $attachments; - public $companyUnit; - public $contacts; - public $vatNo; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Company'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'legalName' => 'string', + 'companyType' => '\request\model\CompanyType', + 'registeredAddress' => '\request\model\Address', + 'operatingAddress' => '\request\model\Address', + 'incorporationDate' => 'string', + 'stockInfo' => '\request\model\StockInfo', + 'certificates' => '\request\model\Certificate', + 'attachments' => '\request\model\Attachment[]', + 'companyUnit' => '\request\model\CompanyUnitType', + 'contacts' => '\request\model\Contact[]', + 'vatNo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'legalName' => null, + 'companyType' => null, + 'registeredAddress' => null, + 'operatingAddress' => null, + 'incorporationDate' => null, + 'stockInfo' => null, + 'certificates' => null, + 'attachments' => null, + 'companyUnit' => null, + 'contacts' => null, + 'vatNo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'legalName' => false, + 'companyType' => false, + 'registeredAddress' => false, + 'operatingAddress' => false, + 'incorporationDate' => false, + 'stockInfo' => false, + 'certificates' => false, + 'attachments' => false, + 'companyUnit' => false, + 'contacts' => false, + 'vatNo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'legalName' => 'legalName', + 'companyType' => 'companyType', + 'registeredAddress' => 'registeredAddress', + 'operatingAddress' => 'operatingAddress', + 'incorporationDate' => 'incorporationDate', + 'stockInfo' => 'stockInfo', + 'certificates' => 'certificates', + 'attachments' => 'attachments', + 'companyUnit' => 'companyUnit', + 'contacts' => 'contacts', + 'vatNo' => 'vatNo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'legalName' => 'setLegalName', + 'companyType' => 'setCompanyType', + 'registeredAddress' => 'setRegisteredAddress', + 'operatingAddress' => 'setOperatingAddress', + 'incorporationDate' => 'setIncorporationDate', + 'stockInfo' => 'setStockInfo', + 'certificates' => 'setCertificates', + 'attachments' => 'setAttachments', + 'companyUnit' => 'setCompanyUnit', + 'contacts' => 'setContacts', + 'vatNo' => 'setVatNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'legalName' => 'getLegalName', + 'companyType' => 'getCompanyType', + 'registeredAddress' => 'getRegisteredAddress', + 'operatingAddress' => 'getOperatingAddress', + 'incorporationDate' => 'getIncorporationDate', + 'stockInfo' => 'getStockInfo', + 'certificates' => 'getCertificates', + 'attachments' => 'getAttachments', + 'companyUnit' => 'getCompanyUnit', + 'contacts' => 'getContacts', + 'vatNo' => 'getVatNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } /** - * @return mixed + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('legalName', $data ?? [], null); + $this->setIfExists('companyType', $data ?? [], null); + $this->setIfExists('registeredAddress', $data ?? [], null); + $this->setIfExists('operatingAddress', $data ?? [], null); + $this->setIfExists('incorporationDate', $data ?? [], null); + $this->setIfExists('stockInfo', $data ?? [], null); + $this->setIfExists('certificates', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('companyUnit', $data ?? [], null); + $this->setIfExists('contacts', $data ?? [], null); + $this->setIfExists('vatNo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['legalName'] === null) { + $invalidProperties[] = "'legalName' can't be null"; + } + if ($this->container['companyType'] === null) { + $invalidProperties[] = "'companyType' can't be null"; + } + if ($this->container['registeredAddress'] === null) { + $invalidProperties[] = "'registeredAddress' can't be null"; + } + if ($this->container['operatingAddress'] === null) { + $invalidProperties[] = "'operatingAddress' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets legalName + * + * @return string */ public function getLegalName() { - return $this->legalName; + return $this->container['legalName']; } /** - * @param mixed $legalName + * Sets legalName + * + * @param string $legalName The legal name of the company. More information: Maximum size: 256 elements + * + * @return self */ - public function setLegalName($legalName) + public function setLegalName($legalName) { - $this->legalName = $legalName; + $this->container['legalName'] = $legalName; + + return $this; } /** - * @return mixed + * Gets companyType + * + * @return \request\model\CompanyType */ public function getCompanyType() { - return $this->companyType; + return $this->container['companyType']; } /** - * @param mixed $companyType + * Sets companyType + * + * @param \request\model\CompanyType $companyType companyType + * + * @return self */ - public function setCompanyType($companyType) + public function setCompanyType($companyType) { - $this->companyType = $companyType; + $this->container['companyType'] = $companyType; + + return $this; } /** - * @return mixed + * Gets registeredAddress + * + * @return \request\model\Address */ public function getRegisteredAddress() { - return $this->registeredAddress; + return $this->container['registeredAddress']; } /** - * @param mixed $registeredAddress + * Sets registeredAddress + * + * @param \request\model\Address $registeredAddress registeredAddress + * + * @return self */ - public function setRegisteredAddress($registeredAddress) + public function setRegisteredAddress($registeredAddress) { - $this->registeredAddress = $registeredAddress; + $this->container['registeredAddress'] = $registeredAddress; + + return $this; } /** - * @return mixed + * Gets operatingAddress + * + * @return \request\model\Address */ public function getOperatingAddress() { - return $this->operatingAddress; + return $this->container['operatingAddress']; } /** - * @param mixed $operatingAddress + * Sets operatingAddress + * + * @param \request\model\Address $operatingAddress operatingAddress + * + * @return self */ - public function setOperatingAddress($operatingAddress) + public function setOperatingAddress($operatingAddress) { - $this->operatingAddress = $operatingAddress; + $this->container['operatingAddress'] = $operatingAddress; + + return $this; } /** - * @return mixed + * Gets incorporationDate + * + * @return string|null */ public function getIncorporationDate() { - return $this->incorporationDate; + return $this->container['incorporationDate']; } /** - * @param mixed $incorporationDate + * Sets incorporationDate + * + * @param string|null $incorporationDate The date when the company was officially registered and incorporated with the government. The value of this parameter is in the format of YYYY-MM-DD, such as 2023-06-25. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is AU, SG, HK, US, GB, MY, or the company's registered region belongs to the European Union. More information: Maximum length: 32 characters + * + * @return self */ - public function setIncorporationDate($incorporationDate) + public function setIncorporationDate($incorporationDate) { - $this->incorporationDate = $incorporationDate; + $this->container['incorporationDate'] = $incorporationDate; + + return $this; } /** - * @return mixed + * Gets stockInfo + * + * @return \request\model\StockInfo|null */ public function getStockInfo() { - return $this->stockInfo; + return $this->container['stockInfo']; } /** - * @param mixed $stockInfo + * Sets stockInfo + * + * @param \request\model\StockInfo|null $stockInfo stockInfo + * + * @return self */ - public function setStockInfo($stockInfo) + public function setStockInfo($stockInfo) { - $this->stockInfo = $stockInfo; + $this->container['stockInfo'] = $stockInfo; + + return $this; } /** - * @return mixed + * Gets certificates + * + * @return \request\model\Certificate|null */ public function getCertificates() { - return $this->certificates; + return $this->container['certificates']; } /** - * @param mixed $certificates + * Sets certificates + * + * @param \request\model\Certificate|null $certificates certificates + * + * @return self */ - public function setCertificates($certificates) + public function setCertificates($certificates) { - $this->certificates = $certificates; + $this->container['certificates'] = $certificates; + + return $this; } /** - * @return mixed + * Gets attachments + * + * @return \request\model\Attachment[]|null */ public function getAttachments() { - return $this->attachments; + return $this->container['attachments']; } /** - * @param mixed $attachments + * Sets attachments + * + * @param \request\model\Attachment[]|null $attachments The list of attachment information. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR, AU, SG, HK, GB, MY, or belongs to the European Union. More information: Maximum size: 10 elements + * + * @return self */ - public function setAttachments($attachments) + public function setAttachments($attachments) { - $this->attachments = $attachments; + $this->container['attachments'] = $attachments; + + return $this; } /** - * @return mixed + * Gets companyUnit + * + * @return \request\model\CompanyUnitType|null */ public function getCompanyUnit() { - return $this->companyUnit; + return $this->container['companyUnit']; } /** - * @param mixed $companyUnit + * Sets companyUnit + * + * @param \request\model\CompanyUnitType|null $companyUnit companyUnit + * + * @return self */ - public function setCompanyUnit($companyUnit) + public function setCompanyUnit($companyUnit) { - $this->companyUnit = $companyUnit; + $this->container['companyUnit'] = $companyUnit; + + return $this; } /** - * @return mixed + * Gets contacts + * + * @return \request\model\Contact[]|null */ public function getContacts() { - return $this->contacts; + return $this->container['contacts']; } /** - * @param mixed $contacts + * Sets contacts + * + * @param \request\model\Contact[]|null $contacts A list of contact information. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is JP. + * + * @return self */ - public function setContacts($contacts) + public function setContacts($contacts) { - $this->contacts = $contacts; + $this->container['contacts'] = $contacts; + + return $this; } /** - * @return mixed + * Gets vatNo + * + * @return string|null */ public function getVatNo() { - return $this->vatNo; + return $this->container['vatNo']; + } + + /** + * Sets vatNo + * + * @param string|null $vatNo The Value Added Tax (VAT) number of the company. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is GB or the company's registered region belongs to the European Union. More information: Maximum length: 64 characters + * + * @return self + */ + public function setVatNo($vatNo) + { + $this->container['vatNo'] = $vatNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); } /** - * @param mixed $vatNo + * 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. */ - public function setVatNo($vatNo) + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->vatNo = $vatNo; + return ObjectSerializer::sanitizeForSerialization($this); } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CompanyType.php b/model/CompanyType.php index d378bd1..a3dbe35 100644 --- a/model/CompanyType.php +++ b/model/CompanyType.php @@ -1,19 +1,41 @@ + */ +class Contact implements ModelInterface, ArrayAccess, \JsonSerializable { - public $type; - public $info; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Contact'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => '\request\model\ContactType', + 'info' => 'string', + 'home' => 'string', + 'work' => 'string', + 'mobile' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'info' => null, + 'home' => null, + 'work' => null, + 'mobile' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'type' => false, + 'info' => false, + 'home' => false, + 'work' => false, + 'mobile' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'info' => 'info', + 'home' => 'home', + 'work' => 'work', + 'mobile' => 'mobile' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'info' => 'setInfo', + 'home' => 'setHome', + 'work' => 'setWork', + 'mobile' => 'setMobile' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'info' => 'getInfo', + 'home' => 'getHome', + 'work' => 'getWork', + 'mobile' => 'getMobile' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('info', $data ?? [], null); + $this->setIfExists('home', $data ?? [], null); + $this->setIfExists('work', $data ?? [], null); + $this->setIfExists('mobile', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \request\model\ContactType */ public function getType() { - return $this->type; + return $this->container['type']; } /** - * @param mixed $type + * Sets type + * + * @param \request\model\ContactType $type type + * + * @return self */ - public function setType($type) + public function setType($type) { - $this->type = $type; + $this->container['type'] = $type; + + return $this; } /** - * @return mixed + * Gets info + * + * @return string|null */ public function getInfo() { - return $this->info; + return $this->container['info']; + } + + /** + * Sets info + * + * @param string|null $info The contact details of a specific contact type. More information: Maximum length: 256 characters + * + * @return self + */ + public function setInfo($info) + { + $this->container['info'] = $info; + + return $this; } /** - * @param mixed $info + * Gets home + * + * @return string|null */ - public function setInfo($info) + public function getHome() { - $this->info = $info; + return $this->container['home']; } + /** + * Sets home + * + * @param string|null $home home + * + * @return self + */ + public function setHome($home) + { + $this->container['home'] = $home; + return $this; + } -} \ No newline at end of file + /** + * Gets work + * + * @return string|null + */ + public function getWork() + { + return $this->container['work']; + } + + /** + * Sets work + * + * @param string|null $work work + * + * @return self + */ + public function setWork($work) + { + $this->container['work'] = $work; + + return $this; + } + + /** + * Gets mobile + * + * @return string|null + */ + public function getMobile() + { + return $this->container['mobile']; + } + + /** + * Sets mobile + * + * @param string|null $mobile mobile + * + * @return self + */ + public function setMobile($mobile) + { + $this->container['mobile'] = $mobile; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/ContactType.php b/model/ContactType.php index e073177..bc63566 100644 --- a/model/ContactType.php +++ b/model/ContactType.php @@ -1,60 +1,32 @@ EMAIL; - } - - /** - * @param mixed $EMAIL - */ - public function setEMAIL($EMAIL) - { - $this->EMAIL = $EMAIL; - } +/** + * marketplace_register + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 6.0.1 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ - /** - * @return mixed - */ - public function getPHONENO() - { - return $this->PHONE_NO; - } - /** - * @param mixed $PHONE_NO - */ - public function setPHONENO($PHONE_NO) - { - $this->PHONE_NO = $PHONE_NO; - } - - /** - * @return mixed - */ - public function getCOMMERCIALPHONENO() - { - return $this->COMMERCIAL_PHONE_NO; - } - - /** - * @param mixed $COMMERCIAL_PHONE_NO - */ - public function setCOMMERCIALPHONENO($COMMERCIAL_PHONE_NO) - { - $this->COMMERCIAL_PHONE_NO = $COMMERCIAL_PHONE_NO; - } +namespace Model; +/** + * ContactType Class Doc Comment + * + * @category Class + * @package request + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ -} \ No newline at end of file +class ContactType +{ + public const EMAIL = 'EMAIL'; + public const PHONE_NO = 'PHONE_NO'; + public const COMMERCIAL_PHONE_NO = 'COMMERCIAL_PHONE_NO'; +} diff --git a/model/CouponPaymentMethodDetail.php b/model/CouponPaymentMethodDetail.php index ebba28c..a181ca1 100644 --- a/model/CouponPaymentMethodDetail.php +++ b/model/CouponPaymentMethodDetail.php @@ -1,110 +1,565 @@ + */ +class CouponPaymentMethodDetail implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CouponPaymentMethodDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'couponId' => 'string', + 'availableAmount' => '\request\model\Amount', + 'couponName' => 'string', + 'couponDescription' => 'string', + 'couponExpireTime' => 'string', + 'paymentMethodDetailMetadata' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'couponId' => null, + 'availableAmount' => null, + 'couponName' => null, + 'couponDescription' => null, + 'couponExpireTime' => null, + 'paymentMethodDetailMetadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'couponId' => false, + 'availableAmount' => false, + 'couponName' => false, + 'couponDescription' => false, + 'couponExpireTime' => false, + 'paymentMethodDetailMetadata' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'couponId' => 'couponId', + 'availableAmount' => 'availableAmount', + 'couponName' => 'couponName', + 'couponDescription' => 'couponDescription', + 'couponExpireTime' => 'couponExpireTime', + 'paymentMethodDetailMetadata' => 'paymentMethodDetailMetadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'couponId' => 'setCouponId', + 'availableAmount' => 'setAvailableAmount', + 'couponName' => 'setCouponName', + 'couponDescription' => 'setCouponDescription', + 'couponExpireTime' => 'setCouponExpireTime', + 'paymentMethodDetailMetadata' => 'setPaymentMethodDetailMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'couponId' => 'getCouponId', + 'availableAmount' => 'getAvailableAmount', + 'couponName' => 'getCouponName', + 'couponDescription' => 'getCouponDescription', + 'couponExpireTime' => 'getCouponExpireTime', + 'paymentMethodDetailMetadata' => 'getPaymentMethodDetailMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + - public $couponId; - public $availableAmount; - public $couponName; - public $couponDescription; - public $couponExpireTime; - public $paymentMethodDetailMetadatal; + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return mixed + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('couponId', $data ?? [], null); + $this->setIfExists('availableAmount', $data ?? [], null); + $this->setIfExists('couponName', $data ?? [], null); + $this->setIfExists('couponDescription', $data ?? [], null); + $this->setIfExists('couponExpireTime', $data ?? [], null); + $this->setIfExists('paymentMethodDetailMetadata', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets couponId + * + * @return string|null */ public function getCouponId() { - return $this->couponId; + return $this->container['couponId']; } /** - * @param mixed $couponId + * Sets couponId + * + * @param string|null $couponId couponId + * + * @return self */ public function setCouponId($couponId) { - $this->couponId = $couponId; + $this->container['couponId'] = $couponId; + + return $this; } /** - * @return mixed + * Gets availableAmount + * + * @return \request\model\Amount|null */ public function getAvailableAmount() { - return $this->availableAmount; + return $this->container['availableAmount']; } /** - * @param mixed $availableAmount + * Sets availableAmount + * + * @param \request\model\Amount|null $availableAmount availableAmount + * + * @return self */ public function setAvailableAmount($availableAmount) { - $this->availableAmount = $availableAmount; + $this->container['availableAmount'] = $availableAmount; + + return $this; } /** - * @return mixed + * Gets couponName + * + * @return string|null */ public function getCouponName() { - return $this->couponName; + return $this->container['couponName']; } /** - * @param mixed $couponName + * Sets couponName + * + * @param string|null $couponName couponName + * + * @return self */ public function setCouponName($couponName) { - $this->couponName = $couponName; + $this->container['couponName'] = $couponName; + + return $this; } /** - * @return mixed + * Gets couponDescription + * + * @return string|null */ public function getCouponDescription() { - return $this->couponDescription; + return $this->container['couponDescription']; } /** - * @param mixed $couponDescription + * Sets couponDescription + * + * @param string|null $couponDescription couponDescription + * + * @return self */ public function setCouponDescription($couponDescription) { - $this->couponDescription = $couponDescription; + $this->container['couponDescription'] = $couponDescription; + + return $this; } /** - * @return mixed + * Gets couponExpireTime + * + * @return string|null */ public function getCouponExpireTime() { - return $this->couponExpireTime; + return $this->container['couponExpireTime']; } /** - * @param mixed $couponExpireTime + * Sets couponExpireTime + * + * @param string|null $couponExpireTime couponExpireTime + * + * @return self */ public function setCouponExpireTime($couponExpireTime) { - $this->couponExpireTime = $couponExpireTime; + $this->container['couponExpireTime'] = $couponExpireTime; + + return $this; + } + + /** + * Gets paymentMethodDetailMetadata + * + * @return string|null + */ + public function getPaymentMethodDetailMetadata() + { + return $this->container['paymentMethodDetailMetadata']; + } + + /** + * Sets paymentMethodDetailMetadata + * + * @param string|null $paymentMethodDetailMetadata paymentMethodDetailMetadata + * + * @return self + */ + public function setPaymentMethodDetailMetadata($paymentMethodDetailMetadata) + { + $this->container['paymentMethodDetailMetadata'] = $paymentMethodDetailMetadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } /** - * @return mixed + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null */ - public function getPaymentMethodDetailMetadatal() + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - return $this->paymentMethodDetailMetadatal; + return $this->container[$offset] ?? null; } /** - * @param mixed $paymentMethodDetailMetadatal + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setPaymentMethodDetailMetadatal($paymentMethodDetailMetadatal) + public function offsetSet($offset, $value): void { - $this->paymentMethodDetailMetadatal = $paymentMethodDetailMetadatal; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CreditPayFeeType.php b/model/CreditPayFeeType.php index 3a3766b..aae7c82 100644 --- a/model/CreditPayFeeType.php +++ b/model/CreditPayFeeType.php @@ -1,10 +1,30 @@ + */ +class CreditPayPlan implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreditPayPlan'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'installmentNum' => 'int', + 'interval' => 'string', + 'creditPayFeeType' => '\request\model\CreditPayFeeType', + 'feePercentage' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'installmentNum' => null, + 'interval' => null, + 'creditPayFeeType' => null, + 'feePercentage' => null + ]; - public $installmentNum; - public $interval; - public $creditPayFeeType; - public $feePercentage; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'installmentNum' => true, + 'interval' => false, + 'creditPayFeeType' => false, + 'feePercentage' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; /** - * @return mixed + * Array of property to type mappings. Used for (de)serialization + * + * @return array */ - public function getInterval() + public static function openAPITypes() { - return $this->interval; + return self::$openAPITypes; } /** - * @param mixed $interval + * Array of property to format mappings. Used for (de)serialization + * + * @return array */ - public function setInterval($interval) + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool { - $this->interval = $interval; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'installmentNum' => 'installmentNum', + 'interval' => 'interval', + 'creditPayFeeType' => 'creditPayFeeType', + 'feePercentage' => 'feePercentage' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'installmentNum' => 'setInstallmentNum', + 'interval' => 'setInterval', + 'creditPayFeeType' => 'setCreditPayFeeType', + 'feePercentage' => 'setFeePercentage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'installmentNum' => 'getInstallmentNum', + 'interval' => 'getInterval', + 'creditPayFeeType' => 'getCreditPayFeeType', + 'feePercentage' => 'getFeePercentage' + ]; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return mixed + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('installmentNum', $data ?? [], null); + $this->setIfExists('interval', $data ?? [], null); + $this->setIfExists('creditPayFeeType', $data ?? [], null); + $this->setIfExists('feePercentage', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets installmentNum + * + * @return int|null */ public function getInstallmentNum() { - return $this->installmentNum; + return $this->container['installmentNum']; } /** - * @param mixed $installmentNum + * Sets installmentNum + * + * @param int|null $installmentNum installmentNum + * + * @return self */ public function setInstallmentNum($installmentNum) { - $this->installmentNum = $installmentNum; + $this->container['installmentNum'] = $installmentNum; + + return $this; } /** - * @return mixed + * Gets interval + * + * @return string|null + */ + public function getInterval() + { + return $this->container['interval']; + } + + /** + * Sets interval + * + * @param string|null $interval interval + * + * @return self + */ + public function setInterval($interval) + { + $this->container['interval'] = $interval; + + return $this; + } + + /** + * Gets creditPayFeeType + * + * @return \request\model\CreditPayFeeType|null */ public function getCreditPayFeeType() { - return $this->creditPayFeeType; + return $this->container['creditPayFeeType']; } /** - * @param mixed $creditPayFeeType + * Sets creditPayFeeType + * + * @param \request\model\CreditPayFeeType|null $creditPayFeeType creditPayFeeType + * + * @return self */ public function setCreditPayFeeType($creditPayFeeType) { - $this->creditPayFeeType = $creditPayFeeType; + $this->container['creditPayFeeType'] = $creditPayFeeType; + + return $this; } /** - * @return mixed + * Gets feePercentage + * + * @return int|null */ public function getFeePercentage() { - return $this->feePercentage; + return $this->container['feePercentage']; } /** - * @param mixed $feePercentage + * Sets feePercentage + * + * @param int|null $feePercentage feePercentage + * + * @return self */ public function setFeePercentage($feePercentage) { - $this->feePercentage = $feePercentage; + $this->container['feePercentage'] = $feePercentage; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/CustomerBelongsTo.php b/model/CustomerBelongsTo.php index c6f6b46..65490a2 100644 --- a/model/CustomerBelongsTo.php +++ b/model/CustomerBelongsTo.php @@ -1,36 +1,55 @@ + */ +class CustomizedInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomizedInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customizedField1' => 'string', + 'customizedField2' => 'string', + 'customizedField3' => 'string', + 'customizedField4' => 'string', + 'customizedField5' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customizedField1' => null, + 'customizedField2' => null, + 'customizedField3' => null, + 'customizedField4' => null, + 'customizedField5' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'customizedField1' => false, + 'customizedField2' => false, + 'customizedField3' => false, + 'customizedField4' => false, + 'customizedField5' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customizedField1' => 'customizedField1', + 'customizedField2' => 'customizedField2', + 'customizedField3' => 'customizedField3', + 'customizedField4' => 'customizedField4', + 'customizedField5' => 'customizedField5' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customizedField1' => 'setCustomizedField1', + 'customizedField2' => 'setCustomizedField2', + 'customizedField3' => 'setCustomizedField3', + 'customizedField4' => 'setCustomizedField4', + 'customizedField5' => 'setCustomizedField5' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customizedField1' => 'getCustomizedField1', + 'customizedField2' => 'getCustomizedField2', + 'customizedField3' => 'getCustomizedField3', + 'customizedField4' => 'getCustomizedField4', + 'customizedField5' => 'getCustomizedField5' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('customizedField1', $data ?? [], null); + $this->setIfExists('customizedField2', $data ?? [], null); + $this->setIfExists('customizedField3', $data ?? [], null); + $this->setIfExists('customizedField4', $data ?? [], null); + $this->setIfExists('customizedField5', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets customizedField1 + * + * @return string|null + */ + public function getCustomizedField1() + { + return $this->container['customizedField1']; + } + + /** + * Sets customizedField1 + * + * @param string|null $customizedField1 customizedField1 + * + * @return self + */ + public function setCustomizedField1($customizedField1) + { + $this->container['customizedField1'] = $customizedField1; + + return $this; + } + + /** + * Gets customizedField2 + * + * @return string|null + */ + public function getCustomizedField2() + { + return $this->container['customizedField2']; + } + + /** + * Sets customizedField2 + * + * @param string|null $customizedField2 customizedField2 + * + * @return self + */ + public function setCustomizedField2($customizedField2) + { + $this->container['customizedField2'] = $customizedField2; + + return $this; + } + + /** + * Gets customizedField3 + * + * @return string|null + */ + public function getCustomizedField3() + { + return $this->container['customizedField3']; + } + + /** + * Sets customizedField3 + * + * @param string|null $customizedField3 customizedField3 + * + * @return self + */ + public function setCustomizedField3($customizedField3) + { + $this->container['customizedField3'] = $customizedField3; + + return $this; + } + + /** + * Gets customizedField4 + * + * @return string|null + */ + public function getCustomizedField4() + { + return $this->container['customizedField4']; + } + + /** + * Sets customizedField4 + * + * @param string|null $customizedField4 customizedField4 + * + * @return self + */ + public function setCustomizedField4($customizedField4) + { + $this->container['customizedField4'] = $customizedField4; + + return $this; + } + + /** + * Gets customizedField5 + * + * @return string|null + */ + public function getCustomizedField5() + { + return $this->container['customizedField5']; + } + + /** + * Sets customizedField5 + * + * @param string|null $customizedField5 customizedField5 + * + * @return self + */ + public function setCustomizedField5($customizedField5) + { + $this->container['customizedField5'] = $customizedField5; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/DeliveryEstimate.php b/model/DeliveryEstimate.php new file mode 100644 index 0000000..c5e87ae --- /dev/null +++ b/model/DeliveryEstimate.php @@ -0,0 +1,441 @@ + + */ +class DeliveryEstimate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DeliveryEstimate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'minimum' => '\request\model\DeliveryEstimateInfo', + 'maximum' => '\request\model\DeliveryEstimateInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'minimum' => null, + 'maximum' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'minimum' => false, + 'maximum' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'minimum' => 'minimum', + 'maximum' => 'maximum' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'minimum' => 'setMinimum', + 'maximum' => 'setMaximum' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'minimum' => 'getMinimum', + 'maximum' => 'getMaximum' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('minimum', $data ?? [], null); + $this->setIfExists('maximum', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets minimum + * + * @return \request\model\DeliveryEstimateInfo|null + */ + public function getMinimum() + { + return $this->container['minimum']; + } + + /** + * Sets minimum + * + * @param \request\model\DeliveryEstimateInfo|null $minimum minimum + * + * @return self + */ + public function setMinimum($minimum) + { + $this->container['minimum'] = $minimum; + + return $this; + } + + /** + * Gets maximum + * + * @return \request\model\DeliveryEstimateInfo|null + */ + public function getMaximum() + { + return $this->container['maximum']; + } + + /** + * Sets maximum + * + * @param \request\model\DeliveryEstimateInfo|null $maximum maximum + * + * @return self + */ + public function setMaximum($maximum) + { + $this->container['maximum'] = $maximum; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/DeliveryEstimateInfo.php b/model/DeliveryEstimateInfo.php new file mode 100644 index 0000000..ea529ac --- /dev/null +++ b/model/DeliveryEstimateInfo.php @@ -0,0 +1,447 @@ + + */ +class DeliveryEstimateInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DeliveryEstimateInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'unit' => 'string', + 'value' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'unit' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'unit' => false, + 'value' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'unit' => 'unit', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'unit' => 'setUnit', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'unit' => 'getUnit', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets unit + * + * @return string + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit Units for the longest shipping time of logistics services. The valid values include: YEAR: Indicates that the shortest shipping time unit for logistics services is in years. MONTH: Indicates that the shortest shipping time unit for logistics services is in months. DAY: Indicates that the shortest shipping time unit for logistics services is in days. HOUR: Indicates that the shortest shipping time unit for logistics services is in hours. MINUTE: Indicates that the shortest shipping time unit for logistics services is in minutes. SECOND: Indicates that the shortest shipping time unit for logistics services is in seconds. More information: Maximum length: 16 characters + * + * @return self + */ + public function setUnit($unit) + { + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets value + * + * @return int + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int $value Estimated value for the longest shipping time of logistics services. More information: Value range: [0, +∞) + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Discount.php b/model/Discount.php index 5d8336e..a5cd0bb 100644 --- a/model/Discount.php +++ b/model/Discount.php @@ -1,96 +1,503 @@ + */ +class Discount implements ModelInterface, ArrayAccess, \JsonSerializable { - public $discountTag; - public $discountName; - public $savingsAmount; - public $estimateSavingsAmount; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Discount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discountTag' => 'string', + 'discountName' => 'string', + 'savingsAmount' => '\request\model\Amount', + 'estimateSavingsAmount' => '\request\model\Amount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discountTag' => null, + 'discountName' => null, + 'savingsAmount' => null, + 'estimateSavingsAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'discountTag' => false, + 'discountName' => false, + 'savingsAmount' => false, + 'estimateSavingsAmount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } - public $promotionCode; + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } /** - * @return mixed + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull */ - public function getPromotionCode() + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - return $this->promotionCode; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** - * @param mixed $promotionCode + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public function setPromotionCode($promotionCode) + public static function isNullable(string $property): bool { - $this->promotionCode = $promotionCode; + return self::openAPINullables()[$property] ?? false; } /** - * @return mixed + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'discountTag' => 'discountTag', + 'discountName' => 'discountName', + 'savingsAmount' => 'savingsAmount', + 'estimateSavingsAmount' => 'estimateSavingsAmount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discountTag' => 'setDiscountTag', + 'discountName' => 'setDiscountName', + 'savingsAmount' => 'setSavingsAmount', + 'estimateSavingsAmount' => 'setEstimateSavingsAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discountTag' => 'getDiscountTag', + 'discountName' => 'getDiscountName', + 'savingsAmount' => 'getSavingsAmount', + 'estimateSavingsAmount' => 'getEstimateSavingsAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('discountTag', $data ?? [], null); + $this->setIfExists('discountName', $data ?? [], null); + $this->setIfExists('savingsAmount', $data ?? [], null); + $this->setIfExists('estimateSavingsAmount', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets discountTag + * + * @return string|null */ public function getDiscountTag() { - return $this->discountTag; + return $this->container['discountTag']; } /** - * @param mixed $discountTag + * Sets discountTag + * + * @param string|null $discountTag discountTag + * + * @return self */ public function setDiscountTag($discountTag) { - $this->discountTag = $discountTag; + $this->container['discountTag'] = $discountTag; + + return $this; } /** - * @return mixed + * Gets discountName + * + * @return string|null */ public function getDiscountName() { - return $this->discountName; + return $this->container['discountName']; } /** - * @param mixed $discountName + * Sets discountName + * + * @param string|null $discountName The discount name displayed in the default language. More information: Maximum length: 128 characters + * + * @return self */ public function setDiscountName($discountName) { - $this->discountName = $discountName; + $this->container['discountName'] = $discountName; + + return $this; } /** - * @return mixed + * Gets savingsAmount + * + * @return \request\model\Amount|null */ public function getSavingsAmount() { - return $this->savingsAmount; + return $this->container['savingsAmount']; } /** - * @param mixed $savingsAmount + * Sets savingsAmount + * + * @param \request\model\Amount|null $savingsAmount savingsAmount + * + * @return self */ public function setSavingsAmount($savingsAmount) { - $this->savingsAmount = $savingsAmount; + $this->container['savingsAmount'] = $savingsAmount; + + return $this; } /** - * @return mixed + * Gets estimateSavingsAmount + * + * @return \request\model\Amount|null */ public function getEstimateSavingsAmount() { - return $this->estimateSavingsAmount; + return $this->container['estimateSavingsAmount']; } /** - * @param mixed $estimateSavingsAmount + * Sets estimateSavingsAmount + * + * @param \request\model\Amount|null $estimateSavingsAmount estimateSavingsAmount + * + * @return self */ public function setEstimateSavingsAmount($estimateSavingsAmount) { - $this->estimateSavingsAmount = $estimateSavingsAmount; + $this->container['estimateSavingsAmount'] = $estimateSavingsAmount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/DiscountPaymentMethodDetail.php b/model/DiscountPaymentMethodDetail.php index becbee1..5b2a1be 100644 --- a/model/DiscountPaymentMethodDetail.php +++ b/model/DiscountPaymentMethodDetail.php @@ -1,92 +1,534 @@ + */ +class DiscountPaymentMethodDetail implements ModelInterface, ArrayAccess, \JsonSerializable { - public $discountId; - public $availableAmount; - public $discountName; - public $discountDescription; - public $paymentMethodDetailMetadata; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DiscountPaymentMethodDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discountId' => 'string', + 'availableAmount' => '\request\model\Amount', + 'discountName' => 'string', + 'discountDescription' => 'string', + 'paymentMethodDetailMetadata' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discountId' => null, + 'availableAmount' => null, + 'discountName' => null, + 'discountDescription' => null, + 'paymentMethodDetailMetadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'discountId' => false, + 'availableAmount' => false, + 'discountName' => false, + 'discountDescription' => false, + 'paymentMethodDetailMetadata' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'discountId' => 'discountId', + 'availableAmount' => 'availableAmount', + 'discountName' => 'discountName', + 'discountDescription' => 'discountDescription', + 'paymentMethodDetailMetadata' => 'paymentMethodDetailMetadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discountId' => 'setDiscountId', + 'availableAmount' => 'setAvailableAmount', + 'discountName' => 'setDiscountName', + 'discountDescription' => 'setDiscountDescription', + 'paymentMethodDetailMetadata' => 'setPaymentMethodDetailMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discountId' => 'getDiscountId', + 'availableAmount' => 'getAvailableAmount', + 'discountName' => 'getDiscountName', + 'discountDescription' => 'getDiscountDescription', + 'paymentMethodDetailMetadata' => 'getPaymentMethodDetailMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('discountId', $data ?? [], null); + $this->setIfExists('availableAmount', $data ?? [], null); + $this->setIfExists('discountName', $data ?? [], null); + $this->setIfExists('discountDescription', $data ?? [], null); + $this->setIfExists('paymentMethodDetailMetadata', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets discountId + * + * @return string|null */ public function getDiscountId() { - return $this->discountId; + return $this->container['discountId']; } /** - * @param mixed $discountId + * Sets discountId + * + * @param string|null $discountId discountId + * + * @return self */ public function setDiscountId($discountId) { - $this->discountId = $discountId; + $this->container['discountId'] = $discountId; + + return $this; } /** - * @return mixed + * Gets availableAmount + * + * @return \request\model\Amount|null */ public function getAvailableAmount() { - return $this->availableAmount; + return $this->container['availableAmount']; } /** - * @param mixed $availableAmount + * Sets availableAmount + * + * @param \request\model\Amount|null $availableAmount availableAmount + * + * @return self */ public function setAvailableAmount($availableAmount) { - $this->availableAmount = $availableAmount; + $this->container['availableAmount'] = $availableAmount; + + return $this; } /** - * @return mixed + * Gets discountName + * + * @return string|null */ public function getDiscountName() { - return $this->discountName; + return $this->container['discountName']; } /** - * @param mixed $discountName + * Sets discountName + * + * @param string|null $discountName discountName + * + * @return self */ public function setDiscountName($discountName) { - $this->discountName = $discountName; + $this->container['discountName'] = $discountName; + + return $this; } /** - * @return mixed + * Gets discountDescription + * + * @return string|null */ public function getDiscountDescription() { - return $this->discountDescription; + return $this->container['discountDescription']; } /** - * @param mixed $discountDescription + * Sets discountDescription + * + * @param string|null $discountDescription discountDescription + * + * @return self */ public function setDiscountDescription($discountDescription) { - $this->discountDescription = $discountDescription; + $this->container['discountDescription'] = $discountDescription; + + return $this; } /** - * @return mixed + * Gets paymentMethodDetailMetadata + * + * @return string|null */ public function getPaymentMethodDetailMetadata() { - return $this->paymentMethodDetailMetadata; + return $this->container['paymentMethodDetailMetadata']; } /** - * @param mixed $paymentMethodDetailMetadata + * Sets paymentMethodDetailMetadata + * + * @param string|null $paymentMethodDetailMetadata paymentMethodDetailMetadata + * + * @return self */ public function setPaymentMethodDetailMetadata($paymentMethodDetailMetadata) { - $this->paymentMethodDetailMetadata = $paymentMethodDetailMetadata; + $this->container['paymentMethodDetailMetadata'] = $paymentMethodDetailMetadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/DisplayType.php b/model/DisplayType.php index 4972093..eabfa82 100644 --- a/model/DisplayType.php +++ b/model/DisplayType.php @@ -1,10 +1,34 @@ + */ +class EntityAssociations implements ModelInterface, ArrayAccess, \JsonSerializable { - public $associationType; - public $legalEntityType; + public const DISCRIMINATOR = null; - public $company; - public $individual; - public $shareholdingRatio; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EntityAssociations'; /** - * @return mixed + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associationType' => '\request\model\AssociationType', + 'legalEntityType' => '\request\model\LegalEntityType', + 'company' => '\request\model\Company', + 'individual' => '\request\model\Individual', + 'shareholdingRatio' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associationType' => null, + 'legalEntityType' => null, + 'company' => null, + 'individual' => null, + 'shareholdingRatio' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'associationType' => false, + 'legalEntityType' => false, + 'company' => false, + 'individual' => false, + 'shareholdingRatio' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array */ - public function getAssociationType() + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associationType' => 'associationType', + 'legalEntityType' => 'legalEntityType', + 'company' => 'company', + 'individual' => 'individual', + 'shareholdingRatio' => 'shareholdingRatio' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associationType' => 'setAssociationType', + 'legalEntityType' => 'setLegalEntityType', + 'company' => 'setCompany', + 'individual' => 'setIndividual', + 'shareholdingRatio' => 'setShareholdingRatio' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associationType' => 'getAssociationType', + 'legalEntityType' => 'getLegalEntityType', + 'company' => 'getCompany', + 'individual' => 'getIndividual', + 'shareholdingRatio' => 'getShareholdingRatio' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associationType', $data ?? [], null); + $this->setIfExists('legalEntityType', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('individual', $data ?? [], null); + $this->setIfExists('shareholdingRatio', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - return $this->associationType; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** - * @param mixed $associationType + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public function setAssociationType($associationType) + public function listInvalidProperties() { - $this->associationType = $associationType; + $invalidProperties = []; + + if ($this->container['associationType'] === null) { + $invalidProperties[] = "'associationType' can't be null"; + } + if ($this->container['legalEntityType'] === null) { + $invalidProperties[] = "'legalEntityType' can't be null"; + } + return $invalidProperties; } + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + /** + * Gets associationType + * + * @return \request\model\AssociationType + */ + public function getAssociationType() + { + return $this->container['associationType']; + } + + /** + * Sets associationType + * + * @param \request\model\AssociationType $associationType associationType + * + * @return self + */ + public function setAssociationType($associationType) + { + $this->container['associationType'] = $associationType; + + return $this; + } /** - * @return mixed + * Gets legalEntityType + * + * @return \request\model\LegalEntityType */ public function getLegalEntityType() { - return $this->legalEntityType; + return $this->container['legalEntityType']; } /** - * @param mixed $legalEntityType + * Sets legalEntityType + * + * @param \request\model\LegalEntityType $legalEntityType legalEntityType + * + * @return self */ - public function setLegalEntityType($legalEntityType) + public function setLegalEntityType($legalEntityType) { - $this->legalEntityType = $legalEntityType; + $this->container['legalEntityType'] = $legalEntityType; + + return $this; } /** - * @return mixed + * Gets company + * + * @return \request\model\Company|null */ public function getCompany() { - return $this->company; + return $this->container['company']; } /** - * @param mixed $company + * Sets company + * + * @param \request\model\Company|null $company company + * + * @return self */ - public function setCompany($company) + public function setCompany($company) { - $this->company = $company; + $this->container['company'] = $company; + + return $this; } /** - * @return mixed + * Gets individual + * + * @return \request\model\Individual|null */ public function getIndividual() { - return $this->individual; + return $this->container['individual']; } /** - * @param mixed $individual + * Sets individual + * + * @param \request\model\Individual|null $individual individual + * + * @return self */ - public function setIndividual($individual) + public function setIndividual($individual) { - $this->individual = $individual; + $this->container['individual'] = $individual; + + return $this; } /** - * @return mixed + * Gets shareholdingRatio + * + * @return string|null */ public function getShareholdingRatio() { - return $this->shareholdingRatio; + return $this->container['shareholdingRatio']; + } + + /** + * Sets shareholdingRatio + * + * @param string|null $shareholdingRatio The shareholding ratio of the associated legal entity. The value of this parameter is from 0 to 100. For example, 10.5 represents that the shareholding ratio is 10.5%. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR, AU, SG, HK, US, GB, MY, or the company's registered region belongs to the European Union. More information: Maximum length: 16 characters + * + * @return self + */ + public function setShareholdingRatio($shareholdingRatio) + { + $this->container['shareholdingRatio'] = $shareholdingRatio; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $shareholdingRatio + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setShareholdingRatio($shareholdingRatio) + public function offsetSet($offset, $value): void { - $this->shareholdingRatio = $shareholdingRatio; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Env.php b/model/Env.php index 1393cde..3a1f117 100644 --- a/model/Env.php +++ b/model/Env.php @@ -1,316 +1,971 @@ + */ +class Env implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Env'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'terminalType' => '\request\model\TerminalType', + 'osType' => '\request\model\OsType', + 'userAgent' => 'string', + 'deviceTokenId' => 'string', + 'clientIp' => 'string', + 'cookieId' => 'string', + 'extendInfo' => 'string', + 'storeTerminalId' => 'string', + 'storeTerminalRequestTime' => 'string', + 'browserInfo' => '\request\model\BrowserInfo', + 'colorDepth' => 'string', + 'screenHeight' => 'string', + 'screenWidth' => 'string', + 'timeZoneOffset' => 'int', + 'deviceBrand' => 'string', + 'deviceModel' => 'string', + 'deviceLanguage' => 'string', + 'deviceId' => 'string', + 'envType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'terminalType' => null, + 'osType' => null, + 'userAgent' => null, + 'deviceTokenId' => null, + 'clientIp' => null, + 'cookieId' => null, + 'extendInfo' => null, + 'storeTerminalId' => null, + 'storeTerminalRequestTime' => null, + 'browserInfo' => null, + 'colorDepth' => null, + 'screenHeight' => null, + 'screenWidth' => null, + 'timeZoneOffset' => null, + 'deviceBrand' => null, + 'deviceModel' => null, + 'deviceLanguage' => null, + 'deviceId' => null, + 'envType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'terminalType' => false, + 'osType' => false, + 'userAgent' => false, + 'deviceTokenId' => false, + 'clientIp' => false, + 'cookieId' => false, + 'extendInfo' => false, + 'storeTerminalId' => false, + 'storeTerminalRequestTime' => false, + 'browserInfo' => false, + 'colorDepth' => false, + 'screenHeight' => false, + 'screenWidth' => false, + 'timeZoneOffset' => true, + 'deviceBrand' => false, + 'deviceModel' => false, + 'deviceLanguage' => false, + 'deviceId' => false, + 'envType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'terminalType' => 'terminalType', + 'osType' => 'osType', + 'userAgent' => 'userAgent', + 'deviceTokenId' => 'deviceTokenId', + 'clientIp' => 'clientIp', + 'cookieId' => 'cookieId', + 'extendInfo' => 'extendInfo', + 'storeTerminalId' => 'storeTerminalId', + 'storeTerminalRequestTime' => 'storeTerminalRequestTime', + 'browserInfo' => 'browserInfo', + 'colorDepth' => 'colorDepth', + 'screenHeight' => 'screenHeight', + 'screenWidth' => 'screenWidth', + 'timeZoneOffset' => 'timeZoneOffset', + 'deviceBrand' => 'deviceBrand', + 'deviceModel' => 'deviceModel', + 'deviceLanguage' => 'deviceLanguage', + 'deviceId' => 'deviceId', + 'envType' => 'envType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'terminalType' => 'setTerminalType', + 'osType' => 'setOsType', + 'userAgent' => 'setUserAgent', + 'deviceTokenId' => 'setDeviceTokenId', + 'clientIp' => 'setClientIp', + 'cookieId' => 'setCookieId', + 'extendInfo' => 'setExtendInfo', + 'storeTerminalId' => 'setStoreTerminalId', + 'storeTerminalRequestTime' => 'setStoreTerminalRequestTime', + 'browserInfo' => 'setBrowserInfo', + 'colorDepth' => 'setColorDepth', + 'screenHeight' => 'setScreenHeight', + 'screenWidth' => 'setScreenWidth', + 'timeZoneOffset' => 'setTimeZoneOffset', + 'deviceBrand' => 'setDeviceBrand', + 'deviceModel' => 'setDeviceModel', + 'deviceLanguage' => 'setDeviceLanguage', + 'deviceId' => 'setDeviceId', + 'envType' => 'setEnvType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'terminalType' => 'getTerminalType', + 'osType' => 'getOsType', + 'userAgent' => 'getUserAgent', + 'deviceTokenId' => 'getDeviceTokenId', + 'clientIp' => 'getClientIp', + 'cookieId' => 'getCookieId', + 'extendInfo' => 'getExtendInfo', + 'storeTerminalId' => 'getStoreTerminalId', + 'storeTerminalRequestTime' => 'getStoreTerminalRequestTime', + 'browserInfo' => 'getBrowserInfo', + 'colorDepth' => 'getColorDepth', + 'screenHeight' => 'getScreenHeight', + 'screenWidth' => 'getScreenWidth', + 'timeZoneOffset' => 'getTimeZoneOffset', + 'deviceBrand' => 'getDeviceBrand', + 'deviceModel' => 'getDeviceModel', + 'deviceLanguage' => 'getDeviceLanguage', + 'deviceId' => 'getDeviceId', + 'envType' => 'getEnvType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('terminalType', $data ?? [], null); + $this->setIfExists('osType', $data ?? [], null); + $this->setIfExists('userAgent', $data ?? [], null); + $this->setIfExists('deviceTokenId', $data ?? [], null); + $this->setIfExists('clientIp', $data ?? [], null); + $this->setIfExists('cookieId', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('storeTerminalId', $data ?? [], null); + $this->setIfExists('storeTerminalRequestTime', $data ?? [], null); + $this->setIfExists('browserInfo', $data ?? [], null); + $this->setIfExists('colorDepth', $data ?? [], null); + $this->setIfExists('screenHeight', $data ?? [], null); + $this->setIfExists('screenWidth', $data ?? [], null); + $this->setIfExists('timeZoneOffset', $data ?? [], null); + $this->setIfExists('deviceBrand', $data ?? [], null); + $this->setIfExists('deviceModel', $data ?? [], null); + $this->setIfExists('deviceLanguage', $data ?? [], null); + $this->setIfExists('deviceId', $data ?? [], null); + $this->setIfExists('envType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['terminalType'] === null) { + $invalidProperties[] = "'terminalType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + - public $terminalType; - public $osType; - public $userAgent; - public $deviceTokenId; - public $clientIp; - public $cookieId; - public $storeTerminalId; - public $storeTerminalRequestTime; - - public $extendInfo; - public $browserInfo; - public $colorDepth; - public $screenHeight; - public $screenWidth; - public $timeZoneOffset; - public $deviceBrand; - public $deviceModel; - public $deviceLanguage; - public $deviceId; - - /** - * @return String + /** + * Gets terminalType + * + * @return \request\model\TerminalType */ public function getTerminalType() { - return $this->terminalType; + return $this->container['terminalType']; } /** - * @param String $terminalType + * Sets terminalType + * + * @param \request\model\TerminalType $terminalType terminalType + * + * @return self */ public function setTerminalType($terminalType) { - $this->terminalType = $terminalType; + $this->container['terminalType'] = $terminalType; + + return $this; } /** - * @return OsType + * Gets osType + * + * @return \request\model\OsType|null */ public function getOsType() { - return $this->osType; + return $this->container['osType']; } /** - * @param OsType $osType + * Sets osType + * + * @param \request\model\OsType|null $osType osType + * + * @return self */ public function setOsType($osType) { - $this->osType = $osType; + $this->container['osType'] = $osType; + + return $this; } /** - * @return String + * Gets userAgent + * + * @return string|null */ public function getUserAgent() { - return $this->userAgent; + return $this->container['userAgent']; } /** - * @param String $userAgent + * Sets userAgent + * + * @param string|null $userAgent userAgent + * + * @return self */ public function setUserAgent($userAgent) { - $this->userAgent = $userAgent; + $this->container['userAgent'] = $userAgent; + + return $this; } /** - * @return String + * Gets deviceTokenId + * + * @return string|null */ public function getDeviceTokenId() { - return $this->deviceTokenId; + return $this->container['deviceTokenId']; } /** - * @param String $deviceTokenId + * Sets deviceTokenId + * + * @param string|null $deviceTokenId The token identifier of the device. Note: Specify this parameter if you integrate with the Antom Device Fingerprint client, which is an SDK or JavaScript library that is used to collect device-related information, such as osType, deviceLanguage, deviceId, websiteLanguage, and userAgent. The device-related information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. For more information about the Antom Device Fingerprint client, contact Antom Technical Support. More information: Maximum length: 64 characters + * + * @return self */ public function setDeviceTokenId($deviceTokenId) { - $this->deviceTokenId = $deviceTokenId; + $this->container['deviceTokenId'] = $deviceTokenId; + + return $this; } /** - * @return String + * Gets clientIp + * + * @return string|null */ public function getClientIp() { - return $this->clientIp; + return $this->container['clientIp']; } /** - * @param String $clientIp + * Sets clientIp + * + * @param string|null $clientIp Client IP address of the device. + * + * @return self */ public function setClientIp($clientIp) { - $this->clientIp = $clientIp; + $this->container['clientIp'] = $clientIp; + + return $this; } /** - * @return String + * Gets cookieId + * + * @return string|null */ public function getCookieId() { - return $this->cookieId; + return $this->container['cookieId']; } /** - * @param String $cookieId + * Sets cookieId + * + * @param string|null $cookieId cookieId + * + * @return self */ public function setCookieId($cookieId) { - $this->cookieId = $cookieId; + $this->container['cookieId'] = $cookieId; + + return $this; } /** - * @return String + * Gets extendInfo + * + * @return string|null */ - public function getStoreTerminalId() + public function getExtendInfo() { - return $this->storeTerminalId; + return $this->container['extendInfo']; } /** - * @param String $storeTerminalId + * Sets extendInfo + * + * @param string|null $extendInfo Extended information. Specify this field if you need to use the extended information. More information: Maximum length: 2048 characters + * + * @return self */ - public function setStoreTerminalId($storeTerminalId) + public function setExtendInfo($extendInfo) { - $this->storeTerminalId = $storeTerminalId; + $this->container['extendInfo'] = $extendInfo; + + return $this; } /** - * @return String + * Gets storeTerminalId + * + * @return string|null */ - public function getStoreTerminalRequestTime() + public function getStoreTerminalId() { - return $this->storeTerminalRequestTime; + return $this->container['storeTerminalId']; } /** - * @param String $storeTerminalRequestTime + * Sets storeTerminalId + * + * @param string|null $storeTerminalId storeTerminalId + * + * @return self */ - public function setStoreTerminalRequestTime($storeTerminalRequestTime) + public function setStoreTerminalId($storeTerminalId) { - $this->storeTerminalRequestTime = $storeTerminalRequestTime; + $this->container['storeTerminalId'] = $storeTerminalId; + + return $this; } /** - * @return String + * Gets storeTerminalRequestTime + * + * @return string|null */ - public function getExtendInfo() + public function getStoreTerminalRequestTime() { - return $this->extendInfo; + return $this->container['storeTerminalRequestTime']; } /** - * @param String $extendInfo + * Sets storeTerminalRequestTime + * + * @param string|null $storeTerminalRequestTime storeTerminalRequestTime + * + * @return self */ - public function setExtendInfo($extendInfo) + public function setStoreTerminalRequestTime($storeTerminalRequestTime) { - $this->extendInfo = $extendInfo; + $this->container['storeTerminalRequestTime'] = $storeTerminalRequestTime; + + return $this; } /** - * @return mixed + * Gets browserInfo + * + * @return \request\model\BrowserInfo|null */ public function getBrowserInfo() { - return $this->browserInfo; + return $this->container['browserInfo']; } /** - * @param mixed $browserInfo + * Sets browserInfo + * + * @param \request\model\BrowserInfo|null $browserInfo browserInfo + * + * @return self */ public function setBrowserInfo($browserInfo) { - $this->browserInfo = $browserInfo; + $this->container['browserInfo'] = $browserInfo; + + return $this; } /** - * @return mixed + * Gets colorDepth + * + * @return string|null */ public function getColorDepth() { - return $this->colorDepth; + return $this->container['colorDepth']; } /** - * @param mixed $colorDepth + * Sets colorDepth + * + * @param string|null $colorDepth The color depth of the user's browser in bits per pixel. The value is obtained by using the browser's screen.colorDepth property. Valid values are 1, 4, 8, 15, 16, 24, 30, 32, or 48. For example, 8 means 8-bit color depth. More information: Value range: 0 - unlimited + * + * @return self */ public function setColorDepth($colorDepth) { - $this->colorDepth = $colorDepth; + $this->container['colorDepth'] = $colorDepth; + + return $this; } /** - * @return mixed + * Gets screenHeight + * + * @return string|null */ public function getScreenHeight() { - return $this->screenHeight; + return $this->container['screenHeight']; } /** - * @param mixed $screenHeight + * Sets screenHeight + * + * @param string|null $screenHeight The screen height of the user's device in pixels. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: 1 - unlimited + * + * @return self */ public function setScreenHeight($screenHeight) { - $this->screenHeight = $screenHeight; + $this->container['screenHeight'] = $screenHeight; + + return $this; } /** - * @return mixed + * Gets screenWidth + * + * @return string|null */ public function getScreenWidth() { - return $this->screenWidth; + return $this->container['screenWidth']; } /** - * @param mixed $screenWidth + * Sets screenWidth + * + * @param string|null $screenWidth The screen width of the user's device in pixels. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: 1 - unlimited + * + * @return self */ public function setScreenWidth($screenWidth) { - $this->screenWidth = $screenWidth; + $this->container['screenWidth'] = $screenWidth; + + return $this; } /** - * @return mixed + * Gets timeZoneOffset + * + * @return int|null */ public function getTimeZoneOffset() { - return $this->timeZoneOffset; + return $this->container['timeZoneOffset']; } /** - * @param mixed $timeZoneOffset + * Sets timeZoneOffset + * + * @param int|null $timeZoneOffset The time difference between UTC time and the local time of the user's browser, in minutes. The value is obtained by using the getTimezoneOffset() property. For example, if the local time of the user's browser is UTC+2, the value of this parameter is -120. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: -720 - 720 + * + * @return self */ public function setTimeZoneOffset($timeZoneOffset) { - $this->timeZoneOffset = $timeZoneOffset; + $this->container['timeZoneOffset'] = $timeZoneOffset; + + return $this; } /** - * @return mixed + * Gets deviceBrand + * + * @return string|null */ public function getDeviceBrand() { - return $this->deviceBrand; + return $this->container['deviceBrand']; } /** - * @param mixed $deviceBrand + * Sets deviceBrand + * + * @param string|null $deviceBrand The brand of the user's device. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + * + * @return self */ public function setDeviceBrand($deviceBrand) { - $this->deviceBrand = $deviceBrand; + $this->container['deviceBrand'] = $deviceBrand; + + return $this; } /** - * @return mixed + * Gets deviceModel + * + * @return string|null */ public function getDeviceModel() { - return $this->deviceModel; + return $this->container['deviceModel']; } /** - * @param mixed $deviceModel + * Sets deviceModel + * + * @param string|null $deviceModel The model of the user's device. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 128 characters + * + * @return self */ public function setDeviceModel($deviceModel) { - $this->deviceModel = $deviceModel; + $this->container['deviceModel'] = $deviceModel; + + return $this; } /** - * @return mixed + * Gets deviceLanguage + * + * @return string|null */ public function getDeviceLanguage() { - return $this->deviceLanguage; + return $this->container['deviceLanguage']; } /** - * @param mixed $deviceLanguage + * Sets deviceLanguage + * + * @param string|null $deviceLanguage Device language of the user. + * + * @return self */ public function setDeviceLanguage($deviceLanguage) { - $this->deviceLanguage = $deviceLanguage; + $this->container['deviceLanguage'] = $deviceLanguage; + + return $this; } /** - * @return mixed + * Gets deviceId + * + * @return string|null */ public function getDeviceId() { - return $this->deviceId; + return $this->container['deviceId']; } /** - * @param mixed $deviceId + * Sets deviceId + * + * @param string|null $deviceId Device ID of the user. + * + * @return self */ public function setDeviceId($deviceId) { - $this->deviceId = $deviceId; + $this->container['deviceId'] = $deviceId; + + return $this; } -} \ No newline at end of file + /** + * Gets envType + * + * @return string|null + */ + public function getEnvType() + { + return $this->container['envType']; + } + + /** + * Sets envType + * + * @param string|null $envType + * + * @return self + */ + public function setEnvType($envType) + { + $this->container['envType'] = $envType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/ExternalPaymentMethodDetail.php b/model/ExternalPaymentMethodDetail.php index 83ddcf4..d8bc33f 100644 --- a/model/ExternalPaymentMethodDetail.php +++ b/model/ExternalPaymentMethodDetail.php @@ -1,76 +1,503 @@ + */ +class ExternalPaymentMethodDetail implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExternalPaymentMethodDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'assetToken' => 'string', + 'accountDisplayName' => 'string', + 'disableReason' => 'string', + 'paymentMethodDetailMetadata' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'assetToken' => null, + 'accountDisplayName' => null, + 'disableReason' => null, + 'paymentMethodDetailMetadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'assetToken' => false, + 'accountDisplayName' => false, + 'disableReason' => false, + 'paymentMethodDetailMetadata' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'assetToken' => 'assetToken', + 'accountDisplayName' => 'accountDisplayName', + 'disableReason' => 'disableReason', + 'paymentMethodDetailMetadata' => 'paymentMethodDetailMetadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'assetToken' => 'setAssetToken', + 'accountDisplayName' => 'setAccountDisplayName', + 'disableReason' => 'setDisableReason', + 'paymentMethodDetailMetadata' => 'setPaymentMethodDetailMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'assetToken' => 'getAssetToken', + 'accountDisplayName' => 'getAccountDisplayName', + 'disableReason' => 'getDisableReason', + 'paymentMethodDetailMetadata' => 'getPaymentMethodDetailMetadata' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - public $assetToken; - public $accountDisplayName; - public $disableReason; - public $paymentMethodDetailMetadata; /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('assetToken', $data ?? [], null); + $this->setIfExists('accountDisplayName', $data ?? [], null); + $this->setIfExists('disableReason', $data ?? [], null); + $this->setIfExists('paymentMethodDetailMetadata', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets assetToken + * + * @return string|null */ public function getAssetToken() { - return $this->assetToken; + return $this->container['assetToken']; } /** - * @param mixed $assetToken + * Sets assetToken + * + * @param string|null $assetToken assetToken + * + * @return self */ public function setAssetToken($assetToken) { - $this->assetToken = $assetToken; + $this->container['assetToken'] = $assetToken; + + return $this; } /** - * @return mixed + * Gets accountDisplayName + * + * @return string|null */ public function getAccountDisplayName() { - return $this->accountDisplayName; + return $this->container['accountDisplayName']; } /** - * @param mixed $accountDisplayName + * Sets accountDisplayName + * + * @param string|null $accountDisplayName accountDisplayName + * + * @return self */ public function setAccountDisplayName($accountDisplayName) { - $this->accountDisplayName = $accountDisplayName; + $this->container['accountDisplayName'] = $accountDisplayName; + + return $this; } /** - * @return mixed + * Gets disableReason + * + * @return string|null */ public function getDisableReason() { - return $this->disableReason; + return $this->container['disableReason']; } /** - * @param mixed $disableReason + * Sets disableReason + * + * @param string|null $disableReason disableReason + * + * @return self */ public function setDisableReason($disableReason) { - $this->disableReason = $disableReason; + $this->container['disableReason'] = $disableReason; + + return $this; } /** - * @return mixed + * Gets paymentMethodDetailMetadata + * + * @return string|null */ public function getPaymentMethodDetailMetadata() { - return $this->paymentMethodDetailMetadata; + return $this->container['paymentMethodDetailMetadata']; } /** - * @param mixed $paymentMethodDetailMetadata + * Sets paymentMethodDetailMetadata + * + * @param string|null $paymentMethodDetailMetadata paymentMethodDetailMetadata + * + * @return self */ public function setPaymentMethodDetailMetadata($paymentMethodDetailMetadata) { - $this->paymentMethodDetailMetadata = $paymentMethodDetailMetadata; + $this->container['paymentMethodDetailMetadata'] = $paymentMethodDetailMetadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Gaming.php b/model/Gaming.php index 8f53cac..55e8da1 100644 --- a/model/Gaming.php +++ b/model/Gaming.php @@ -1,78 +1,503 @@ + */ +class Gaming implements ModelInterface, ArrayAccess, \JsonSerializable { - public $gameName; - public $toppedUpUser; - public $toppedUpEmail; - public $toppedUpPhoneNo; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Gaming'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'gameName' => 'string', + 'toppedUpUser' => 'string', + 'toppedUpEmail' => 'string', + 'toppedUpPhoneNo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'gameName' => null, + 'toppedUpUser' => null, + 'toppedUpEmail' => null, + 'toppedUpPhoneNo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'gameName' => false, + 'toppedUpUser' => false, + 'toppedUpEmail' => false, + 'toppedUpPhoneNo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'gameName' => 'gameName', + 'toppedUpUser' => 'toppedUpUser', + 'toppedUpEmail' => 'toppedUpEmail', + 'toppedUpPhoneNo' => 'toppedUpPhoneNo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'gameName' => 'setGameName', + 'toppedUpUser' => 'setToppedUpUser', + 'toppedUpEmail' => 'setToppedUpEmail', + 'toppedUpPhoneNo' => 'setToppedUpPhoneNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'gameName' => 'getGameName', + 'toppedUpUser' => 'getToppedUpUser', + 'toppedUpEmail' => 'getToppedUpEmail', + 'toppedUpPhoneNo' => 'getToppedUpPhoneNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('gameName', $data ?? [], null); + $this->setIfExists('toppedUpUser', $data ?? [], null); + $this->setIfExists('toppedUpEmail', $data ?? [], null); + $this->setIfExists('toppedUpPhoneNo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + /** - * @return mixed + * Gets gameName + * + * @return string|null */ public function getGameName() { - return $this->gameName; + return $this->container['gameName']; } /** - * @param mixed $gameName + * Sets gameName + * + * @param string|null $gameName Game name. More information: Maximum length: 128 characters + * + * @return self */ - public function setGameName($gameName) + public function setGameName($gameName) { - $this->gameName = $gameName; + $this->container['gameName'] = $gameName; + + return $this; } /** - * @return mixed + * Gets toppedUpUser + * + * @return string|null */ public function getToppedUpUser() { - return $this->toppedUpUser; + return $this->container['toppedUpUser']; } /** - * @param mixed $toppedUpUser + * Sets toppedUpUser + * + * @param string|null $toppedUpUser Name or ID of the user whose gaming account is topped up. More information: Maximum length: 128 characters + * + * @return self */ - public function setToppedUpUser($toppedUpUser) + public function setToppedUpUser($toppedUpUser) { - $this->toppedUpUser = $toppedUpUser; + $this->container['toppedUpUser'] = $toppedUpUser; + + return $this; } /** - * @return mixed + * Gets toppedUpEmail + * + * @return string|null */ public function getToppedUpEmail() { - return $this->toppedUpEmail; + return $this->container['toppedUpEmail']; } /** - * @param mixed $toppedUpEmail + * Sets toppedUpEmail + * + * @param string|null $toppedUpEmail More information: Maximum length: 64 characters + * + * @return self */ - public function setToppedUpEmail($toppedUpEmail) + public function setToppedUpEmail($toppedUpEmail) { - $this->toppedUpEmail = $toppedUpEmail; + $this->container['toppedUpEmail'] = $toppedUpEmail; + + return $this; } /** - * @return mixed + * Gets toppedUpPhoneNo + * + * @return string|null */ public function getToppedUpPhoneNo() { - return $this->toppedUpPhoneNo; + return $this->container['toppedUpPhoneNo']; + } + + /** + * Sets toppedUpPhoneNo + * + * @param string|null $toppedUpPhoneNo More information: Maximum length: 32 characters + * + * @return self + */ + public function setToppedUpPhoneNo($toppedUpPhoneNo) + { + $this->container['toppedUpPhoneNo'] = $toppedUpPhoneNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $toppedUpPhoneNo + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setToppedUpPhoneNo($toppedUpPhoneNo) + public function offsetSet($offset, $value): void { - $this->toppedUpPhoneNo = $toppedUpPhoneNo; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Goods.php b/model/Goods.php index 97c9ddc..4bd0717 100644 --- a/model/Goods.php +++ b/model/Goods.php @@ -1,235 +1,726 @@ + */ +class Goods implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; - public $referenceGoodsId; - public $goodsName; - public $goodsCategory; - public $goodsBrand; - public $goodsUnitAmount; - public $goodsQuantity; - public $goodsSkuName; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Goods'; - public $goodsUrl; - public $deliveryMethodType; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'referenceGoodsId' => 'string', + 'goodsName' => 'string', + 'goodsCategory' => 'string', + 'goodsBrand' => 'string', + 'goodsUnitAmount' => '\request\model\Amount', + 'goodsQuantity' => 'string', + 'goodsSkuName' => 'string', + 'goodsUrl' => 'string', + 'deliveryMethodType' => 'string', + 'goodsImageUrl' => 'string', + 'priceId' => 'string' + ]; - public $goodsImageUrl; - public $priceId; - public $goodsDiscountAmount; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'referenceGoodsId' => null, + 'goodsName' => null, + 'goodsCategory' => null, + 'goodsBrand' => null, + 'goodsUnitAmount' => null, + 'goodsQuantity' => null, + 'goodsSkuName' => null, + 'goodsUrl' => null, + 'deliveryMethodType' => null, + 'goodsImageUrl' => null, + 'priceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'referenceGoodsId' => false, + 'goodsName' => false, + 'goodsCategory' => false, + 'goodsBrand' => false, + 'goodsUnitAmount' => false, + 'goodsQuantity' => false, + 'goodsSkuName' => false, + 'goodsUrl' => false, + 'deliveryMethodType' => false, + 'goodsImageUrl' => false, + 'priceId' => false + ]; - public $crossSell; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; /** - * @return mixed + * Array of property to type mappings. Used for (de)serialization + * + * @return array */ - public function getGoodsDiscountAmount() + public static function openAPITypes() { - return $this->goodsDiscountAmount; + return self::$openAPITypes; } /** - * @param mixed $goodsDiscountAmount + * Array of property to format mappings. Used for (de)serialization + * + * @return array */ - public function setGoodsDiscountAmount($goodsDiscountAmount) + public static function openAPIFormats() { - $this->goodsDiscountAmount = $goodsDiscountAmount; + return self::$openAPIFormats; } /** - * @return mixed + * Array of nullable properties + * + * @return array */ - public function getCrossSell() + protected static function openAPINullables(): array { - return $this->crossSell; + return self::$openAPINullables; } /** - * @param mixed $crossSell + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public function setCrossSell($crossSell) + private function getOpenAPINullablesSetToNull(): array { - $this->crossSell = $crossSell; + return $this->openAPINullablesSetToNull; } + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } /** - * @return mixed + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public function getGoodsUrl() + public function isNullableSetToNull(string $property): bool { - return $this->goodsUrl; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * @param mixed $goodsUrl + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public function setGoodsUrl($goodsUrl) + protected static $attributeMap = [ + 'referenceGoodsId' => 'referenceGoodsId', + 'goodsName' => 'goodsName', + 'goodsCategory' => 'goodsCategory', + 'goodsBrand' => 'goodsBrand', + 'goodsUnitAmount' => 'goodsUnitAmount', + 'goodsQuantity' => 'goodsQuantity', + 'goodsSkuName' => 'goodsSkuName', + 'goodsUrl' => 'goodsUrl', + 'deliveryMethodType' => 'deliveryMethodType', + 'goodsImageUrl' => 'goodsImageUrl', + 'priceId' => 'priceId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'referenceGoodsId' => 'setReferenceGoodsId', + 'goodsName' => 'setGoodsName', + 'goodsCategory' => 'setGoodsCategory', + 'goodsBrand' => 'setGoodsBrand', + 'goodsUnitAmount' => 'setGoodsUnitAmount', + 'goodsQuantity' => 'setGoodsQuantity', + 'goodsSkuName' => 'setGoodsSkuName', + 'goodsUrl' => 'setGoodsUrl', + 'deliveryMethodType' => 'setDeliveryMethodType', + 'goodsImageUrl' => 'setGoodsImageUrl', + 'priceId' => 'setPriceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'referenceGoodsId' => 'getReferenceGoodsId', + 'goodsName' => 'getGoodsName', + 'goodsCategory' => 'getGoodsCategory', + 'goodsBrand' => 'getGoodsBrand', + 'goodsUnitAmount' => 'getGoodsUnitAmount', + 'goodsQuantity' => 'getGoodsQuantity', + 'goodsSkuName' => 'getGoodsSkuName', + 'goodsUrl' => 'getGoodsUrl', + 'deliveryMethodType' => 'getDeliveryMethodType', + 'goodsImageUrl' => 'getGoodsImageUrl', + 'priceId' => 'getPriceId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() { - $this->goodsUrl = $goodsUrl; + return self::$attributeMap; } /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public function getDeliveryMethodType() + public static function setters() { - return $this->deliveryMethodType; + return self::$setters; } /** - * @param mixed $deliveryMethodType + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public function setDeliveryMethodType($deliveryMethodType) + public static function getters() { - $this->deliveryMethodType = $deliveryMethodType; + return self::$getters; } /** - * @return mixed + * The original name of the model. + * + * @return string */ - public function getGoodsImageUrl() + public function getModelName() { - return $this->goodsImageUrl; + return self::$openAPIModelName; } + /** - * @param mixed $goodsImageUrl + * Associative array for storing property values + * + * @var mixed[] */ - public function setGoodsImageUrl($goodsImageUrl) + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - $this->goodsImageUrl = $goodsImageUrl; + $this->setIfExists('referenceGoodsId', $data ?? [], null); + $this->setIfExists('goodsName', $data ?? [], null); + $this->setIfExists('goodsCategory', $data ?? [], null); + $this->setIfExists('goodsBrand', $data ?? [], null); + $this->setIfExists('goodsUnitAmount', $data ?? [], null); + $this->setIfExists('goodsQuantity', $data ?? [], null); + $this->setIfExists('goodsSkuName', $data ?? [], null); + $this->setIfExists('goodsUrl', $data ?? [], null); + $this->setIfExists('deliveryMethodType', $data ?? [], null); + $this->setIfExists('goodsImageUrl', $data ?? [], null); + $this->setIfExists('priceId', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** - * @return mixed + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public function getPriceId() + public function listInvalidProperties() { - return $this->priceId; + $invalidProperties = []; + + if ($this->container['referenceGoodsId'] === null) { + $invalidProperties[] = "'referenceGoodsId' can't be null"; + } + if ($this->container['goodsName'] === null) { + $invalidProperties[] = "'goodsName' can't be null"; + } + return $invalidProperties; } /** - * @param mixed $priceId + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid */ - public function setPriceId($priceId) + public function valid() { - $this->priceId = $priceId; + return count($this->listInvalidProperties()) === 0; } /** - * @return String + * Gets referenceGoodsId + * + * @return string */ public function getReferenceGoodsId() { - return $this->referenceGoodsId; + return $this->container['referenceGoodsId']; } /** - * @param String $referenceGoodsId + * Sets referenceGoodsId + * + * @param string $referenceGoodsId The unique ID to identify the goods. More information: Maximum length: 64 characters + * + * @return self */ public function setReferenceGoodsId($referenceGoodsId) { - $this->referenceGoodsId = $referenceGoodsId; + $this->container['referenceGoodsId'] = $referenceGoodsId; + + return $this; } /** - * @return String + * Gets goodsName + * + * @return string */ public function getGoodsName() { - return $this->goodsName; + return $this->container['goodsName']; } /** - * @param String $goodsName + * Sets goodsName + * + * @param string $goodsName Goods name. More information: Maximum length: 256 characters + * + * @return self */ public function setGoodsName($goodsName) { - $this->goodsName = $goodsName; + $this->container['goodsName'] = $goodsName; + + return $this; } /** - * @return String + * Gets goodsCategory + * + * @return string|null */ public function getGoodsCategory() { - return $this->goodsCategory; + return $this->container['goodsCategory']; } /** - * @param String $goodsCategory + * Sets goodsCategory + * + * @param string|null $goodsCategory The category of the goods. If the goods have multiple layers for categorization, use slashes between different categories and write the parent category before the subcategory, such as Digital Goods/Digital Vouchers/Food and Beverages. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 64 characters + * + * @return self */ public function setGoodsCategory($goodsCategory) { - $this->goodsCategory = $goodsCategory; + $this->container['goodsCategory'] = $goodsCategory; + + return $this; } /** - * @return String + * Gets goodsBrand + * + * @return string|null */ public function getGoodsBrand() { - return $this->goodsBrand; + return $this->container['goodsBrand']; } /** - * @param String $goodsBrand + * Sets goodsBrand + * + * @param string|null $goodsBrand goodsBrand + * + * @return self */ public function setGoodsBrand($goodsBrand) { - $this->goodsBrand = $goodsBrand; + $this->container['goodsBrand'] = $goodsBrand; + + return $this; } /** - * @return Amount + * Gets goodsUnitAmount + * + * @return \request\model\Amount|null */ public function getGoodsUnitAmount() { - return $this->goodsUnitAmount; + return $this->container['goodsUnitAmount']; } /** - * @param Amount $goodsUnitAmount + * Sets goodsUnitAmount + * + * @param \request\model\Amount|null $goodsUnitAmount goodsUnitAmount + * + * @return self */ public function setGoodsUnitAmount($goodsUnitAmount) { - $this->goodsUnitAmount = $goodsUnitAmount; + $this->container['goodsUnitAmount'] = $goodsUnitAmount; + + return $this; } /** - * @return String + * Gets goodsQuantity + * + * @return string|null */ public function getGoodsQuantity() { - return $this->goodsQuantity; + return $this->container['goodsQuantity']; } /** - * @param String $goodsQuantity + * Sets goodsQuantity + * + * @param string|null $goodsQuantity Quantity of goods. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Value range: 1 - unlimited + * + * @return self */ public function setGoodsQuantity($goodsQuantity) { - $this->goodsQuantity = $goodsQuantity; + $this->container['goodsQuantity'] = $goodsQuantity; + + return $this; } /** - * @return String + * Gets goodsSkuName + * + * @return string|null */ public function getGoodsSkuName() { - return $this->goodsSkuName; + return $this->container['goodsSkuName']; } /** - * @param String $goodsSkuName + * Sets goodsSkuName + * + * @param string|null $goodsSkuName goodsSkuName + * + * @return self */ public function setGoodsSkuName($goodsSkuName) { - $this->goodsSkuName = $goodsSkuName; + $this->container['goodsSkuName'] = $goodsSkuName; + + return $this; + } + + /** + * Gets goodsUrl + * + * @return string|null + */ + public function getGoodsUrl() + { + return $this->container['goodsUrl']; + } + + /** + * Sets goodsUrl + * + * @param string|null $goodsUrl The URL of the website where the user places an order. Specify this parameter if you require risk control. Providing this information helps to identify black-market behavior. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setGoodsUrl($goodsUrl) + { + $this->container['goodsUrl'] = $goodsUrl; + + return $this; + } + + /** + * Gets deliveryMethodType + * + * @return string|null + */ + public function getDeliveryMethodType() + { + return $this->container['deliveryMethodType']; + } + + /** + * Sets deliveryMethodType + * + * @param string|null $deliveryMethodType The delivery method of the goods. Valid values are: PHYSICAL: indicates that the delivery method is physical delivery. DIGITAL: indicates that the delivery method is digital delivery. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 32 characters + * + * @return self + */ + public function setDeliveryMethodType($deliveryMethodType) + { + $this->container['deliveryMethodType'] = $deliveryMethodType; + + return $this; + } + + /** + * Gets goodsImageUrl + * + * @return string|null + */ + public function getGoodsImageUrl() + { + return $this->container['goodsImageUrl']; + } + + /** + * Sets goodsImageUrl + * + * @param string|null $goodsImageUrl goodsImageUrl + * + * @return self + */ + public function setGoodsImageUrl($goodsImageUrl) + { + $this->container['goodsImageUrl'] = $goodsImageUrl; + + return $this; + } + + /** + * Gets priceId + * + * @return string|null + */ + public function getPriceId() + { + return $this->container['priceId']; + } + + /** + * Sets priceId + * + * @param string|null $priceId The ID of the Price object. One of ​priceId​ or ​referenceGoodsId​ is required. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPriceId($priceId) + { + $this->container['priceId'] = $priceId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } -} \ No newline at end of file + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/GrantType.php b/model/GrantType.php index 83e5767..97fb8b8 100644 --- a/model/GrantType.php +++ b/model/GrantType.php @@ -1,8 +1,31 @@ + */ +class Individual implements ModelInterface, ArrayAccess, \JsonSerializable { - public $name; - public $englishName; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Individual'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => '\request\model\UserName', + 'englishName' => '\request\model\UserName', + 'dateOfBirth' => 'string', + 'placeOfBirth' => '\request\model\Address', + 'certificates' => '\request\model\Certificate[]', + 'nationality' => 'string', + 'contacts' => '\request\model\Contact[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'englishName' => null, + 'dateOfBirth' => null, + 'placeOfBirth' => null, + 'certificates' => null, + 'nationality' => null, + 'contacts' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'name' => false, + 'englishName' => false, + 'dateOfBirth' => false, + 'placeOfBirth' => false, + 'certificates' => false, + 'nationality' => false, + 'contacts' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } - public $dateOfBirth; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } - public $placeOfBirth; + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } - public $certificates; + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } - public $nationality; + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $contacts; + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'englishName' => 'englishName', + 'dateOfBirth' => 'dateOfBirth', + 'placeOfBirth' => 'placeOfBirth', + 'certificates' => 'certificates', + 'nationality' => 'nationality', + 'contacts' => 'contacts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'englishName' => 'setEnglishName', + 'dateOfBirth' => 'setDateOfBirth', + 'placeOfBirth' => 'setPlaceOfBirth', + 'certificates' => 'setCertificates', + 'nationality' => 'setNationality', + 'contacts' => 'setContacts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'englishName' => 'getEnglishName', + 'dateOfBirth' => 'getDateOfBirth', + 'placeOfBirth' => 'getPlaceOfBirth', + 'certificates' => 'getCertificates', + 'nationality' => 'getNationality', + 'contacts' => 'getContacts' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } /** - * @return mixed + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('englishName', $data ?? [], null); + $this->setIfExists('dateOfBirth', $data ?? [], null); + $this->setIfExists('placeOfBirth', $data ?? [], null); + $this->setIfExists('certificates', $data ?? [], null); + $this->setIfExists('nationality', $data ?? [], null); + $this->setIfExists('contacts', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return \request\model\UserName */ public function getName() { - return $this->name; + return $this->container['name']; } /** - * @param mixed $name + * Sets name + * + * @param \request\model\UserName $name name + * + * @return self */ - public function setName($name) + public function setName($name) { - $this->name = $name; + $this->container['name'] = $name; + + return $this; } /** - * @return mixed + * Gets englishName + * + * @return \request\model\UserName|null */ public function getEnglishName() { - return $this->englishName; + return $this->container['englishName']; } /** - * @param mixed $englishName + * Sets englishName + * + * @param \request\model\UserName|null $englishName englishName + * + * @return self */ - public function setEnglishName($englishName) + public function setEnglishName($englishName) { - $this->englishName = $englishName; + $this->container['englishName'] = $englishName; + + return $this; } /** - * @return mixed + * Gets dateOfBirth + * + * @return string|null */ public function getDateOfBirth() { - return $this->dateOfBirth; + return $this->container['dateOfBirth']; } /** - * @param mixed $dateOfBirth + * Sets dateOfBirth + * + * @param string|null $dateOfBirth The individual's date of birth. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR. More information: Maximum length: 32 characters + * + * @return self */ - public function setDateOfBirth($dateOfBirth) + public function setDateOfBirth($dateOfBirth) { - $this->dateOfBirth = $dateOfBirth; + $this->container['dateOfBirth'] = $dateOfBirth; + + return $this; } /** - * @return mixed + * Gets placeOfBirth + * + * @return \request\model\Address|null */ public function getPlaceOfBirth() { - return $this->placeOfBirth; + return $this->container['placeOfBirth']; } /** - * @param mixed $placeOfBirth + * Sets placeOfBirth + * + * @param \request\model\Address|null $placeOfBirth placeOfBirth + * + * @return self */ - public function setPlaceOfBirth($placeOfBirth) + public function setPlaceOfBirth($placeOfBirth) { - $this->placeOfBirth = $placeOfBirth; + $this->container['placeOfBirth'] = $placeOfBirth; + + return $this; } /** - * @return mixed + * Gets certificates + * + * @return \request\model\Certificate[]|null */ public function getCertificates() { - return $this->certificates; + return $this->container['certificates']; } /** - * @param mixed $certificates + * Sets certificates + * + * @param \request\model\Certificate[]|null $certificates The list of certificate information of the individual. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR or US. + * + * @return self */ - public function setCertificates($certificates) + public function setCertificates($certificates) { - $this->certificates = $certificates; + $this->container['certificates'] = $certificates; + + return $this; } /** - * @return mixed + * Gets nationality + * + * @return string|null */ public function getNationality() { - return $this->nationality; + return $this->container['nationality']; } /** - * @param mixed $nationality + * Sets nationality + * + * @param string|null $nationality The nationality of the individual. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is EU, GB, MY, US, or BR. More information: Maximum length: 2 characters + * + * @return self */ - public function setNationality($nationality) + public function setNationality($nationality) { - $this->nationality = $nationality; + $this->container['nationality'] = $nationality; + + return $this; } /** - * @return mixed + * Gets contacts + * + * @return \request\model\Contact[]|null */ public function getContacts() { - return $this->contacts; + return $this->container['contacts']; } /** - * @param mixed $contacts + * Sets contacts + * + * @param \request\model\Contact[]|null $contacts A list of contact information. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is JP and the value of merchantInfo.entityAssociations.associationType is LEGAL_REPRESENTATIVE. More information: Maximum size: 10 elements + * + * @return self + */ + public function setContacts($contacts) + { + $this->container['contacts'] = $contacts; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean */ - public function setContacts($contacts) + public function offsetExists($offset): bool { - $this->contacts = $contacts; + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Installment.php b/model/Installment.php new file mode 100644 index 0000000..87e8fa3 --- /dev/null +++ b/model/Installment.php @@ -0,0 +1,447 @@ + + */ +class Installment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Installment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'supportCardBrands' => '\request\model\SupportCardBrand[]', + 'plans' => '\request\model\Plan[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'supportCardBrands' => null, + 'plans' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'supportCardBrands' => false, + 'plans' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'supportCardBrands' => 'supportCardBrands', + 'plans' => 'plans' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'supportCardBrands' => 'setSupportCardBrands', + 'plans' => 'setPlans' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'supportCardBrands' => 'getSupportCardBrands', + 'plans' => 'getPlans' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('supportCardBrands', $data ?? [], null); + $this->setIfExists('plans', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['supportCardBrands'] === null) { + $invalidProperties[] = "'supportCardBrands' can't be null"; + } + if ($this->container['plans'] === null) { + $invalidProperties[] = "'plans' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets supportCardBrands + * + * @return \request\model\SupportCardBrand[] + */ + public function getSupportCardBrands() + { + return $this->container['supportCardBrands']; + } + + /** + * Sets supportCardBrands + * + * @param \request\model\SupportCardBrand[] $supportCardBrands The list of card brands that support the installment plans. This parameter is returned when the value of paymentMethodType is CARD. + * + * @return self + */ + public function setSupportCardBrands($supportCardBrands) + { + $this->container['supportCardBrands'] = $supportCardBrands; + + return $this; + } + + /** + * Gets plans + * + * @return \request\model\Plan[] + */ + public function getPlans() + { + return $this->container['plans']; + } + + /** + * Sets plans + * + * @param \request\model\Plan[] $plans The list of installment plans for payment methods that support installments. + * + * @return self + */ + public function setPlans($plans) + { + $this->container['plans'] = $plans; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/InterestFree.php b/model/InterestFree.php new file mode 100644 index 0000000..d968cc2 --- /dev/null +++ b/model/InterestFree.php @@ -0,0 +1,580 @@ + + */ +class InterestFree implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InterestFree'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'provider' => 'string', + 'expireTime' => 'string', + 'installmentFreeNums' => 'int[]', + 'minPaymentAmount' => '\request\model\Amount', + 'maxPaymentAmount' => '\request\model\Amount', + 'freePercentage' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'provider' => null, + 'expireTime' => null, + 'installmentFreeNums' => null, + 'minPaymentAmount' => null, + 'maxPaymentAmount' => null, + 'freePercentage' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'provider' => false, + 'expireTime' => false, + 'installmentFreeNums' => false, + 'minPaymentAmount' => false, + 'maxPaymentAmount' => false, + 'freePercentage' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'provider' => 'provider', + 'expireTime' => 'expireTime', + 'installmentFreeNums' => 'installmentFreeNums', + 'minPaymentAmount' => 'minPaymentAmount', + 'maxPaymentAmount' => 'maxPaymentAmount', + 'freePercentage' => 'freePercentage' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'provider' => 'setProvider', + 'expireTime' => 'setExpireTime', + 'installmentFreeNums' => 'setInstallmentFreeNums', + 'minPaymentAmount' => 'setMinPaymentAmount', + 'maxPaymentAmount' => 'setMaxPaymentAmount', + 'freePercentage' => 'setFreePercentage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'provider' => 'getProvider', + 'expireTime' => 'getExpireTime', + 'installmentFreeNums' => 'getInstallmentFreeNums', + 'minPaymentAmount' => 'getMinPaymentAmount', + 'maxPaymentAmount' => 'getMaxPaymentAmount', + 'freePercentage' => 'getFreePercentage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('provider', $data ?? [], null); + $this->setIfExists('expireTime', $data ?? [], null); + $this->setIfExists('installmentFreeNums', $data ?? [], null); + $this->setIfExists('minPaymentAmount', $data ?? [], null); + $this->setIfExists('maxPaymentAmount', $data ?? [], null); + $this->setIfExists('freePercentage', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['provider'] === null) { + $invalidProperties[] = "'provider' can't be null"; + } + if ($this->container['expireTime'] === null) { + $invalidProperties[] = "'expireTime' can't be null"; + } + if ($this->container['installmentFreeNums'] === null) { + $invalidProperties[] = "'installmentFreeNums' can't be null"; + } + if ($this->container['minPaymentAmount'] === null) { + $invalidProperties[] = "'minPaymentAmount' can't be null"; + } + if ($this->container['freePercentage'] === null) { + $invalidProperties[] = "'freePercentage' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets provider + * + * @return string + */ + public function getProvider() + { + return $this->container['provider']; + } + + /** + * Sets provider + * + * @param string $provider Issuing banks or financial institutions that offer interest-free installment plans. More information: Maximum length: 128 characters + * + * @return self + */ + public function setProvider($provider) + { + $this->container['provider'] = $provider; + + return $this; + } + + /** + * Gets expireTime + * + * @return string + */ + public function getExpireTime() + { + return $this->container['expireTime']; + } + + /** + * Sets expireTime + * + * @param string $expireTime The promotion expiration time. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setExpireTime($expireTime) + { + $this->container['expireTime'] = $expireTime; + + return $this; + } + + /** + * Gets installmentFreeNums + * + * @return int[] + */ + public function getInstallmentFreeNums() + { + return $this->container['installmentFreeNums']; + } + + /** + * Sets installmentFreeNums + * + * @param int[] $installmentFreeNums The number of interest-free installments. More information: Value range: 2-unlimited + * + * @return self + */ + public function setInstallmentFreeNums($installmentFreeNums) + { + $this->container['installmentFreeNums'] = $installmentFreeNums; + + return $this; + } + + /** + * Gets minPaymentAmount + * + * @return \request\model\Amount + */ + public function getMinPaymentAmount() + { + return $this->container['minPaymentAmount']; + } + + /** + * Sets minPaymentAmount + * + * @param \request\model\Amount $minPaymentAmount minPaymentAmount + * + * @return self + */ + public function setMinPaymentAmount($minPaymentAmount) + { + $this->container['minPaymentAmount'] = $minPaymentAmount; + + return $this; + } + + /** + * Gets maxPaymentAmount + * + * @return \request\model\Amount|null + */ + public function getMaxPaymentAmount() + { + return $this->container['maxPaymentAmount']; + } + + /** + * Sets maxPaymentAmount + * + * @param \request\model\Amount|null $maxPaymentAmount maxPaymentAmount + * + * @return self + */ + public function setMaxPaymentAmount($maxPaymentAmount) + { + $this->container['maxPaymentAmount'] = $maxPaymentAmount; + + return $this; + } + + /** + * Gets freePercentage + * + * @return int + */ + public function getFreePercentage() + { + return $this->container['freePercentage']; + } + + /** + * Sets freePercentage + * + * @param int $freePercentage The interest-free percentage. A value of 0 indicates no interest-free, 100% indicates the buyer is completely interest-free, while the value between 0-100% indicates partial interest-free. + * + * @return self + */ + public function setFreePercentage($freePercentage) + { + $this->container['freePercentage'] = $freePercentage; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Leg.php b/model/Leg.php index 9c276da..307cf16 100644 --- a/model/Leg.php +++ b/model/Leg.php @@ -1,164 +1,658 @@ + */ +class Leg implements ModelInterface, ArrayAccess, \JsonSerializable { - public $departureTime; - public $arrivalTime; - public $departureAddress; - public $arrivalAddress; - public $carrierName; - public $carrierNo; - public $classType; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Leg'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'departureTime' => 'string', + 'arrivalTime' => 'string', + 'departureAddress' => '\request\model\Address', + 'arrivalAddress' => '\request\model\Address', + 'carrierName' => 'string', + 'carrierNo' => 'string', + 'classType' => '\request\model\ClassType', + 'departureAirportCode' => 'string', + 'arrivalAirportCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'departureTime' => null, + 'arrivalTime' => null, + 'departureAddress' => null, + 'arrivalAddress' => null, + 'carrierName' => null, + 'carrierNo' => null, + 'classType' => null, + 'departureAirportCode' => null, + 'arrivalAirportCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'departureTime' => false, + 'arrivalTime' => false, + 'departureAddress' => false, + 'arrivalAddress' => false, + 'carrierName' => false, + 'carrierNo' => false, + 'classType' => false, + 'departureAirportCode' => false, + 'arrivalAirportCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'departureTime' => 'departureTime', + 'arrivalTime' => 'arrivalTime', + 'departureAddress' => 'departureAddress', + 'arrivalAddress' => 'arrivalAddress', + 'carrierName' => 'carrierName', + 'carrierNo' => 'carrierNo', + 'classType' => 'classType', + 'departureAirportCode' => 'departureAirportCode', + 'arrivalAirportCode' => 'arrivalAirportCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'departureTime' => 'setDepartureTime', + 'arrivalTime' => 'setArrivalTime', + 'departureAddress' => 'setDepartureAddress', + 'arrivalAddress' => 'setArrivalAddress', + 'carrierName' => 'setCarrierName', + 'carrierNo' => 'setCarrierNo', + 'classType' => 'setClassType', + 'departureAirportCode' => 'setDepartureAirportCode', + 'arrivalAirportCode' => 'setArrivalAirportCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'departureTime' => 'getDepartureTime', + 'arrivalTime' => 'getArrivalTime', + 'departureAddress' => 'getDepartureAddress', + 'arrivalAddress' => 'getArrivalAddress', + 'carrierName' => 'getCarrierName', + 'carrierNo' => 'getCarrierNo', + 'classType' => 'getClassType', + 'departureAirportCode' => 'getDepartureAirportCode', + 'arrivalAirportCode' => 'getArrivalAirportCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $departureAirportCode; - public $arrivalAirportCode; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return mixed + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('departureTime', $data ?? [], null); + $this->setIfExists('arrivalTime', $data ?? [], null); + $this->setIfExists('departureAddress', $data ?? [], null); + $this->setIfExists('arrivalAddress', $data ?? [], null); + $this->setIfExists('carrierName', $data ?? [], null); + $this->setIfExists('carrierNo', $data ?? [], null); + $this->setIfExists('classType', $data ?? [], null); + $this->setIfExists('departureAirportCode', $data ?? [], null); + $this->setIfExists('arrivalAirportCode', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets departureTime + * + * @return string|null */ public function getDepartureTime() { - return $this->departureTime; + return $this->container['departureTime']; } /** - * @param mixed $departureTime + * Sets departureTime + * + * @param string|null $departureTime Time of departure for this leg of the trip. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setDepartureTime($departureTime) { - $this->departureTime = $departureTime; + $this->container['departureTime'] = $departureTime; + + return $this; } /** - * @return mixed + * Gets arrivalTime + * + * @return string|null */ public function getArrivalTime() { - return $this->arrivalTime; + return $this->container['arrivalTime']; } /** - * @param mixed $arrivalTime + * Sets arrivalTime + * + * @param string|null $arrivalTime Time of arrival for this leg of the trip. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setArrivalTime($arrivalTime) { - $this->arrivalTime = $arrivalTime; + $this->container['arrivalTime'] = $arrivalTime; + + return $this; } /** - * @return mixed + * Gets departureAddress + * + * @return \request\model\Address|null */ public function getDepartureAddress() { - return $this->departureAddress; + return $this->container['departureAddress']; } /** - * @param mixed $departureAddress + * Sets departureAddress + * + * @param \request\model\Address|null $departureAddress departureAddress + * + * @return self */ public function setDepartureAddress($departureAddress) { - $this->departureAddress = $departureAddress; + $this->container['departureAddress'] = $departureAddress; + + return $this; } /** - * @return mixed + * Gets arrivalAddress + * + * @return \request\model\Address|null */ public function getArrivalAddress() { - return $this->arrivalAddress; + return $this->container['arrivalAddress']; } /** - * @param mixed $arrivalAddress + * Sets arrivalAddress + * + * @param \request\model\Address|null $arrivalAddress arrivalAddress + * + * @return self */ public function setArrivalAddress($arrivalAddress) { - $this->arrivalAddress = $arrivalAddress; + $this->container['arrivalAddress'] = $arrivalAddress; + + return $this; } /** - * @return mixed + * Gets carrierName + * + * @return string|null */ public function getCarrierName() { - return $this->carrierName; + return $this->container['carrierName']; } /** - * @param mixed $carrierName + * Sets carrierName + * + * @param string|null $carrierName Company name of the transportation service provider for this leg of the trip. More information: Maximum length: 128 characters + * + * @return self */ public function setCarrierName($carrierName) { - $this->carrierName = $carrierName; + $this->container['carrierName'] = $carrierName; + + return $this; } /** - * @return mixed + * Gets carrierNo + * + * @return string|null */ public function getCarrierNo() { - return $this->carrierNo; + return $this->container['carrierNo']; } /** - * @param mixed $carrierNo + * Sets carrierNo + * + * @param string|null $carrierNo Code for the carrier for this leg of the trip. More information: Maximum length: 64 characters + * + * @return self */ public function setCarrierNo($carrierNo) { - $this->carrierNo = $carrierNo; + $this->container['carrierNo'] = $carrierNo; + + return $this; } /** - * @return mixed + * Gets classType + * + * @return \request\model\ClassType|null */ public function getClassType() { - return $this->classType; + return $this->container['classType']; } /** - * @param mixed $classType + * Sets classType + * + * @param \request\model\ClassType|null $classType classType + * + * @return self */ public function setClassType($classType) { - $this->classType = $classType; + $this->container['classType'] = $classType; + + return $this; } /** - * @return mixed + * Gets departureAirportCode + * + * @return string|null */ public function getDepartureAirportCode() { - return $this->departureAirportCode; + return $this->container['departureAirportCode']; } /** - * @param mixed $departureAirportCode + * Sets departureAirportCode + * + * @param string|null $departureAirportCode IATA code for the originating airport for this leg of the trip. More information: Maximum length: 8 characters + * + * @return self */ public function setDepartureAirportCode($departureAirportCode) { - $this->departureAirportCode = $departureAirportCode; + $this->container['departureAirportCode'] = $departureAirportCode; + + return $this; } /** - * @return mixed + * Gets arrivalAirportCode + * + * @return string|null */ public function getArrivalAirportCode() { - return $this->arrivalAirportCode; + return $this->container['arrivalAirportCode']; } /** - * @param mixed $arrivalAirportCode + * Sets arrivalAirportCode + * + * @param string|null $arrivalAirportCode IATA code for the destination airport for this leg of the trip. More information: Maximum length: 8 characters + * + * @return self */ public function setArrivalAirportCode($arrivalAirportCode) { - $this->arrivalAirportCode = $arrivalAirportCode; + $this->container['arrivalAirportCode'] = $arrivalAirportCode; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/LegalEntityType.php b/model/LegalEntityType.php index a027095..d122c09 100644 --- a/model/LegalEntityType.php +++ b/model/LegalEntityType.php @@ -1,11 +1,31 @@ + */ +class Lodging implements ModelInterface, ArrayAccess, \JsonSerializable { - public $hotelName; - public $hotelAddress; - public $checkInDate; - public $checkOutDate; - public $numberOfNights; - public $numberOfRooms; - public $guestNames; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Lodging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hotelName' => 'string', + 'hotelAddress' => '\request\model\Address', + 'checkInDate' => 'string', + 'checkOutDate' => 'string', + 'numberOfNights' => 'int', + 'numberOfRooms' => 'int', + 'guestNames' => '\request\model\UserName[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hotelName' => null, + 'hotelAddress' => null, + 'checkInDate' => null, + 'checkOutDate' => null, + 'numberOfNights' => null, + 'numberOfRooms' => null, + 'guestNames' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'hotelName' => false, + 'hotelAddress' => false, + 'checkInDate' => false, + 'checkOutDate' => false, + 'numberOfNights' => true, + 'numberOfRooms' => true, + 'guestNames' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hotelName' => 'hotelName', + 'hotelAddress' => 'hotelAddress', + 'checkInDate' => 'checkInDate', + 'checkOutDate' => 'checkOutDate', + 'numberOfNights' => 'numberOfNights', + 'numberOfRooms' => 'numberOfRooms', + 'guestNames' => 'guestNames' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hotelName' => 'setHotelName', + 'hotelAddress' => 'setHotelAddress', + 'checkInDate' => 'setCheckInDate', + 'checkOutDate' => 'setCheckOutDate', + 'numberOfNights' => 'setNumberOfNights', + 'numberOfRooms' => 'setNumberOfRooms', + 'guestNames' => 'setGuestNames' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hotelName' => 'getHotelName', + 'hotelAddress' => 'getHotelAddress', + 'checkInDate' => 'getCheckInDate', + 'checkOutDate' => 'getCheckOutDate', + 'numberOfNights' => 'getNumberOfNights', + 'numberOfRooms' => 'getNumberOfRooms', + 'guestNames' => 'getGuestNames' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return mixed + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('hotelName', $data ?? [], null); + $this->setIfExists('hotelAddress', $data ?? [], null); + $this->setIfExists('checkInDate', $data ?? [], null); + $this->setIfExists('checkOutDate', $data ?? [], null); + $this->setIfExists('numberOfNights', $data ?? [], null); + $this->setIfExists('numberOfRooms', $data ?? [], null); + $this->setIfExists('guestNames', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets hotelName + * + * @return string|null */ public function getHotelName() { - return $this->hotelName; + return $this->container['hotelName']; } /** - * @param mixed $hotelName + * Sets hotelName + * + * @param string|null $hotelName Hotel name. More information: Maximum length: 128 characters + * + * @return self */ - public function setHotelName($hotelName) + public function setHotelName($hotelName) { - $this->hotelName = $hotelName; + $this->container['hotelName'] = $hotelName; + + return $this; } /** - * @return mixed + * Gets hotelAddress + * + * @return \request\model\Address|null */ public function getHotelAddress() { - return $this->hotelAddress; + return $this->container['hotelAddress']; } /** - * @param mixed $hotelAddress + * Sets hotelAddress + * + * @param \request\model\Address|null $hotelAddress hotelAddress + * + * @return self */ - public function setHotelAddress($hotelAddress) + public function setHotelAddress($hotelAddress) { - $this->hotelAddress = $hotelAddress; + $this->container['hotelAddress'] = $hotelAddress; + + return $this; } /** - * @return mixed + * Gets checkInDate + * + * @return string|null */ public function getCheckInDate() { - return $this->checkInDate; + return $this->container['checkInDate']; } /** - * @param mixed $checkInDate + * Sets checkInDate + * + * @param string|null $checkInDate Date on which the guest checked in. In the case of a no-show or a reservation, the scheduled arrival date. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setCheckInDate($checkInDate) + public function setCheckInDate($checkInDate) { - $this->checkInDate = $checkInDate; + $this->container['checkInDate'] = $checkInDate; + + return $this; } /** - * @return mixed + * Gets checkOutDate + * + * @return string|null */ public function getCheckOutDate() { - return $this->checkOutDate; + return $this->container['checkOutDate']; } /** - * @param mixed $checkOutDate + * Sets checkOutDate + * + * @param string|null $checkOutDate Date on which the guest checked out. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setCheckOutDate($checkOutDate) + public function setCheckOutDate($checkOutDate) { - $this->checkOutDate = $checkOutDate; + $this->container['checkOutDate'] = $checkOutDate; + + return $this; } /** - * @return mixed + * Gets numberOfNights + * + * @return int|null */ public function getNumberOfNights() { - return $this->numberOfNights; + return $this->container['numberOfNights']; } /** - * @param mixed $numberOfNights + * Sets numberOfNights + * + * @param int|null $numberOfNights Number of rooms booked by the payer. More information: Value range: 1 - unlimited + * + * @return self */ - public function setNumberOfNights($numberOfNights) + public function setNumberOfNights($numberOfNights) { - $this->numberOfNights = $numberOfNights; + $this->container['numberOfNights'] = $numberOfNights; + + return $this; } /** - * @return mixed + * Gets numberOfRooms + * + * @return int|null */ public function getNumberOfRooms() { - return $this->numberOfRooms; + return $this->container['numberOfRooms']; } /** - * @param mixed $numberOfRooms + * Sets numberOfRooms + * + * @param int|null $numberOfRooms Number of nights booked by the payer. More information: Value range: 1 - unlimited + * + * @return self */ - public function setNumberOfRooms($numberOfRooms) + public function setNumberOfRooms($numberOfRooms) { - $this->numberOfRooms = $numberOfRooms; + $this->container['numberOfRooms'] = $numberOfRooms; + + return $this; } /** - * @return mixed + * Gets guestNames + * + * @return \request\model\UserName[]|null */ public function getGuestNames() { - return $this->guestNames; + return $this->container['guestNames']; + } + + /** + * Sets guestNames + * + * @param \request\model\UserName[]|null $guestNames Name of the guest under which the room is reserved. More information: Maximum size: 100 elements + * + * @return self + */ + public function setGuestNames($guestNames) + { + $this->container['guestNames'] = $guestNames; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } /** - * @param mixed $guestNames + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null */ - public function setGuestNames($guestNames) + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - $this->guestNames = $guestNames; + return $this->container[$offset] ?? null; } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Logo.php b/model/Logo.php index c1b83e6..fe8839f 100644 --- a/model/Logo.php +++ b/model/Logo.php @@ -1,44 +1,444 @@ + */ +class Logo implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Logo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'logoName' => 'string', + 'logoUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'logoName' => null, + 'logoUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'logoName' => false, + 'logoUrl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'logoName' => 'logoName', + 'logoUrl' => 'logoUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'logoName' => 'setLogoName', + 'logoUrl' => 'setLogoUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'logoName' => 'getLogoName', + 'logoUrl' => 'getLogoUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $logoName; - public $logoUrl; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('logoName', $data ?? [], null); + $this->setIfExists('logoUrl', $data ?? [], null); + + } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['logoName'] === null) { + $invalidProperties[] = "'logoName' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets logoName + * + * @return string */ public function getLogoName() { - return $this->logoName; + return $this->container['logoName']; } /** - * @param mixed $logoName + * Sets logoName + * + * @param string $logoName The logo name of the card brand. See the Card brands to check the valid values. More information: Maximum length: 12 characters + * + * @return self */ public function setLogoName($logoName) { - $this->logoName = $logoName; + $this->container['logoName'] = $logoName; + + return $this; } /** - * @return mixed + * Gets logoUrl + * + * @return string|null */ public function getLogoUrl() { - return $this->logoUrl; + return $this->container['logoUrl']; } /** - * @param mixed $logoUrl + * Sets logoUrl + * + * @param string|null $logoUrl The logo URL of the card brand. More information: Maximum length: 2048 characters + * + * @return self */ public function setLogoUrl($logoUrl) { - $this->logoUrl = $logoUrl; + $this->container['logoUrl'] = $logoUrl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Merchant.php b/model/Merchant.php index 6c0c3b6..70a5b6d 100644 --- a/model/Merchant.php +++ b/model/Merchant.php @@ -1,146 +1,651 @@ + */ +class Merchant implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Merchant'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'referenceMerchantId' => 'string', + 'merchantMCC' => 'string', + 'merchantName' => 'string', + 'merchantDisplayName' => 'string', + 'merchantAddress' => '\request\model\Address', + 'merchantRegisterDate' => 'string', + 'store' => '\request\model\Store', + 'merchantType' => '\request\model\MerchantType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'referenceMerchantId' => null, + 'merchantMCC' => null, + 'merchantName' => null, + 'merchantDisplayName' => null, + 'merchantAddress' => null, + 'merchantRegisterDate' => null, + 'store' => null, + 'merchantType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'referenceMerchantId' => false, + 'merchantMCC' => false, + 'merchantName' => false, + 'merchantDisplayName' => false, + 'merchantAddress' => false, + 'merchantRegisterDate' => false, + 'store' => false, + 'merchantType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'referenceMerchantId' => 'referenceMerchantId', + 'merchantMCC' => 'merchantMCC', + 'merchantName' => 'merchantName', + 'merchantDisplayName' => 'merchantDisplayName', + 'merchantAddress' => 'merchantAddress', + 'merchantRegisterDate' => 'merchantRegisterDate', + 'store' => 'store', + 'merchantType' => 'merchantType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'referenceMerchantId' => 'setReferenceMerchantId', + 'merchantMCC' => 'setMerchantMCC', + 'merchantName' => 'setMerchantName', + 'merchantDisplayName' => 'setMerchantDisplayName', + 'merchantAddress' => 'setMerchantAddress', + 'merchantRegisterDate' => 'setMerchantRegisterDate', + 'store' => 'setStore', + 'merchantType' => 'setMerchantType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'referenceMerchantId' => 'getReferenceMerchantId', + 'merchantMCC' => 'getMerchantMCC', + 'merchantName' => 'getMerchantName', + 'merchantDisplayName' => 'getMerchantDisplayName', + 'merchantAddress' => 'getMerchantAddress', + 'merchantRegisterDate' => 'getMerchantRegisterDate', + 'store' => 'getStore', + 'merchantType' => 'getMerchantType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $referenceMerchantId; - public $merchantMCC; - public $merchantName; - public $merchantDisplayName; - public $merchantAddress; - public $merchantRegisterDate; - public $store; - public $merchantType; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return String + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('referenceMerchantId', $data ?? [], null); + $this->setIfExists('merchantMCC', $data ?? [], null); + $this->setIfExists('merchantName', $data ?? [], null); + $this->setIfExists('merchantDisplayName', $data ?? [], null); + $this->setIfExists('merchantAddress', $data ?? [], null); + $this->setIfExists('merchantRegisterDate', $data ?? [], null); + $this->setIfExists('store', $data ?? [], null); + $this->setIfExists('merchantType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['referenceMerchantId'] === null) { + $invalidProperties[] = "'referenceMerchantId' can't be null"; + } + if ($this->container['merchantMCC'] === null) { + $invalidProperties[] = "'merchantMCC' can't be null"; + } + if ($this->container['merchantName'] === null) { + $invalidProperties[] = "'merchantName' can't be null"; + } + if ($this->container['merchantDisplayName'] === null) { + $invalidProperties[] = "'merchantDisplayName' can't be null"; + } + if ($this->container['merchantAddress'] === null) { + $invalidProperties[] = "'merchantAddress' can't be null"; + } + if ($this->container['merchantRegisterDate'] === null) { + $invalidProperties[] = "'merchantRegisterDate' can't be null"; + } + if ($this->container['store'] === null) { + $invalidProperties[] = "'store' can't be null"; + } + if ($this->container['merchantType'] === null) { + $invalidProperties[] = "'merchantType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets referenceMerchantId + * + * @return string */ public function getReferenceMerchantId() { - return $this->referenceMerchantId; + return $this->container['referenceMerchantId']; } /** - * @param String $referenceMerchantId + * Sets referenceMerchantId + * + * @param string $referenceMerchantId referenceMerchantId + * + * @return self */ public function setReferenceMerchantId($referenceMerchantId) { - $this->referenceMerchantId = $referenceMerchantId; + $this->container['referenceMerchantId'] = $referenceMerchantId; + + return $this; } /** - * @return String + * Gets merchantMCC + * + * @return string */ public function getMerchantMCC() { - return $this->merchantMCC; + return $this->container['merchantMCC']; } /** - * @param String $merchantMCC + * Sets merchantMCC + * + * @param string $merchantMCC merchantMCC + * + * @return self */ public function setMerchantMCC($merchantMCC) { - $this->merchantMCC = $merchantMCC; + $this->container['merchantMCC'] = $merchantMCC; + + return $this; } /** - * @return String + * Gets merchantName + * + * @return string */ public function getMerchantName() { - return $this->merchantName; + return $this->container['merchantName']; } /** - * @param String $merchantName + * Sets merchantName + * + * @param string $merchantName merchantName + * + * @return self */ public function setMerchantName($merchantName) { - $this->merchantName = $merchantName; + $this->container['merchantName'] = $merchantName; + + return $this; } /** - * @return String + * Gets merchantDisplayName + * + * @return string */ public function getMerchantDisplayName() { - return $this->merchantDisplayName; + return $this->container['merchantDisplayName']; } /** - * @param String $merchantDisplayName + * Sets merchantDisplayName + * + * @param string $merchantDisplayName merchantDisplayName + * + * @return self */ public function setMerchantDisplayName($merchantDisplayName) { - $this->merchantDisplayName = $merchantDisplayName; + $this->container['merchantDisplayName'] = $merchantDisplayName; + + return $this; } /** - * @return Address + * Gets merchantAddress + * + * @return \request\model\Address */ public function getMerchantAddress() { - return $this->merchantAddress; + return $this->container['merchantAddress']; } /** - * @param Address $merchantAddress + * Sets merchantAddress + * + * @param \request\model\Address $merchantAddress merchantAddress + * + * @return self */ public function setMerchantAddress($merchantAddress) { - $this->merchantAddress = $merchantAddress; + $this->container['merchantAddress'] = $merchantAddress; + + return $this; } /** - * @return String + * Gets merchantRegisterDate + * + * @return string */ public function getMerchantRegisterDate() { - return $this->merchantRegisterDate; + return $this->container['merchantRegisterDate']; } /** - * @param String $merchantRegisterDate + * Sets merchantRegisterDate + * + * @param string $merchantRegisterDate merchantRegisterDate + * + * @return self */ public function setMerchantRegisterDate($merchantRegisterDate) { - $this->merchantRegisterDate = $merchantRegisterDate; + $this->container['merchantRegisterDate'] = $merchantRegisterDate; + + return $this; } /** - * @return Store + * Gets store + * + * @return \request\model\Store */ public function getStore() { - return $this->store; + return $this->container['store']; } /** - * @param Store $store + * Sets store + * + * @param \request\model\Store $store store + * + * @return self */ public function setStore($store) { - $this->store = $store; + $this->container['store'] = $store; + + return $this; } /** - * @return mixed + * Gets merchantType + * + * @return \request\model\MerchantType */ public function getMerchantType() { - return $this->merchantType; + return $this->container['merchantType']; } /** - * @param mixed $merchantType + * Sets merchantType + * + * @param \request\model\MerchantType $merchantType merchantType + * + * @return self */ public function setMerchantType($merchantType) { - $this->merchantType = $merchantType; + $this->container['merchantType'] = $merchantType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/MerchantInfo.php b/model/MerchantInfo.php index 66d2350..5f6e652 100644 --- a/model/MerchantInfo.php +++ b/model/MerchantInfo.php @@ -1,111 +1,577 @@ + */ +class MerchantInfo implements ModelInterface, ArrayAccess, \JsonSerializable { - public $referenceMerchantId; - public $loginId; - public $legalEntityType; - public $company; - public $businessInfo; - public $entityAssociations; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MerchantInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'referenceMerchantId' => 'string', + 'loginId' => 'string', + 'legalEntityType' => '\request\model\LegalEntityType', + 'company' => '\request\model\Company', + 'businessInfo' => '\request\model\BusinessInfo', + 'entityAssociations' => '\request\model\EntityAssociations[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'referenceMerchantId' => null, + 'loginId' => null, + 'legalEntityType' => null, + 'company' => null, + 'businessInfo' => null, + 'entityAssociations' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'referenceMerchantId' => false, + 'loginId' => false, + 'legalEntityType' => false, + 'company' => false, + 'businessInfo' => false, + 'entityAssociations' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'referenceMerchantId' => 'referenceMerchantId', + 'loginId' => 'loginId', + 'legalEntityType' => 'legalEntityType', + 'company' => 'company', + 'businessInfo' => 'businessInfo', + 'entityAssociations' => 'entityAssociations' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'referenceMerchantId' => 'setReferenceMerchantId', + 'loginId' => 'setLoginId', + 'legalEntityType' => 'setLegalEntityType', + 'company' => 'setCompany', + 'businessInfo' => 'setBusinessInfo', + 'entityAssociations' => 'setEntityAssociations' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'referenceMerchantId' => 'getReferenceMerchantId', + 'loginId' => 'getLoginId', + 'legalEntityType' => 'getLegalEntityType', + 'company' => 'getCompany', + 'businessInfo' => 'getBusinessInfo', + 'entityAssociations' => 'getEntityAssociations' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('referenceMerchantId', $data ?? [], null); + $this->setIfExists('loginId', $data ?? [], null); + $this->setIfExists('legalEntityType', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('businessInfo', $data ?? [], null); + $this->setIfExists('entityAssociations', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['referenceMerchantId'] === null) { + $invalidProperties[] = "'referenceMerchantId' can't be null"; + } + if ($this->container['loginId'] === null) { + $invalidProperties[] = "'loginId' can't be null"; + } + if ($this->container['legalEntityType'] === null) { + $invalidProperties[] = "'legalEntityType' can't be null"; + } + if ($this->container['businessInfo'] === null) { + $invalidProperties[] = "'businessInfo' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets referenceMerchantId + * + * @return string */ public function getReferenceMerchantId() { - return $this->referenceMerchantId; + return $this->container['referenceMerchantId']; } /** - * @param mixed $referenceMerchantId + * Sets referenceMerchantId + * + * @param string $referenceMerchantId The unique ID that is assigned by the marketplace to identify the sub-merchant. referenceMerchantId that fails to register the sub-merchant can be used again. More information: Maximum length: 64 characters + * + * @return self */ - public function setReferenceMerchantId($referenceMerchantId) + public function setReferenceMerchantId($referenceMerchantId) { - $this->referenceMerchantId = $referenceMerchantId; + $this->container['referenceMerchantId'] = $referenceMerchantId; + + return $this; } /** - * @return mixed + * Gets loginId + * + * @return string */ public function getLoginId() { - return $this->loginId; + return $this->container['loginId']; } /** - * @param mixed $loginId + * Sets loginId + * + * @param string $loginId The sub-merchant's login ID to the marketplace platform. The value of this parameter is an email. The email that is successfully used to register with Alipay cannot be used again. More information: Maximum length: 64 characters + * + * @return self */ - public function setLoginId($loginId) + public function setLoginId($loginId) { - $this->loginId = $loginId; + $this->container['loginId'] = $loginId; + + return $this; } /** - * @return mixed + * Gets legalEntityType + * + * @return \request\model\LegalEntityType */ public function getLegalEntityType() { - return $this->legalEntityType; + return $this->container['legalEntityType']; } /** - * @param mixed $legalEntityType + * Sets legalEntityType + * + * @param \request\model\LegalEntityType $legalEntityType legalEntityType + * + * @return self */ - public function setLegalEntityType($legalEntityType) + public function setLegalEntityType($legalEntityType) { - $this->legalEntityType = $legalEntityType; + $this->container['legalEntityType'] = $legalEntityType; + + return $this; } /** - * @return mixed + * Gets company + * + * @return \request\model\Company|null */ public function getCompany() { - return $this->company; + return $this->container['company']; } /** - * @param mixed $company + * Sets company + * + * @param \request\model\Company|null $company company + * + * @return self */ - public function setCompany($company) + public function setCompany($company) { - $this->company = $company; + $this->container['company'] = $company; + + return $this; } /** - * @return mixed + * Gets businessInfo + * + * @return \request\model\BusinessInfo */ public function getBusinessInfo() { - return $this->businessInfo; + return $this->container['businessInfo']; } /** - * @param mixed $businessInfo + * Sets businessInfo + * + * @param \request\model\BusinessInfo $businessInfo businessInfo + * + * @return self */ - public function setBusinessInfo($businessInfo) + public function setBusinessInfo($businessInfo) { - $this->businessInfo = $businessInfo; + $this->container['businessInfo'] = $businessInfo; + + return $this; } /** - * @return mixed + * Gets entityAssociations + * + * @return \request\model\EntityAssociations[]|null */ public function getEntityAssociations() { - return $this->entityAssociations; + return $this->container['entityAssociations']; + } + + /** + * Sets entityAssociations + * + * @param \request\model\EntityAssociations[]|null $entityAssociations The list of legal entities that are associated with the sub-merchant. The information is used to verify the company's legal status and ensure the company complies with regulatory requirements. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is BR, AU, SG, HK, GB, MY, US, or belongs to the European Union. More information: Maximum size: 100 elements + * + * @return self + */ + public function setEntityAssociations($entityAssociations) + { + $this->container['entityAssociations'] = $entityAssociations; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $entityAssociations + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setEntityAssociations($entityAssociations) + public function offsetSet($offset, $value): void { - $this->entityAssociations = $entityAssociations; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/MerchantType.php b/model/MerchantType.php index ca61fd6..b607492 100644 --- a/model/MerchantType.php +++ b/model/MerchantType.php @@ -1,9 +1,31 @@ + */ +class MpiData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MpiData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'threeDSVersion' => 'string', + 'eci' => 'string', + 'cavv' => 'string', + 'dsTransactionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'threeDSVersion' => null, + 'eci' => null, + 'cavv' => null, + 'dsTransactionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'threeDSVersion' => false, + 'eci' => false, + 'cavv' => false, + 'dsTransactionId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'threeDSVersion' => 'threeDSVersion', + 'eci' => 'eci', + 'cavv' => 'cavv', + 'dsTransactionId' => 'dsTransactionId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'threeDSVersion' => 'setThreeDSVersion', + 'eci' => 'setEci', + 'cavv' => 'setCavv', + 'dsTransactionId' => 'setDsTransactionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'threeDSVersion' => 'getThreeDSVersion', + 'eci' => 'getEci', + 'cavv' => 'getCavv', + 'dsTransactionId' => 'getDsTransactionId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('threeDSVersion', $data ?? [], null); + $this->setIfExists('eci', $data ?? [], null); + $this->setIfExists('cavv', $data ?? [], null); + $this->setIfExists('dsTransactionId', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets threeDSVersion + * + * @return string|null + */ + public function getThreeDSVersion() + { + return $this->container['threeDSVersion']; + } + + /** + * Sets threeDSVersion + * + * @param string|null $threeDSVersion threeDSVersion + * + * @return self + */ + public function setThreeDSVersion($threeDSVersion) + { + $this->container['threeDSVersion'] = $threeDSVersion; + + return $this; + } + + /** + * Gets eci + * + * @return string|null + */ + public function getEci() + { + return $this->container['eci']; + } + + /** + * Sets eci + * + * @param string|null $eci eci + * + * @return self + */ + public function setEci($eci) + { + $this->container['eci'] = $eci; + + return $this; + } + + /** + * Gets cavv + * + * @return string|null + */ + public function getCavv() + { + return $this->container['cavv']; + } + + /** + * Sets cavv + * + * @param string|null $cavv cavv + * + * @return self + */ + public function setCavv($cavv) + { + $this->container['cavv'] = $cavv; + + return $this; + } + + /** + * Gets dsTransactionId + * + * @return string|null + */ + public function getDsTransactionId() + { + return $this->container['dsTransactionId']; + } + + /** + * Sets dsTransactionId + * + * @param string|null $dsTransactionId dsTransactionId + * + * @return self + */ + public function setDsTransactionId($dsTransactionId) + { + $this->container['dsTransactionId'] = $dsTransactionId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/ObjectSerializer.php b/model/ObjectSerializer.php new file mode 100644 index 0000000..b1eceae --- /dev/null +++ b/model/ObjectSerializer.php @@ -0,0 +1,315 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\request\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } +} diff --git a/model/Order.php b/model/Order.php index 4a86d59..7deac1b 100644 --- a/model/Order.php +++ b/model/Order.php @@ -1,287 +1,822 @@ + */ +class Order implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Order'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'referenceOrderId' => 'string', + 'orderDescription' => 'string', + 'orderAmount' => '\request\model\Amount', + 'merchant' => '\request\model\Merchant', + 'goods' => '\request\model\Goods[]', + 'shipping' => '\request\model\Shipping', + 'buyer' => '\request\model\Buyer', + 'env' => '\request\model\Env', + 'extendInfo' => 'string', + 'transit' => '\request\model\Transit', + 'lodging' => '\request\model\Lodging', + 'gaming' => '\request\model\Gaming', + 'needDeclaration' => 'bool', + 'orderType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'referenceOrderId' => null, + 'orderDescription' => null, + 'orderAmount' => null, + 'merchant' => null, + 'goods' => null, + 'shipping' => null, + 'buyer' => null, + 'env' => null, + 'extendInfo' => null, + 'transit' => null, + 'lodging' => null, + 'gaming' => null, + 'needDeclaration' => null, + 'orderType' => null + ]; - public $referenceOrderId; - public $orderDescription; - public $orderAmount; - public $merchant; - public $goods; - public $shipping; - public $buyer; - public $env; - public $extendInfo; - public $transit; - public $lodging; - public $gaming; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'referenceOrderId' => false, + 'orderDescription' => false, + 'orderAmount' => false, + 'merchant' => false, + 'goods' => false, + 'shipping' => false, + 'buyer' => false, + 'env' => false, + 'extendInfo' => false, + 'transit' => false, + 'lodging' => false, + 'gaming' => false, + 'needDeclaration' => false, + 'orderType' => false + ]; - public $orderCreatedTime; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - public $needDeclaration; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } - public $orderDiscountAmount; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } - public $subTotalOrderAmount; + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * @return mixed + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public function getOrderDiscountAmount() + private function getOpenAPINullablesSetToNull(): array { - return $this->orderDiscountAmount; + return $this->openAPINullablesSetToNull; } /** - * @param mixed $orderDiscountAmount + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull */ - public function setOrderDiscountAmount($orderDiscountAmount) + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - $this->orderDiscountAmount = $orderDiscountAmount; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** - * @return mixed + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public function getSubTotalOrderAmount() + public static function isNullable(string $property): bool { - return $this->subTotalOrderAmount; + return self::openAPINullables()[$property] ?? false; } /** - * @param mixed $subTotalOrderAmount + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public function setSubTotalOrderAmount($subTotalOrderAmount) + public function isNullableSetToNull(string $property): bool { - $this->subTotalOrderAmount = $subTotalOrderAmount; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'referenceOrderId' => 'referenceOrderId', + 'orderDescription' => 'orderDescription', + 'orderAmount' => 'orderAmount', + 'merchant' => 'merchant', + 'goods' => 'goods', + 'shipping' => 'shipping', + 'buyer' => 'buyer', + 'env' => 'env', + 'extendInfo' => 'extendInfo', + 'transit' => 'transit', + 'lodging' => 'lodging', + 'gaming' => 'gaming', + 'needDeclaration' => 'needDeclaration', + 'orderType' => 'orderType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'referenceOrderId' => 'setReferenceOrderId', + 'orderDescription' => 'setOrderDescription', + 'orderAmount' => 'setOrderAmount', + 'merchant' => 'setMerchant', + 'goods' => 'setGoods', + 'shipping' => 'setShipping', + 'buyer' => 'setBuyer', + 'env' => 'setEnv', + 'extendInfo' => 'setExtendInfo', + 'transit' => 'setTransit', + 'lodging' => 'setLodging', + 'gaming' => 'setGaming', + 'needDeclaration' => 'setNeedDeclaration', + 'orderType' => 'setOrderType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] */ - public function getOrderCreatedTime() + protected static $getters = [ + 'referenceOrderId' => 'getReferenceOrderId', + 'orderDescription' => 'getOrderDescription', + 'orderAmount' => 'getOrderAmount', + 'merchant' => 'getMerchant', + 'goods' => 'getGoods', + 'shipping' => 'getShipping', + 'buyer' => 'getBuyer', + 'env' => 'getEnv', + 'extendInfo' => 'getExtendInfo', + 'transit' => 'getTransit', + 'lodging' => 'getLodging', + 'gaming' => 'getGaming', + 'needDeclaration' => 'getNeedDeclaration', + 'orderType' => 'getOrderType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() { - return $this->orderCreatedTime; + return self::$attributeMap; } /** - * @param mixed $orderCreatedTime + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public function setOrderCreatedTime($orderCreatedTime) + public static function setters() { - $this->orderCreatedTime = $orderCreatedTime; + return self::$setters; } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public function getNeedDeclaration() + public static function getters() { - return $this->needDeclaration; + return self::$getters; } /** - * @param mixed $needDeclaration + * The original name of the model. + * + * @return string */ - public function setNeedDeclaration($needDeclaration) + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('referenceOrderId', $data ?? [], null); + $this->setIfExists('orderDescription', $data ?? [], null); + $this->setIfExists('orderAmount', $data ?? [], null); + $this->setIfExists('merchant', $data ?? [], null); + $this->setIfExists('goods', $data ?? [], null); + $this->setIfExists('shipping', $data ?? [], null); + $this->setIfExists('buyer', $data ?? [], null); + $this->setIfExists('env', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('transit', $data ?? [], null); + $this->setIfExists('lodging', $data ?? [], null); + $this->setIfExists('gaming', $data ?? [], null); + $this->setIfExists('needDeclaration', $data ?? [], null); + $this->setIfExists('orderType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() { - $this->needDeclaration = $needDeclaration; + $invalidProperties = []; + + if ($this->container['referenceOrderId'] === null) { + $invalidProperties[] = "'referenceOrderId' can't be null"; + } + if ($this->container['orderAmount'] === null) { + $invalidProperties[] = "'orderAmount' can't be null"; + } + if ($this->container['orderType'] === null) { + $invalidProperties[] = "'orderType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; } /** - * @return String + * Gets referenceOrderId + * + * @return string */ public function getReferenceOrderId() { - return $this->referenceOrderId; + return $this->container['referenceOrderId']; } /** - * @param String $referenceOrderId + * Sets referenceOrderId + * + * @param string $referenceOrderId The unique ID to identify the order on the merchant side, which is assigned by the merchant that provides services or goods directly to the customer. This field is used for user consumption records display and other further actions such as disputes track or handling of customer complaints. More information: Maximum length: 64 characters + * + * @return self */ public function setReferenceOrderId($referenceOrderId) { - $this->referenceOrderId = $referenceOrderId; + $this->container['referenceOrderId'] = $referenceOrderId; + + return $this; } /** - * @return String + * Gets orderDescription + * + * @return string|null */ public function getOrderDescription() { - return $this->orderDescription; + return $this->container['orderDescription']; } /** - * @param String $orderDescription + * Sets orderDescription + * + * @param string|null $orderDescription Summary description of the order, which is used for user consumption records display or other further actions. More information: Maximum length: 256 characters + * + * @return self */ public function setOrderDescription($orderDescription) { - $this->orderDescription = $orderDescription; + $this->container['orderDescription'] = $orderDescription; + + return $this; } /** - * @return Amount + * Gets orderAmount + * + * @return \request\model\Amount */ public function getOrderAmount() { - return $this->orderAmount; + return $this->container['orderAmount']; } /** - * @param Amount $orderAmount + * Sets orderAmount + * + * @param \request\model\Amount $orderAmount orderAmount + * + * @return self */ public function setOrderAmount($orderAmount) { - $this->orderAmount = $orderAmount; + $this->container['orderAmount'] = $orderAmount; + + return $this; } /** - * @return Merchant + * Gets merchant + * + * @return \request\model\Merchant|null */ public function getMerchant() { - return $this->merchant; + return $this->container['merchant']; } /** - * @param Merchant $merchant + * Sets merchant + * + * @param \request\model\Merchant|null $merchant merchant + * + * @return self */ public function setMerchant($merchant) { - $this->merchant = $merchant; + $this->container['merchant'] = $merchant; + + return $this; } /** - * @return Goods + * Gets goods + * + * @return \request\model\Goods[]|null */ public function getGoods() { - return $this->goods; + return $this->container['goods']; } /** - * @param Goods $goods + * Sets goods + * + * @param \request\model\Goods[]|null $goods Goods information, including the ID, name, price, and quantity of the goods in the order. Note: Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum size: 100 elements + * + * @return self */ public function setGoods($goods) { - $this->goods = $goods; + $this->container['goods'] = $goods; + + return $this; } /** - * @return Shipping + * Gets shipping + * + * @return \request\model\Shipping|null */ public function getShipping() { - return $this->shipping; + return $this->container['shipping']; } /** - * @param Shipping $shipping + * Sets shipping + * + * @param \request\model\Shipping|null $shipping shipping + * + * @return self */ public function setShipping($shipping) { - $this->shipping = $shipping; + $this->container['shipping'] = $shipping; + + return $this; } /** - * @return Buyer + * Gets buyer + * + * @return \request\model\Buyer|null */ public function getBuyer() { - return $this->buyer; + return $this->container['buyer']; } /** - * @param Buyer $buyer + * Sets buyer + * + * @param \request\model\Buyer|null $buyer buyer + * + * @return self */ public function setBuyer($buyer) { - $this->buyer = $buyer; + $this->container['buyer'] = $buyer; + + return $this; } /** - * @return Env + * Gets env + * + * @return \request\model\Env|null */ public function getEnv() { - return $this->env; + return $this->container['env']; } /** - * @param Env $env + * Sets env + * + * @param \request\model\Env|null $env env + * + * @return self */ public function setEnv($env) { - $this->env = $env; + $this->container['env'] = $env; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; } /** - * @return mixed + * Gets transit + * + * @return \request\model\Transit|null */ - public function getGaming() + public function getTransit() { - return $this->gaming; + return $this->container['transit']; } /** - * @param mixed $gaming + * Sets transit + * + * @param \request\model\Transit|null $transit transit + * + * @return self */ - public function setGaming($gaming) + public function setTransit($transit) { - $this->gaming = $gaming; + $this->container['transit'] = $transit; + + return $this; } /** - * @return mixed + * Gets lodging + * + * @return \request\model\Lodging|null */ public function getLodging() { - return $this->lodging; + return $this->container['lodging']; } /** - * @param mixed $lodging + * Sets lodging + * + * @param \request\model\Lodging|null $lodging lodging + * + * @return self */ public function setLodging($lodging) { - $this->lodging = $lodging; + $this->container['lodging'] = $lodging; + + return $this; } /** - * @return mixed + * Gets gaming + * + * @return \request\model\Gaming|null */ - public function getTransit() + public function getGaming() { - return $this->transit; + return $this->container['gaming']; } /** - * @param mixed $transit + * Sets gaming + * + * @param \request\model\Gaming|null $gaming gaming + * + * @return self */ - public function setTransit($transit) + public function setGaming($gaming) + { + $this->container['gaming'] = $gaming; + + return $this; + } + + /** + * Gets needDeclaration + * + * @return bool|null + */ + public function getNeedDeclaration() + { + return $this->container['needDeclaration']; + } + + /** + * Sets needDeclaration + * + * @param bool|null $needDeclaration needDeclaration + * + * @return self + */ + public function setNeedDeclaration($needDeclaration) + { + $this->container['needDeclaration'] = $needDeclaration; + + return $this; + } + + /** + * Gets orderType + * + * @return string + */ + public function getOrderType() + { + return $this->container['orderType']; + } + + /** + * Sets orderType + * + * @param string $orderType test + * + * @return self + */ + public function setOrderType($orderType) + { + $this->container['orderType'] = $orderType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void { - $this->transit = $transit; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/OrderCodeForm.php b/model/OrderCodeForm.php index 5a97797..f6a62ea 100644 --- a/model/OrderCodeForm.php +++ b/model/OrderCodeForm.php @@ -1,76 +1,509 @@ + */ +class OrderCodeForm implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderCodeForm'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodType' => 'string', + 'expireTime' => 'string', + 'codeDetails' => '\request\model\CodeDetail[]', + 'extendInfo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodType' => null, + 'expireTime' => null, + 'codeDetails' => null, + 'extendInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodType' => false, + 'expireTime' => false, + 'codeDetails' => false, + 'extendInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodType' => 'paymentMethodType', + 'expireTime' => 'expireTime', + 'codeDetails' => 'codeDetails', + 'extendInfo' => 'extendInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodType' => 'setPaymentMethodType', + 'expireTime' => 'setExpireTime', + 'codeDetails' => 'setCodeDetails', + 'extendInfo' => 'setExtendInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodType' => 'getPaymentMethodType', + 'expireTime' => 'getExpireTime', + 'codeDetails' => 'getCodeDetails', + 'extendInfo' => 'getExtendInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - public $paymentMethodType; - public $expireTime; - public $codeDetails; - public $extendInfo; /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('expireTime', $data ?? [], null); + $this->setIfExists('codeDetails', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['expireTime'] === null) { + $invalidProperties[] = "'expireTime' can't be null"; + } + if ($this->container['codeDetails'] === null) { + $invalidProperties[] = "'codeDetails' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodType + * + * @return string|null */ public function getPaymentMethodType() { - return $this->paymentMethodType; + return $this->container['paymentMethodType']; } /** - * @param mixed $paymentMethodType + * Sets paymentMethodType + * + * @param string|null $paymentMethodType paymentMethodType + * + * @return self */ public function setPaymentMethodType($paymentMethodType) { - $this->paymentMethodType = $paymentMethodType; + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; } /** - * @return mixed + * Gets expireTime + * + * @return string */ public function getExpireTime() { - return $this->expireTime; + return $this->container['expireTime']; } /** - * @param mixed $expireTime + * Sets expireTime + * + * @param string $expireTime Expiry time of the order code information. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setExpireTime($expireTime) { - $this->expireTime = $expireTime; + $this->container['expireTime'] = $expireTime; + + return $this; } /** - * @return mixed + * Gets codeDetails + * + * @return \request\model\CodeDetail[] */ public function getCodeDetails() { - return $this->codeDetails; + return $this->container['codeDetails']; } /** - * @param mixed $codeDetails + * Sets codeDetails + * + * @param \request\model\CodeDetail[] $codeDetails Details about the code. More information: Maximum size: 4 elements + * + * @return self */ public function setCodeDetails($codeDetails) { - $this->codeDetails = $codeDetails; + $this->container['codeDetails'] = $codeDetails; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo Extended information. Note: This field is returned when extended information exists. More information: Maximum length: 2048 characters + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/OrderInfo.php b/model/OrderInfo.php index 540c1f9..250b5dd 100644 --- a/model/OrderInfo.php +++ b/model/OrderInfo.php @@ -1,26 +1,413 @@ + */ +class OrderInfo implements ModelInterface, ArrayAccess, \JsonSerializable { - public $orderAmount; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'orderAmount' => '\request\model\Amount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'orderAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'orderAmount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'orderAmount' => 'orderAmount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'orderAmount' => 'setOrderAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'orderAmount' => 'getOrderAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('orderAmount', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['orderAmount'] === null) { + $invalidProperties[] = "'orderAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets orderAmount + * + * @return \request\model\Amount */ public function getOrderAmount() { - return $this->orderAmount; + return $this->container['orderAmount']; } /** - * @param mixed $orderAmount + * Sets orderAmount + * + * @param \request\model\Amount $orderAmount orderAmount + * + * @return self */ public function setOrderAmount($orderAmount) { - $this->orderAmount = $orderAmount; + $this->container['orderAmount'] = $orderAmount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/OsType.php b/model/OsType.php index a14e1e1..5bc9fcf 100644 --- a/model/OsType.php +++ b/model/OsType.php @@ -1,10 +1,31 @@ + */ +class Passenger implements ModelInterface, ArrayAccess, \JsonSerializable { - public $passengerName; - public $passengerEmail; - public $passengerPhoneNo; -} \ No newline at end of file + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Passenger'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'passengerName' => '\request\model\UserName', + 'passengerEmail' => 'string', + 'passengerPhoneNo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'passengerName' => null, + 'passengerEmail' => null, + 'passengerPhoneNo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'passengerName' => false, + 'passengerEmail' => false, + 'passengerPhoneNo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'passengerName' => 'passengerName', + 'passengerEmail' => 'passengerEmail', + 'passengerPhoneNo' => 'passengerPhoneNo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'passengerName' => 'setPassengerName', + 'passengerEmail' => 'setPassengerEmail', + 'passengerPhoneNo' => 'setPassengerPhoneNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'passengerName' => 'getPassengerName', + 'passengerEmail' => 'getPassengerEmail', + 'passengerPhoneNo' => 'getPassengerPhoneNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('passengerName', $data ?? [], null); + $this->setIfExists('passengerEmail', $data ?? [], null); + $this->setIfExists('passengerPhoneNo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets passengerName + * + * @return \request\model\UserName|null + */ + public function getPassengerName() + { + return $this->container['passengerName']; + } + + /** + * Sets passengerName + * + * @param \request\model\UserName|null $passengerName passengerName + * + * @return self + */ + public function setPassengerName($passengerName) + { + $this->container['passengerName'] = $passengerName; + + return $this; + } + + /** + * Gets passengerEmail + * + * @return string|null + */ + public function getPassengerEmail() + { + return $this->container['passengerEmail']; + } + + /** + * Sets passengerEmail + * + * @param string|null $passengerEmail passengerEmail + * + * @return self + */ + public function setPassengerEmail($passengerEmail) + { + $this->container['passengerEmail'] = $passengerEmail; + + return $this; + } + + /** + * Gets passengerPhoneNo + * + * @return string|null + */ + public function getPassengerPhoneNo() + { + return $this->container['passengerPhoneNo']; + } + + /** + * Sets passengerPhoneNo + * + * @param string|null $passengerPhoneNo passengerPhoneNo + * + * @return self + */ + public function setPassengerPhoneNo($passengerPhoneNo) + { + $this->container['passengerPhoneNo'] = $passengerPhoneNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentFactor.php b/model/PaymentFactor.php index 4163bb2..8571049 100644 --- a/model/PaymentFactor.php +++ b/model/PaymentFactor.php @@ -1,97 +1,534 @@ + */ +class PaymentFactor implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentFactor'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'isPaymentEvaluation' => 'bool', + 'inStorePaymentScenario' => '\request\model\InStorePaymentScenario', + 'presentmentMode' => '\request\model\PresentmentMode', + 'captureMode' => 'string', + 'isAuthorization' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'isPaymentEvaluation' => null, + 'inStorePaymentScenario' => null, + 'presentmentMode' => null, + 'captureMode' => null, + 'isAuthorization' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'isPaymentEvaluation' => false, + 'inStorePaymentScenario' => false, + 'presentmentMode' => false, + 'captureMode' => false, + 'isAuthorization' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $isPaymentEvaluation; - public $inStorePaymentScenario; - public $presentmentMode; + /** + * 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); + } - public $captureMode; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'isPaymentEvaluation' => 'isPaymentEvaluation', + 'inStorePaymentScenario' => 'inStorePaymentScenario', + 'presentmentMode' => 'presentmentMode', + 'captureMode' => 'captureMode', + 'isAuthorization' => 'isAuthorization' + ]; - public $isAuthorization; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'isPaymentEvaluation' => 'setIsPaymentEvaluation', + 'inStorePaymentScenario' => 'setInStorePaymentScenario', + 'presentmentMode' => 'setPresentmentMode', + 'captureMode' => 'setCaptureMode', + 'isAuthorization' => 'setIsAuthorization' + ]; /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'isPaymentEvaluation' => 'getIsPaymentEvaluation', + 'inStorePaymentScenario' => 'getInStorePaymentScenario', + 'presentmentMode' => 'getPresentmentMode', + 'captureMode' => 'getCaptureMode', + 'isAuthorization' => 'getIsAuthorization' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('isPaymentEvaluation', $data ?? [], null); + $this->setIfExists('inStorePaymentScenario', $data ?? [], null); + $this->setIfExists('presentmentMode', $data ?? [], null); + $this->setIfExists('captureMode', $data ?? [], null); + $this->setIfExists('isAuthorization', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets isPaymentEvaluation + * + * @return bool|null */ public function getIsPaymentEvaluation() { - return $this->isPaymentEvaluation; + return $this->container['isPaymentEvaluation']; } /** - * @param mixed $isPaymentEvaluation + * Sets isPaymentEvaluation + * + * @param bool|null $isPaymentEvaluation isPaymentEvaluation + * + * @return self */ public function setIsPaymentEvaluation($isPaymentEvaluation) { - $this->isPaymentEvaluation = $isPaymentEvaluation; + $this->container['isPaymentEvaluation'] = $isPaymentEvaluation; + + return $this; } /** - * @return mixed + * Gets inStorePaymentScenario + * + * @return \request\model\InStorePaymentScenario|null */ public function getInStorePaymentScenario() { - return $this->inStorePaymentScenario; + return $this->container['inStorePaymentScenario']; } /** - * @param mixed $inStorePaymentScenario + * Sets inStorePaymentScenario + * + * @param \request\model\InStorePaymentScenario|null $inStorePaymentScenario inStorePaymentScenario + * + * @return self */ public function setInStorePaymentScenario($inStorePaymentScenario) { - $this->inStorePaymentScenario = $inStorePaymentScenario; + $this->container['inStorePaymentScenario'] = $inStorePaymentScenario; + + return $this; } /** - * @return mixed + * Gets presentmentMode + * + * @return \request\model\PresentmentMode|null */ public function getPresentmentMode() { - return $this->presentmentMode; + return $this->container['presentmentMode']; } /** - * @param mixed $presentmentMode + * Sets presentmentMode + * + * @param \request\model\PresentmentMode|null $presentmentMode presentmentMode + * + * @return self */ public function setPresentmentMode($presentmentMode) { - $this->presentmentMode = $presentmentMode; + $this->container['presentmentMode'] = $presentmentMode; + + return $this; } /** - * @return mixed + * Gets captureMode + * + * @return string|null + */ + public function getCaptureMode() + { + return $this->container['captureMode']; + } + + /** + * Sets captureMode + * + * @param string|null $captureMode Indicates the method for capturing funds after the user authorizes the payment. Valid values are: AUTOMATIC: indicates that Antom automatically captures the funds after the authorization. The same applies when the value is empty or you do not pass in this parameter. MANUAL: indicates that you manually capture the funds by calling the capture (Checkout Payment) API. Specify this parameter if you want to designate the capture mode of the payment. More information: Maximum length: 64 characters + * + * @return self + */ + public function setCaptureMode($captureMode) + { + $this->container['captureMode'] = $captureMode; + + return $this; + } + + /** + * Gets isAuthorization + * + * @return bool|null */ public function getIsAuthorization() { - return $this->isAuthorization; + return $this->container['isAuthorization']; } /** - * @param mixed $isAuthorization + * Sets isAuthorization + * + * @param bool|null $isAuthorization Indicates whether the payment scenario is authorization. Specify this parameter when the value of paymentMethodType is CARD and you integrate the client-side SDK. Valid values of this parameter are: true: indicates that the payment scenario is authorization. false: indicates that the payment scenario is a regular payment without authorization. Under the authorization scenario, the payment funds are guaranteed and held on the payment method side. You can use the capture (Checkout Payment) API to deduct the payment funds. + * + * @return self */ public function setIsAuthorization($isAuthorization) { - $this->isAuthorization = $isAuthorization; + $this->container['isAuthorization'] = $isAuthorization; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } /** - * @return mixed + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null */ - public function getCaptureMode() + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - return $this->captureMode; + return $this->container[$offset] ?? null; } /** - * @param mixed $captureMode + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setCaptureMode($captureMode) + public function offsetSet($offset, $value): void { - $this->captureMode = $captureMode; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentMethod.php b/model/PaymentMethod.php index 712f818..8614142 100644 --- a/model/PaymentMethod.php +++ b/model/PaymentMethod.php @@ -1,113 +1,568 @@ + */ +class PaymentMethod implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethod'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodType' => 'string', + 'paymentMethodId' => 'string', + 'paymentMethodMetaData' => 'array', + 'customerId' => 'string', + 'extendInfo' => 'string', + 'requireIssuerAuthentication' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodType' => null, + 'paymentMethodId' => null, + 'paymentMethodMetaData' => null, + 'customerId' => null, + 'extendInfo' => null, + 'requireIssuerAuthentication' => null + ]; - public $paymentMethodType; - public $paymentMethodId; - public $paymentMethodMetaData; - public $customerId; - public $extendInfo; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodType' => false, + 'paymentMethodId' => false, + 'paymentMethodMetaData' => false, + 'customerId' => false, + 'extendInfo' => false, + 'requireIssuerAuthentication' => false + ]; - public $requireIssuerAuthentication; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; /** - * @return mixed + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodType' => 'paymentMethodType', + 'paymentMethodId' => 'paymentMethodId', + 'paymentMethodMetaData' => 'paymentMethodMetaData', + 'customerId' => 'customerId', + 'extendInfo' => 'extendInfo', + 'requireIssuerAuthentication' => 'requireIssuerAuthentication' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodType' => 'setPaymentMethodType', + 'paymentMethodId' => 'setPaymentMethodId', + 'paymentMethodMetaData' => 'setPaymentMethodMetaData', + 'customerId' => 'setCustomerId', + 'extendInfo' => 'setExtendInfo', + 'requireIssuerAuthentication' => 'setRequireIssuerAuthentication' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodType' => 'getPaymentMethodType', + 'paymentMethodId' => 'getPaymentMethodId', + 'paymentMethodMetaData' => 'getPaymentMethodMetaData', + 'customerId' => 'getCustomerId', + 'extendInfo' => 'getExtendInfo', + 'requireIssuerAuthentication' => 'getRequireIssuerAuthentication' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('paymentMethodId', $data ?? [], null); + $this->setIfExists('paymentMethodMetaData', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('requireIssuerAuthentication', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['paymentMethodType'] === null) { + $invalidProperties[] = "'paymentMethodType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodType + * + * @return string */ public function getPaymentMethodType() { - return $this->paymentMethodType; + return $this->container['paymentMethodType']; } /** - * @param mixed $paymentMethodType + * Sets paymentMethodType + * + * @param string $paymentMethodType The payment method that is used to accept the subscription payment. See Payment methods to check the valid values. Note: Card payment method is not currently supported when you work with Antom as your acquirer. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentMethodType($paymentMethodType) { - $this->paymentMethodType = $paymentMethodType; + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; } /** - * @return mixed + * Gets paymentMethodId + * + * @return string|null */ public function getPaymentMethodId() { - return $this->paymentMethodId; + return $this->container['paymentMethodId']; } /** - * @param mixed $paymentMethodId + * Sets paymentMethodId + * + * @param string|null $paymentMethodId The unique ID that is used to identify a payment method. Pass the corresponding token to this field when the user has a bound payment method. More information: Maximum length: 128 characters + * + * @return self */ public function setPaymentMethodId($paymentMethodId) { - $this->paymentMethodId = $paymentMethodId; + $this->container['paymentMethodId'] = $paymentMethodId; + + return $this; } /** - * @return mixed + * Gets paymentMethodMetaData + * + * @return array|null */ public function getPaymentMethodMetaData() { - return $this->paymentMethodMetaData; + return $this->container['paymentMethodMetaData']; } /** - * @param mixed $paymentMethodMetaData + * Sets paymentMethodMetaData + * + * @param array|null $paymentMethodMetaData paymentMethodMetaData + * + * @return self */ public function setPaymentMethodMetaData($paymentMethodMetaData) { - $this->paymentMethodMetaData = $paymentMethodMetaData; + $this->container['paymentMethodMetaData'] = $paymentMethodMetaData; + + return $this; } /** - * @return mixed + * Gets customerId + * + * @return string|null */ public function getCustomerId() { - return $this->customerId; + return $this->container['customerId']; } /** - * @param mixed $customerId + * Sets customerId + * + * @param string|null $customerId customerId + * + * @return self */ public function setCustomerId($customerId) { - $this->customerId = $customerId; + $this->container['customerId'] = $customerId; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; } /** - * @return mixed + * Gets requireIssuerAuthentication + * + * @return bool|null */ public function getRequireIssuerAuthentication() { - return $this->requireIssuerAuthentication; + return $this->container['requireIssuerAuthentication']; } /** - * @param mixed $requireIssuerAuthentication + * Sets requireIssuerAuthentication + * + * @param bool|null $requireIssuerAuthentication requireIssuerAuthentication + * + * @return self */ public function setRequireIssuerAuthentication($requireIssuerAuthentication) { - $this->requireIssuerAuthentication = $requireIssuerAuthentication; + $this->container['requireIssuerAuthentication'] = $requireIssuerAuthentication; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentMethodCategoryType.php b/model/PaymentMethodCategoryType.php index c247583..c299145 100644 --- a/model/PaymentMethodCategoryType.php +++ b/model/PaymentMethodCategoryType.php @@ -1,11 +1,36 @@ + */ +class PaymentMethodDetail implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodDetailType' => '\request\model\PaymentMethodDetailType', + 'card' => '\request\model\CardPaymentMethodDetail', + 'externalAccount' => '\request\model\ExternalPaymentMethodDetail', + 'discount' => '\request\model\DiscountPaymentMethodDetail', + 'coupon' => '\request\model\CouponPaymentMethodDetail', + 'paymentMethodType' => 'string', + 'extendInfo' => 'string', + 'wallet' => '\request\model\Wallet', + 'interactionType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodDetailType' => null, + 'card' => null, + 'externalAccount' => null, + 'discount' => null, + 'coupon' => null, + 'paymentMethodType' => null, + 'extendInfo' => null, + 'wallet' => null, + 'interactionType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodDetailType' => false, + 'card' => false, + 'externalAccount' => false, + 'discount' => false, + 'coupon' => false, + 'paymentMethodType' => false, + 'extendInfo' => false, + 'wallet' => false, + 'interactionType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - public $paymentMethodDetailType; - public $card; - public $externalAccount; - public $discount; - public $coupon; - public $extendInfo; + /** + * 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); + } - public $paymentMethodType; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodDetailType' => 'paymentMethodDetailType', + 'card' => 'card', + 'externalAccount' => 'externalAccount', + 'discount' => 'discount', + 'coupon' => 'coupon', + 'paymentMethodType' => 'paymentMethodType', + 'extendInfo' => 'extendInfo', + 'wallet' => 'wallet', + 'interactionType' => 'interactionType' + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodDetailType' => 'setPaymentMethodDetailType', + 'card' => 'setCard', + 'externalAccount' => 'setExternalAccount', + 'discount' => 'setDiscount', + 'coupon' => 'setCoupon', + 'paymentMethodType' => 'setPaymentMethodType', + 'extendInfo' => 'setExtendInfo', + 'wallet' => 'setWallet', + 'interactionType' => 'setInteractionType' + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodDetailType' => 'getPaymentMethodDetailType', + 'card' => 'getCard', + 'externalAccount' => 'getExternalAccount', + 'discount' => 'getDiscount', + 'coupon' => 'getCoupon', + 'paymentMethodType' => 'getPaymentMethodType', + 'extendInfo' => 'getExtendInfo', + 'wallet' => 'getWallet', + 'interactionType' => 'getInteractionType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodDetailType', $data ?? [], null); + $this->setIfExists('card', $data ?? [], null); + $this->setIfExists('externalAccount', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('coupon', $data ?? [], null); + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('wallet', $data ?? [], null); + $this->setIfExists('interactionType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['paymentMethodType'] === null) { + $invalidProperties[] = "'paymentMethodType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodDetailType + * + * @return \request\model\PaymentMethodDetailType|null */ public function getPaymentMethodDetailType() { - return $this->paymentMethodDetailType; + return $this->container['paymentMethodDetailType']; } /** - * @param mixed $paymentMethodDetailType + * Sets paymentMethodDetailType + * + * @param \request\model\PaymentMethodDetailType|null $paymentMethodDetailType paymentMethodDetailType + * + * @return self */ public function setPaymentMethodDetailType($paymentMethodDetailType) { - $this->paymentMethodDetailType = $paymentMethodDetailType; + $this->container['paymentMethodDetailType'] = $paymentMethodDetailType; + + return $this; } /** - * @return mixed + * Gets card + * + * @return \request\model\CardPaymentMethodDetail|null */ public function getCard() { - return $this->card; + return $this->container['card']; } /** - * @param mixed $card + * Sets card + * + * @param \request\model\CardPaymentMethodDetail|null $card card + * + * @return self */ public function setCard($card) { - $this->card = $card; + $this->container['card'] = $card; + + return $this; } /** - * @return mixed + * Gets externalAccount + * + * @return \request\model\ExternalPaymentMethodDetail|null */ public function getExternalAccount() { - return $this->externalAccount; + return $this->container['externalAccount']; } /** - * @param mixed $externalAccount + * Sets externalAccount + * + * @param \request\model\ExternalPaymentMethodDetail|null $externalAccount externalAccount + * + * @return self */ public function setExternalAccount($externalAccount) { - $this->externalAccount = $externalAccount; + $this->container['externalAccount'] = $externalAccount; + + return $this; } /** - * @return mixed + * Gets discount + * + * @return \request\model\DiscountPaymentMethodDetail|null */ public function getDiscount() { - return $this->discount; + return $this->container['discount']; } /** - * @param mixed $discount + * Sets discount + * + * @param \request\model\DiscountPaymentMethodDetail|null $discount discount + * + * @return self */ public function setDiscount($discount) { - $this->discount = $discount; + $this->container['discount'] = $discount; + + return $this; } /** - * @return mixed + * Gets coupon + * + * @return \request\model\CouponPaymentMethodDetail|null */ public function getCoupon() { - return $this->coupon; + return $this->container['coupon']; } /** - * @param mixed $coupon + * Sets coupon + * + * @param \request\model\CouponPaymentMethodDetail|null $coupon coupon + * + * @return self */ public function setCoupon($coupon) { - $this->coupon = $coupon; + $this->container['coupon'] = $coupon; + + return $this; + } + + /** + * Gets paymentMethodType + * + * @return string + */ + public function getPaymentMethodType() + { + return $this->container['paymentMethodType']; + } + + /** + * Sets paymentMethodType + * + * @param string $paymentMethodType The type of payment method to be vaulted. The value of this parameter is fixed to CARD. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentMethodType($paymentMethodType) + { + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; } /** - * @return mixed + * Gets wallet + * + * @return \request\model\Wallet|null */ - public function getPaymentMethodType() + public function getWallet() { - return $this->paymentMethodType; + return $this->container['wallet']; } /** - * @param mixed $paymentMethodType + * Sets wallet + * + * @param \request\model\Wallet|null $wallet wallet + * + * @return self */ - public function setPaymentMethodType($paymentMethodType) + public function setWallet($wallet) { - $this->paymentMethodType = $paymentMethodType; + $this->container['wallet'] = $wallet; + + return $this; } + /** + * Gets interactionType + * + * @return string|null + */ + public function getInteractionType() + { + return $this->container['interactionType']; + } + + /** + * Sets interactionType + * + * @param string|null $interactionType interactionType + * + * @return self + */ + public function setInteractionType($interactionType) + { + $this->container['interactionType'] = $interactionType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentMethodDetailType.php b/model/PaymentMethodDetailType.php index 5d09ee7..ede17df 100644 --- a/model/PaymentMethodDetailType.php +++ b/model/PaymentMethodDetailType.php @@ -1,12 +1,33 @@ + */ +class PaymentMethodInfo implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodType' => 'string', + 'paymentMethodDetail' => 'string', + 'enabled' => 'bool', + 'preferred' => 'bool', + 'extendInfo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodType' => null, + 'paymentMethodDetail' => null, + 'enabled' => null, + 'preferred' => null, + 'extendInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodType' => false, + 'paymentMethodDetail' => false, + 'enabled' => false, + 'preferred' => false, + 'extendInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodType' => 'paymentMethodType', + 'paymentMethodDetail' => 'paymentMethodDetail', + 'enabled' => 'enabled', + 'preferred' => 'preferred', + 'extendInfo' => 'extendInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodType' => 'setPaymentMethodType', + 'paymentMethodDetail' => 'setPaymentMethodDetail', + 'enabled' => 'setEnabled', + 'preferred' => 'setPreferred', + 'extendInfo' => 'setExtendInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodType' => 'getPaymentMethodType', + 'paymentMethodDetail' => 'getPaymentMethodDetail', + 'enabled' => 'getEnabled', + 'preferred' => 'getPreferred', + 'extendInfo' => 'getExtendInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + - public $paymentMethodType; - public $paymentMethodDetail; - public $enabled; - public $preferred; - public $extendInfo; + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return mixed + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('paymentMethodDetail', $data ?? [], null); + $this->setIfExists('enabled', $data ?? [], null); + $this->setIfExists('preferred', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodType + * + * @return string|null */ public function getPaymentMethodType() { - return $this->paymentMethodType; + return $this->container['paymentMethodType']; } /** - * @param mixed $paymentMethodType + * Sets paymentMethodType + * + * @param string|null $paymentMethodType paymentMethodType + * + * @return self */ public function setPaymentMethodType($paymentMethodType) { - $this->paymentMethodType = $paymentMethodType; + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; } /** - * @return mixed + * Gets paymentMethodDetail + * + * @return string|null */ public function getPaymentMethodDetail() { - return $this->paymentMethodDetail; + return $this->container['paymentMethodDetail']; } /** - * @param mixed $paymentMethodDetail + * Sets paymentMethodDetail + * + * @param string|null $paymentMethodDetail paymentMethodDetail + * + * @return self */ public function setPaymentMethodDetail($paymentMethodDetail) { - $this->paymentMethodDetail = $paymentMethodDetail; + $this->container['paymentMethodDetail'] = $paymentMethodDetail; + + return $this; } /** - * @return mixed + * Gets enabled + * + * @return bool|null */ public function getEnabled() { - return $this->enabled; + return $this->container['enabled']; } /** - * @param mixed $enabled + * Sets enabled + * + * @param bool|null $enabled enabled + * + * @return self */ public function setEnabled($enabled) { - $this->enabled = $enabled; + $this->container['enabled'] = $enabled; + + return $this; } /** - * @return mixed + * Gets preferred + * + * @return bool|null */ public function getPreferred() { - return $this->preferred; + return $this->container['preferred']; } /** - * @param mixed $preferred + * Sets preferred + * + * @param bool|null $preferred preferred + * + * @return self */ public function setPreferred($preferred) { - $this->preferred = $preferred; + $this->container['preferred'] = $preferred; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentMethodTypeItem.php b/model/PaymentMethodTypeItem.php index 4d52ba7..7a356d1 100644 --- a/model/PaymentMethodTypeItem.php +++ b/model/PaymentMethodTypeItem.php @@ -1,64 +1,472 @@ + */ +class PaymentMethodTypeItem implements ModelInterface, ArrayAccess, \JsonSerializable { - public $paymentMethodType; - public $paymentMethodOrder; - public $expressCheckout; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentMethodTypeItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodType' => 'string', + 'paymentMethodOrder' => 'string', + 'expressCheckout' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodType' => null, + 'paymentMethodOrder' => null, + 'expressCheckout' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodType' => false, + 'paymentMethodOrder' => false, + 'expressCheckout' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodType' => 'paymentMethodType', + 'paymentMethodOrder' => 'paymentMethodOrder', + 'expressCheckout' => 'expressCheckout' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodType' => 'setPaymentMethodType', + 'paymentMethodOrder' => 'setPaymentMethodOrder', + 'expressCheckout' => 'setExpressCheckout' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodType' => 'getPaymentMethodType', + 'paymentMethodOrder' => 'getPaymentMethodOrder', + 'expressCheckout' => 'getExpressCheckout' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('paymentMethodOrder', $data ?? [], null); + $this->setIfExists('expressCheckout', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodType + * + * @return string|null */ public function getPaymentMethodType() { - return $this->paymentMethodType; + return $this->container['paymentMethodType']; } /** - * @param mixed $paymentMethodType + * Sets paymentMethodType + * + * @param string|null $paymentMethodType The payment method type that is included in payment method options. See Payment methods to check the valid values. More information: Value range: 64 + * + * @return self */ public function setPaymentMethodType($paymentMethodType) { - $this->paymentMethodType = $paymentMethodType; + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; } /** - * @return mixed + * Gets paymentMethodOrder + * + * @return string|null */ public function getPaymentMethodOrder() { - return $this->paymentMethodOrder; + return $this->container['paymentMethodOrder']; } /** - * @param mixed $paymentMethodOrder + * Sets paymentMethodOrder + * + * @param string|null $paymentMethodOrder The priority order of the payment methods configured by the user is indicated by numerical values, with smaller numbers representing higher priority. If the user does not specify a setting, Antom will apply a default sorting method. More information: Value range: [1, +∞) + * + * @return self */ public function setPaymentMethodOrder($paymentMethodOrder) { - $this->paymentMethodOrder = $paymentMethodOrder; + $this->container['paymentMethodOrder'] = $paymentMethodOrder; + + return $this; } /** - * @return mixed + * Gets expressCheckout + * + * @return string|null */ public function getExpressCheckout() { - return $this->expressCheckout; + return $this->container['expressCheckout']; } /** - * @param mixed $expressCheckout + * Sets expressCheckout + * + * @param string|null $expressCheckout Indicates whether the payment method selected by the user is displayed as a quick payment method. The currently supported quick payment methods include ALIPAY_CN, APPLEPAY, and GOOGLAPAY. The valid values include: true: The payment method selected by the user is displayed as a quick payment method. false: The payment method selected by the user is not displayed as a quick payment method. + * + * @return self */ public function setExpressCheckout($expressCheckout) { - $this->expressCheckout = $expressCheckout; + $this->container['expressCheckout'] = $expressCheckout; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] public function jsonSerialize() { - return get_object_vars($this); + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } -} \ No newline at end of file +} diff --git a/model/PaymentOption.php b/model/PaymentOption.php index e11eee3..46cb244 100644 --- a/model/PaymentOption.php +++ b/model/PaymentOption.php @@ -1,162 +1,819 @@ + */ +class PaymentOption implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentOption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodType' => 'string', + 'paymentMethodCategory' => '\request\model\PaymentMethodCategoryType', + 'paymentMethodRegion' => 'string[]', + 'enabled' => 'bool', + 'preferred' => 'bool', + 'disableReason' => 'string', + 'amountLimitInfoMap' => 'array', + 'supportedCurrencies' => 'string[]', + 'paymentOptionDetail' => '\request\model\PaymentOptionDetail', + 'extendInfo' => 'string', + 'logo' => '\request\model\Logo', + 'promoNames' => 'string[]', + 'installment' => '\request\model\Installment', + 'promotionInfos' => '\request\model\PromotionInfo[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodType' => null, + 'paymentMethodCategory' => null, + 'paymentMethodRegion' => null, + 'enabled' => null, + 'preferred' => null, + 'disableReason' => null, + 'amountLimitInfoMap' => null, + 'supportedCurrencies' => null, + 'paymentOptionDetail' => null, + 'extendInfo' => null, + 'logo' => null, + 'promoNames' => null, + 'installment' => null, + 'promotionInfos' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodType' => false, + 'paymentMethodCategory' => false, + 'paymentMethodRegion' => false, + 'enabled' => false, + 'preferred' => false, + 'disableReason' => false, + 'amountLimitInfoMap' => false, + 'supportedCurrencies' => false, + 'paymentOptionDetail' => false, + 'extendInfo' => false, + 'logo' => false, + 'promoNames' => false, + 'installment' => false, + 'promotionInfos' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $paymentMethodType; - public $paymentMethodCategory; - public $enabled; - public $preferred; - public $disableReason; - public $amountLimitInfoMap; - public $supportedCurrencies; - public $paymentOptionDetail; - public $extendInfo; + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodType' => 'paymentMethodType', + 'paymentMethodCategory' => 'paymentMethodCategory', + 'paymentMethodRegion' => 'paymentMethodRegion', + 'enabled' => 'enabled', + 'preferred' => 'preferred', + 'disableReason' => 'disableReason', + 'amountLimitInfoMap' => 'amountLimitInfoMap', + 'supportedCurrencies' => 'supportedCurrencies', + 'paymentOptionDetail' => 'paymentOptionDetail', + 'extendInfo' => 'extendInfo', + 'logo' => 'logo', + 'promoNames' => 'promoNames', + 'installment' => 'installment', + 'promotionInfos' => 'promotionInfos' + ]; /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodType' => 'setPaymentMethodType', + 'paymentMethodCategory' => 'setPaymentMethodCategory', + 'paymentMethodRegion' => 'setPaymentMethodRegion', + 'enabled' => 'setEnabled', + 'preferred' => 'setPreferred', + 'disableReason' => 'setDisableReason', + 'amountLimitInfoMap' => 'setAmountLimitInfoMap', + 'supportedCurrencies' => 'setSupportedCurrencies', + 'paymentOptionDetail' => 'setPaymentOptionDetail', + 'extendInfo' => 'setExtendInfo', + 'logo' => 'setLogo', + 'promoNames' => 'setPromoNames', + 'installment' => 'setInstallment', + 'promotionInfos' => 'setPromotionInfos' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodType' => 'getPaymentMethodType', + 'paymentMethodCategory' => 'getPaymentMethodCategory', + 'paymentMethodRegion' => 'getPaymentMethodRegion', + 'enabled' => 'getEnabled', + 'preferred' => 'getPreferred', + 'disableReason' => 'getDisableReason', + 'amountLimitInfoMap' => 'getAmountLimitInfoMap', + 'supportedCurrencies' => 'getSupportedCurrencies', + 'paymentOptionDetail' => 'getPaymentOptionDetail', + 'extendInfo' => 'getExtendInfo', + 'logo' => 'getLogo', + 'promoNames' => 'getPromoNames', + 'installment' => 'getInstallment', + 'promotionInfos' => 'getPromotionInfos' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('paymentMethodCategory', $data ?? [], null); + $this->setIfExists('paymentMethodRegion', $data ?? [], null); + $this->setIfExists('enabled', $data ?? [], null); + $this->setIfExists('preferred', $data ?? [], null); + $this->setIfExists('disableReason', $data ?? [], null); + $this->setIfExists('amountLimitInfoMap', $data ?? [], null); + $this->setIfExists('supportedCurrencies', $data ?? [], null); + $this->setIfExists('paymentOptionDetail', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('logo', $data ?? [], null); + $this->setIfExists('promoNames', $data ?? [], null); + $this->setIfExists('installment', $data ?? [], null); + $this->setIfExists('promotionInfos', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['paymentMethodType'] === null) { + $invalidProperties[] = "'paymentMethodType' can't be null"; + } + if ($this->container['enabled'] === null) { + $invalidProperties[] = "'enabled' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodType + * + * @return string */ public function getPaymentMethodType() { - return $this->paymentMethodType; + return $this->container['paymentMethodType']; } /** - * @param mixed $paymentMethodType + * Sets paymentMethodType + * + * @param string $paymentMethodType The payment method type. See Payment methods to check the valid values. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentMethodType($paymentMethodType) { - $this->paymentMethodType = $paymentMethodType; + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; } /** - * @return mixed + * Gets paymentMethodCategory + * + * @return \request\model\PaymentMethodCategoryType|null */ public function getPaymentMethodCategory() { - return $this->paymentMethodCategory; + return $this->container['paymentMethodCategory']; } /** - * @param mixed $paymentMethodCategory + * Sets paymentMethodCategory + * + * @param \request\model\PaymentMethodCategoryType|null $paymentMethodCategory paymentMethodCategory + * + * @return self */ public function setPaymentMethodCategory($paymentMethodCategory) { - $this->paymentMethodCategory = $paymentMethodCategory; + $this->container['paymentMethodCategory'] = $paymentMethodCategory; + + return $this; } /** - * @return mixed + * Gets paymentMethodRegion + * + * @return string[]|null + */ + public function getPaymentMethodRegion() + { + return $this->container['paymentMethodRegion']; + } + + /** + * Sets paymentMethodRegion + * + * @param string[]|null $paymentMethodRegion A list of region codes that represent the countries or regions of payment methods. The value of this parameter is a 2-letter ISO country code or GLOBAL. More information: Maximum length: 6 characters + * + * @return self + */ + public function setPaymentMethodRegion($paymentMethodRegion) + { + $this->container['paymentMethodRegion'] = $paymentMethodRegion; + + return $this; + } + + /** + * Gets enabled + * + * @return bool */ public function getEnabled() { - return $this->enabled; + return $this->container['enabled']; } /** - * @param mixed $enabled + * Sets enabled + * + * @param bool $enabled Indicates whether the payment method is available. + * + * @return self */ public function setEnabled($enabled) { - $this->enabled = $enabled; + $this->container['enabled'] = $enabled; + + return $this; } /** - * @return mixed + * Gets preferred + * + * @return bool|null */ public function getPreferred() { - return $this->preferred; + return $this->container['preferred']; } /** - * @param mixed $preferred + * Sets preferred + * + * @param bool|null $preferred preferred + * + * @return self */ public function setPreferred($preferred) { - $this->preferred = $preferred; + $this->container['preferred'] = $preferred; + + return $this; } /** - * @return mixed + * Gets disableReason + * + * @return string|null */ public function getDisableReason() { - return $this->disableReason; + return $this->container['disableReason']; } /** - * @param mixed $disableReason + * Sets disableReason + * + * @param string|null $disableReason The reason why the payment method is not available. Valid values are: PAYMENT_ACCOUNT_NOT_AVAILABLE EXCEED_CHANNEL_LIMIT_RULE SERVICE_DEGRADE CHANNEL_NOT_SUPPORT_CURRENCY CHANNEL_DISABLE CHANNEL_NOT_IN_SERVICE_TIME QUERY_IPP_INFO_FAILED LIMIT_CENTER_ACCESS_FAIL CURRENT_CHANNEL_NOT_EXIST + * + * @return self */ public function setDisableReason($disableReason) { - $this->disableReason = $disableReason; + $this->container['disableReason'] = $disableReason; + + return $this; } /** - * @return mixed + * Gets amountLimitInfoMap + * + * @return array|null */ public function getAmountLimitInfoMap() { - return $this->amountLimitInfoMap; + return $this->container['amountLimitInfoMap']; } /** - * @param mixed $amountLimitInfoMap + * Sets amountLimitInfoMap + * + * @param array|null $amountLimitInfoMap amountLimitInfoMap + * + * @return self */ public function setAmountLimitInfoMap($amountLimitInfoMap) { - $this->amountLimitInfoMap = $amountLimitInfoMap; + $this->container['amountLimitInfoMap'] = $amountLimitInfoMap; + + return $this; } /** - * @return mixed + * Gets supportedCurrencies + * + * @return string[]|null */ public function getSupportedCurrencies() { - return $this->supportedCurrencies; + return $this->container['supportedCurrencies']; } /** - * @param mixed $supportedCurrencies + * Sets supportedCurrencies + * + * @param string[]|null $supportedCurrencies supportedCurrencies + * + * @return self */ public function setSupportedCurrencies($supportedCurrencies) { - $this->supportedCurrencies = $supportedCurrencies; + $this->container['supportedCurrencies'] = $supportedCurrencies; + + return $this; } /** - * @return mixed + * Gets paymentOptionDetail + * + * @return \request\model\PaymentOptionDetail|null */ public function getPaymentOptionDetail() { - return $this->paymentOptionDetail; + return $this->container['paymentOptionDetail']; } /** - * @param mixed $paymentOptionDetail + * Sets paymentOptionDetail + * + * @param \request\model\PaymentOptionDetail|null $paymentOptionDetail paymentOptionDetail + * + * @return self */ public function setPaymentOptionDetail($paymentOptionDetail) { - $this->paymentOptionDetail = $paymentOptionDetail; + $this->container['paymentOptionDetail'] = $paymentOptionDetail; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets logo + * + * @return \request\model\Logo|null + */ + public function getLogo() + { + return $this->container['logo']; + } + + /** + * Sets logo + * + * @param \request\model\Logo|null $logo logo + * + * @return self + */ + public function setLogo($logo) + { + $this->container['logo'] = $logo; + + return $this; + } + + /** + * Gets promoNames + * + * @return string[]|null + */ + public function getPromoNames() + { + return $this->container['promoNames']; + } + + /** + * Sets promoNames + * + * @param string[]|null $promoNames The list of the promotion names. In JSON format. The keys are returned as a language and a country code, connected by an underscore, such as zh_CN, while the value is the promotion name, such as RM1 Voucher. More information: Maximum length: 512 characters + * + * @return self + */ + public function setPromoNames($promoNames) + { + $this->container['promoNames'] = $promoNames; + + return $this; + } + + /** + * Gets installment + * + * @return \request\model\Installment|null + */ + public function getInstallment() + { + return $this->container['installment']; + } + + /** + * Sets installment + * + * @param \request\model\Installment|null $installment installment + * + * @return self + */ + public function setInstallment($installment) + { + $this->container['installment'] = $installment; + + return $this; } -} \ No newline at end of file + /** + * Gets promotionInfos + * + * @return \request\model\PromotionInfo[]|null + */ + public function getPromotionInfos() + { + return $this->container['promotionInfos']; + } + + /** + * Sets promotionInfos + * + * @param \request\model\PromotionInfo[]|null $promotionInfos Promotion information. This parameter is returned when the payment method offers a promotion to the buyer. + * + * @return self + */ + public function setPromotionInfos($promotionInfos) + { + $this->container['promotionInfos'] = $promotionInfos; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentOptionDetail.php b/model/PaymentOptionDetail.php new file mode 100644 index 0000000..d571274 --- /dev/null +++ b/model/PaymentOptionDetail.php @@ -0,0 +1,478 @@ + + */ +class PaymentOptionDetail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentOptionDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'supportCardBrands' => '\request\model\SupportCardBrand[]', + 'funding' => 'string[]', + 'supportBanks' => '\request\model\SupportBank[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'supportCardBrands' => null, + 'funding' => null, + 'supportBanks' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'supportCardBrands' => false, + 'funding' => false, + 'supportBanks' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'supportCardBrands' => 'supportCardBrands', + 'funding' => 'funding', + 'supportBanks' => 'supportBanks' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'supportCardBrands' => 'setSupportCardBrands', + 'funding' => 'setFunding', + 'supportBanks' => 'setSupportBanks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'supportCardBrands' => 'getSupportCardBrands', + 'funding' => 'getFunding', + 'supportBanks' => 'getSupportBanks' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('supportCardBrands', $data ?? [], null); + $this->setIfExists('funding', $data ?? [], null); + $this->setIfExists('supportBanks', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['supportCardBrands'] === null) { + $invalidProperties[] = "'supportCardBrands' can't be null"; + } + if ($this->container['supportBanks'] === null) { + $invalidProperties[] = "'supportBanks' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets supportCardBrands + * + * @return \request\model\SupportCardBrand[] + */ + public function getSupportCardBrands() + { + return $this->container['supportCardBrands']; + } + + /** + * Sets supportCardBrands + * + * @param \request\model\SupportCardBrand[] $supportCardBrands The list of supported card brands. Note: This parameter is returned when the value of paymentMethodType is ​CARD​. + * + * @return self + */ + public function setSupportCardBrands($supportCardBrands) + { + $this->container['supportCardBrands'] = $supportCardBrands; + + return $this; + } + + /** + * Gets funding + * + * @return string[]|null + */ + public function getFunding() + { + return $this->container['funding']; + } + + /** + * Sets funding + * + * @param string[]|null $funding The funding type of the card. Valid values are: CREDIT: indicates a credit card. DEBIT: indicates a debit card. PREPAID: indicates a prepaid card CHARGE: indicates a charge card DEFERRED_DEBIT: indicates a deferred debit card This parameter is returned when all the following conditions are met: The value of paymentMethodType is CARD. The value of cardNo is valid. The information is available in the Antom card database. + * + * @return self + */ + public function setFunding($funding) + { + $this->container['funding'] = $funding; + + return $this; + } + + /** + * Gets supportBanks + * + * @return \request\model\SupportBank[] + */ + public function getSupportBanks() + { + return $this->container['supportBanks']; + } + + /** + * Sets supportBanks + * + * @param \request\model\SupportBank[] $supportBanks The list of supported banks. This parameter is returned when the value of paymentMethodType is ​P24​ or ONLINEBANKING_FPX. + * + * @return self + */ + public function setSupportBanks($supportBanks) + { + $this->container['supportBanks'] = $supportBanks; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentResultInfo.php b/model/PaymentResultInfo.php index 42c2e2e..701e5c6 100644 --- a/model/PaymentResultInfo.php +++ b/model/PaymentResultInfo.php @@ -1,303 +1,999 @@ + */ +class PaymentResultInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentResultInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'refusalCodeRaw' => 'string', + 'refusalReasonRaw' => 'string', + 'merchantAdviceCode' => 'string', + 'acquirerInfo' => '\request\model\AcquirerInfo', + 'cardNo' => 'string', + 'cardBrand' => 'string', + 'cardToken' => 'string', + 'issuingCountry' => 'string', + 'funding' => 'string', + 'paymentMethodRegion' => 'string', + 'threeDSResult' => '\request\model\ThreeDSResult', + 'avsResultRaw' => 'string', + 'cvvResultRaw' => 'string', + 'networkTransactionId' => 'string', + 'creditPayPlan' => '\request\model\CreditPayPlan', + 'cardholderName' => 'string', + 'cardBin' => 'string', + 'lastFour' => 'string', + 'expiryMonth' => 'string', + 'expiryYear' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'refusalCodeRaw' => null, + 'refusalReasonRaw' => null, + 'merchantAdviceCode' => null, + 'acquirerInfo' => null, + 'cardNo' => null, + 'cardBrand' => null, + 'cardToken' => null, + 'issuingCountry' => null, + 'funding' => null, + 'paymentMethodRegion' => null, + 'threeDSResult' => null, + 'avsResultRaw' => null, + 'cvvResultRaw' => null, + 'networkTransactionId' => null, + 'creditPayPlan' => null, + 'cardholderName' => null, + 'cardBin' => null, + 'lastFour' => null, + 'expiryMonth' => null, + 'expiryYear' => null + ]; - public $cardToken; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'refusalCodeRaw' => false, + 'refusalReasonRaw' => false, + 'merchantAdviceCode' => false, + 'acquirerInfo' => false, + 'cardNo' => false, + 'cardBrand' => false, + 'cardToken' => false, + 'issuingCountry' => false, + 'funding' => false, + 'paymentMethodRegion' => false, + 'threeDSResult' => false, + 'avsResultRaw' => false, + 'cvvResultRaw' => false, + 'networkTransactionId' => false, + 'creditPayPlan' => false, + 'cardholderName' => false, + 'cardBin' => false, + 'lastFour' => false, + 'expiryMonth' => false, + 'expiryYear' => false + ]; - public $issuingCountry; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - public $funding; + /** + * 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); + } - public $paymentMethodRegion; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'refusalCodeRaw' => 'refusalCodeRaw', + 'refusalReasonRaw' => 'refusalReasonRaw', + 'merchantAdviceCode' => 'merchantAdviceCode', + 'acquirerInfo' => 'acquirerInfo', + 'cardNo' => 'cardNo', + 'cardBrand' => 'cardBrand', + 'cardToken' => 'cardToken', + 'issuingCountry' => 'issuingCountry', + 'funding' => 'funding', + 'paymentMethodRegion' => 'paymentMethodRegion', + 'threeDSResult' => 'threeDSResult', + 'avsResultRaw' => 'avsResultRaw', + 'cvvResultRaw' => 'cvvResultRaw', + 'networkTransactionId' => 'networkTransactionId', + 'creditPayPlan' => 'creditPayPlan', + 'cardholderName' => 'cardholderName', + 'cardBin' => 'cardBin', + 'lastFour' => 'lastFour', + 'expiryMonth' => 'expiryMonth', + 'expiryYear' => 'expiryYear' + ]; - public $threeDSResult; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'refusalCodeRaw' => 'setRefusalCodeRaw', + 'refusalReasonRaw' => 'setRefusalReasonRaw', + 'merchantAdviceCode' => 'setMerchantAdviceCode', + 'acquirerInfo' => 'setAcquirerInfo', + 'cardNo' => 'setCardNo', + 'cardBrand' => 'setCardBrand', + 'cardToken' => 'setCardToken', + 'issuingCountry' => 'setIssuingCountry', + 'funding' => 'setFunding', + 'paymentMethodRegion' => 'setPaymentMethodRegion', + 'threeDSResult' => 'setThreeDSResult', + 'avsResultRaw' => 'setAvsResultRaw', + 'cvvResultRaw' => 'setCvvResultRaw', + 'networkTransactionId' => 'setNetworkTransactionId', + 'creditPayPlan' => 'setCreditPayPlan', + 'cardholderName' => 'setCardholderName', + 'cardBin' => 'setCardBin', + 'lastFour' => 'setLastFour', + 'expiryMonth' => 'setExpiryMonth', + 'expiryYear' => 'setExpiryYear' + ]; - public $avsResultRaw; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'refusalCodeRaw' => 'getRefusalCodeRaw', + 'refusalReasonRaw' => 'getRefusalReasonRaw', + 'merchantAdviceCode' => 'getMerchantAdviceCode', + 'acquirerInfo' => 'getAcquirerInfo', + 'cardNo' => 'getCardNo', + 'cardBrand' => 'getCardBrand', + 'cardToken' => 'getCardToken', + 'issuingCountry' => 'getIssuingCountry', + 'funding' => 'getFunding', + 'paymentMethodRegion' => 'getPaymentMethodRegion', + 'threeDSResult' => 'getThreeDSResult', + 'avsResultRaw' => 'getAvsResultRaw', + 'cvvResultRaw' => 'getCvvResultRaw', + 'networkTransactionId' => 'getNetworkTransactionId', + 'creditPayPlan' => 'getCreditPayPlan', + 'cardholderName' => 'getCardholderName', + 'cardBin' => 'getCardBin', + 'lastFour' => 'getLastFour', + 'expiryMonth' => 'getExpiryMonth', + 'expiryYear' => 'getExpiryYear' + ]; - public $cvvResultRaw; + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } - public $networkTransactionId; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $creditPayPlan; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $cardholderName; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - public $cardBin; - public $lastFour; + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; - public $expiryMonth; + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('refusalCodeRaw', $data ?? [], null); + $this->setIfExists('refusalReasonRaw', $data ?? [], null); + $this->setIfExists('merchantAdviceCode', $data ?? [], null); + $this->setIfExists('acquirerInfo', $data ?? [], null); + $this->setIfExists('cardNo', $data ?? [], null); + $this->setIfExists('cardBrand', $data ?? [], null); + $this->setIfExists('cardToken', $data ?? [], null); + $this->setIfExists('issuingCountry', $data ?? [], null); + $this->setIfExists('funding', $data ?? [], null); + $this->setIfExists('paymentMethodRegion', $data ?? [], null); + $this->setIfExists('threeDSResult', $data ?? [], null); + $this->setIfExists('avsResultRaw', $data ?? [], null); + $this->setIfExists('cvvResultRaw', $data ?? [], null); + $this->setIfExists('networkTransactionId', $data ?? [], null); + $this->setIfExists('creditPayPlan', $data ?? [], null); + $this->setIfExists('cardholderName', $data ?? [], null); + $this->setIfExists('cardBin', $data ?? [], null); + $this->setIfExists('lastFour', $data ?? [], null); + $this->setIfExists('expiryMonth', $data ?? [], null); + $this->setIfExists('expiryYear', $data ?? [], null); - public $expiryYear; + } + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } /** - * @return mixed + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public function getCardholderName() + public function listInvalidProperties() { - return $this->cardholderName; + $invalidProperties = []; + + return $invalidProperties; } /** - * @param mixed $cardholderName + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid */ - public function setCardholderName($cardholderName) + public function valid() { - $this->cardholderName = $cardholderName; + return count($this->listInvalidProperties()) === 0; } + /** - * @return mixed + * Gets refusalCodeRaw + * + * @return string|null */ - public function getCardBin() + public function getRefusalCodeRaw() { - return $this->cardBin; + return $this->container['refusalCodeRaw']; } /** - * @param mixed $cardBin + * Sets refusalCodeRaw + * + * @param string|null $refusalCodeRaw 卡支付失败且渠道返回时的原始错误码 + * + * @return self */ - public function setCardBin($cardBin) + public function setRefusalCodeRaw($refusalCodeRaw) { - $this->cardBin = $cardBin; + $this->container['refusalCodeRaw'] = $refusalCodeRaw; + + return $this; } /** - * @return mixed + * Gets refusalReasonRaw + * + * @return string|null */ - public function getLastFour() + public function getRefusalReasonRaw() { - return $this->lastFour; + return $this->container['refusalReasonRaw']; } /** - * @param mixed $lastFour + * Sets refusalReasonRaw + * + * @param string|null $refusalReasonRaw 卡支付失败且渠道返回时的原始拒付原因 + * + * @return self */ - public function setLastFour($lastFour) + public function setRefusalReasonRaw($refusalReasonRaw) { - $this->lastFour = $lastFour; + $this->container['refusalReasonRaw'] = $refusalReasonRaw; + + return $this; } /** - * @return mixed + * Gets merchantAdviceCode + * + * @return string|null */ - public function getExpiryMonth() + public function getMerchantAdviceCode() { - return $this->expiryMonth; + return $this->container['merchantAdviceCode']; } /** - * @param mixed $expiryMonth + * Sets merchantAdviceCode + * + * @param string|null $merchantAdviceCode 支付结果的商户建议码 + * + * @return self */ - public function setExpiryMonth($expiryMonth) + public function setMerchantAdviceCode($merchantAdviceCode) { - $this->expiryMonth = $expiryMonth; + $this->container['merchantAdviceCode'] = $merchantAdviceCode; + + return $this; } /** - * @return mixed + * Gets acquirerInfo + * + * @return \request\model\AcquirerInfo|null */ - public function getExpiryYear() + public function getAcquirerInfo() { - return $this->expiryYear; + return $this->container['acquirerInfo']; } /** - * @param mixed $expiryYear + * Sets acquirerInfo + * + * @param \request\model\AcquirerInfo|null $acquirerInfo acquirerInfo + * + * @return self */ - public function setExpiryYear($expiryYear) + public function setAcquirerInfo($acquirerInfo) { - $this->expiryYear = $expiryYear; - } - + $this->container['acquirerInfo'] = $acquirerInfo; + return $this; + } /** - * @return mixed + * Gets cardNo + * + * @return string|null */ public function getCardNo() { - return $this->cardNo; + return $this->container['cardNo']; } /** - * @param mixed $cardNo + * Sets cardNo + * + * @param string|null $cardNo The masked card number, which just shows part of the card number and can be used to display to the user + * + * @return self */ - public function setCardNo($cardNo) + public function setCardNo($cardNo) { - $this->cardNo = $cardNo; + $this->container['cardNo'] = $cardNo; + + return $this; } /** - * @return mixed + * Gets cardBrand + * + * @return string|null */ public function getCardBrand() { - return $this->cardBrand; + return $this->container['cardBrand']; } /** - * @param mixed $cardBrand + * Sets cardBrand + * + * @param string|null $cardBrand The card brand, which can be used to display to the user + * + * @return self */ - public function setCardBrand($cardBrand) + public function setCardBrand($cardBrand) { - $this->cardBrand = $cardBrand; + $this->container['cardBrand'] = $cardBrand; + + return $this; } /** - * @return mixed + * Gets cardToken + * + * @return string|null */ public function getCardToken() { - return $this->cardToken; + return $this->container['cardToken']; } /** - * @param mixed $cardToken + * Sets cardToken + * + * @param string|null $cardToken The token of the card, the value of this parameter is used by paymentMethodId in the pay + * + * @return self */ - public function setCardToken($cardToken) + public function setCardToken($cardToken) { - $this->cardToken = $cardToken; + $this->container['cardToken'] = $cardToken; + + return $this; } /** - * @return mixed + * Gets issuingCountry + * + * @return string|null */ public function getIssuingCountry() { - return $this->issuingCountry; + return $this->container['issuingCountry']; } /** - * @param mixed $issuingCountry + * Sets issuingCountry + * + * @param string|null $issuingCountry The issuing country of the card + * + * @return self */ - public function setIssuingCountry($issuingCountry) + public function setIssuingCountry($issuingCountry) { - $this->issuingCountry = $issuingCountry; + $this->container['issuingCountry'] = $issuingCountry; + + return $this; } /** - * @return mixed + * Gets funding + * + * @return string|null */ public function getFunding() { - return $this->funding; + return $this->container['funding']; } /** - * @param mixed $funding + * Sets funding + * + * @param string|null $funding The funding type of the card. + * + * @return self */ - public function setFunding($funding) + public function setFunding($funding) { - $this->funding = $funding; + $this->container['funding'] = $funding; + + return $this; } /** - * @return mixed + * Gets paymentMethodRegion + * + * @return string|null */ public function getPaymentMethodRegion() { - return $this->paymentMethodRegion; + return $this->container['paymentMethodRegion']; } /** - * @param mixed $paymentMethodRegion + * Sets paymentMethodRegion + * + * @param string|null $paymentMethodRegion The region code that represents the country or region of the payment method + * + * @return self */ - public function setPaymentMethodRegion($paymentMethodRegion) + public function setPaymentMethodRegion($paymentMethodRegion) { - $this->paymentMethodRegion = $paymentMethodRegion; + $this->container['paymentMethodRegion'] = $paymentMethodRegion; + + return $this; } /** - * @return mixed + * Gets threeDSResult + * + * @return \request\model\ThreeDSResult|null */ public function getThreeDSResult() { - return $this->threeDSResult; + return $this->container['threeDSResult']; } /** - * @param mixed $threeDSResult + * Sets threeDSResult + * + * @param \request\model\ThreeDSResult|null $threeDSResult threeDSResult + * + * @return self */ - public function setThreeDSResult($threeDSResult) + public function setThreeDSResult($threeDSResult) { - $this->threeDSResult = $threeDSResult; + $this->container['threeDSResult'] = $threeDSResult; + + return $this; } /** - * @return mixed + * Gets avsResultRaw + * + * @return string|null */ public function getAvsResultRaw() { - return $this->avsResultRaw; + return $this->container['avsResultRaw']; } /** - * @param mixed $avsResultRaw + * Sets avsResultRaw + * + * @param string|null $avsResultRaw The raw AVS result. See AVS result codes to check the valid values + * + * @return self */ - public function setAvsResultRaw($avsResultRaw) + public function setAvsResultRaw($avsResultRaw) { - $this->avsResultRaw = $avsResultRaw; + $this->container['avsResultRaw'] = $avsResultRaw; + + return $this; } /** - * @return mixed + * Gets cvvResultRaw + * + * @return string|null */ public function getCvvResultRaw() { - return $this->cvvResultRaw; + return $this->container['cvvResultRaw']; } /** - * @param mixed $cvvResultRaw + * Sets cvvResultRaw + * + * @param string|null $cvvResultRaw The raw Card Verification Value (CVV), Card Security Code (CSC), or Card Verification Code (CVC) result + * + * @return self */ - public function setCvvResultRaw($cvvResultRaw) + public function setCvvResultRaw($cvvResultRaw) { - $this->cvvResultRaw = $cvvResultRaw; + $this->container['cvvResultRaw'] = $cvvResultRaw; + + return $this; } /** - * @return mixed + * Gets networkTransactionId + * + * @return string|null */ public function getNetworkTransactionId() { - return $this->networkTransactionId; + return $this->container['networkTransactionId']; } /** - * @param mixed $networkTransactionId + * Sets networkTransactionId + * + * @param string|null $networkTransactionId The unique ID assigned by the card scheme to identify a transaction. The value of this parameter is used by the same parameter of pay (Cashier Payment) request in subsequent payments + * + * @return self */ - public function setNetworkTransactionId($networkTransactionId) + public function setNetworkTransactionId($networkTransactionId) { - $this->networkTransactionId = $networkTransactionId; + $this->container['networkTransactionId'] = $networkTransactionId; + + return $this; } /** - * @return mixed + * Gets creditPayPlan + * + * @return \request\model\CreditPayPlan|null */ public function getCreditPayPlan() { - return $this->creditPayPlan; + return $this->container['creditPayPlan']; + } + + /** + * Sets creditPayPlan + * + * @param \request\model\CreditPayPlan|null $creditPayPlan creditPayPlan + * + * @return self + */ + public function setCreditPayPlan($creditPayPlan) + { + $this->container['creditPayPlan'] = $creditPayPlan; + + return $this; + } + + /** + * Gets cardholderName + * + * @return string|null + */ + public function getCardholderName() + { + return $this->container['cardholderName']; } /** - * @param mixed $creditPayPlan + * Sets cardholderName + * + * @param string|null $cardholderName The cardholder's name. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 64 characters + * + * @return self */ - public function setCreditPayPlan($creditPayPlan) + public function setCardholderName($cardholderName) + { + $this->container['cardholderName'] = $cardholderName; + + return $this; + } + + /** + * Gets cardBin + * + * @return string|null + */ + public function getCardBin() + { + return $this->container['cardBin']; + } + + /** + * Sets cardBin + * + * @param string|null $cardBin The first six digits of the bank card number, used to identify the issuing bank and card type of the bank card. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 8 characters + * + * @return self + */ + public function setCardBin($cardBin) + { + $this->container['cardBin'] = $cardBin; + + return $this; + } + + /** + * Gets lastFour + * + * @return string|null + */ + public function getLastFour() + { + return $this->container['lastFour']; + } + + /** + * Sets lastFour + * + * @param string|null $lastFour Last 4 digits of the card number. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 4 characters + * + * @return self + */ + public function setLastFour($lastFour) + { + $this->container['lastFour'] = $lastFour; + + return $this; + } + + /** + * Gets expiryMonth + * + * @return string|null + */ + public function getExpiryMonth() + { + return $this->container['expiryMonth']; + } + + /** + * Sets expiryMonth + * + * @param string|null $expiryMonth The month the card expires. Pass in two digits representing the month. For example, if the expiry month is February, the value of this parameter is 02. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 2 characters + * + * @return self + */ + public function setExpiryMonth($expiryMonth) + { + $this->container['expiryMonth'] = $expiryMonth; + + return $this; + } + + /** + * Gets expiryYear + * + * @return string|null + */ + public function getExpiryYear() { - $this->creditPayPlan = $creditPayPlan; + return $this->container['expiryYear']; } + /** + * Sets expiryYear + * + * @param string|null $expiryYear The year the card expires. Pass in the last two digits of the year number. For example, if the expiry year is 2025, the value of this parameter is 25. Note: This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD for specific merchants in specific regions. More information: Maximum length: 2 characters + * + * @return self + */ + public function setExpiryYear($expiryYear) + { + $this->container['expiryYear'] = $expiryYear; + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } -} \ No newline at end of file + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PaymentVerificationData.php b/model/PaymentVerificationData.php index 3ea009e..b6b8921 100644 --- a/model/PaymentVerificationData.php +++ b/model/PaymentVerificationData.php @@ -1,42 +1,441 @@ + */ +class PaymentVerificationData implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentVerificationData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'verifyRequestId' => 'string', + 'authenticationCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'verifyRequestId' => null, + 'authenticationCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'verifyRequestId' => false, + 'authenticationCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'verifyRequestId' => 'verifyRequestId', + 'authenticationCode' => 'authenticationCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'verifyRequestId' => 'setVerifyRequestId', + 'authenticationCode' => 'setAuthenticationCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'verifyRequestId' => 'getVerifyRequestId', + 'authenticationCode' => 'getAuthenticationCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('verifyRequestId', $data ?? [], null); + $this->setIfExists('authenticationCode', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } - public $verifyRequestId; - public $authenticationCode; /** - * @return mixed + * Gets verifyRequestId + * + * @return string|null */ public function getVerifyRequestId() { - return $this->verifyRequestId; + return $this->container['verifyRequestId']; } /** - * @param mixed $verifyRequestId + * Sets verifyRequestId + * + * @param string|null $verifyRequestId verifyRequestId + * + * @return self */ public function setVerifyRequestId($verifyRequestId) { - $this->verifyRequestId = $verifyRequestId; + $this->container['verifyRequestId'] = $verifyRequestId; + + return $this; } /** - * @return mixed + * Gets authenticationCode + * + * @return string|null */ public function getAuthenticationCode() { - return $this->authenticationCode; + return $this->container['authenticationCode']; } /** - * @param mixed $authenticationCode + * Sets authenticationCode + * + * @param string|null $authenticationCode authenticationCode + * + * @return self */ public function setAuthenticationCode($authenticationCode) { - $this->authenticationCode = $authenticationCode; + $this->container['authenticationCode'] = $authenticationCode; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PeriodRule.php b/model/PeriodRule.php index e2e2749..96c6cc6 100644 --- a/model/PeriodRule.php +++ b/model/PeriodRule.php @@ -1,44 +1,447 @@ + */ +class PeriodRule implements ModelInterface, ArrayAccess, \JsonSerializable { - public $periodType; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PeriodRule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'periodType' => 'string', + 'periodCount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'periodType' => null, + 'periodCount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'periodType' => false, + 'periodCount' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'periodType' => 'periodType', + 'periodCount' => 'periodCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'periodType' => 'setPeriodType', + 'periodCount' => 'setPeriodCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'periodType' => 'getPeriodType', + 'periodCount' => 'getPeriodCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $periodCount; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('periodType', $data ?? [], null); + $this->setIfExists('periodCount', $data ?? [], null); + + } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['periodType'] === null) { + $invalidProperties[] = "'periodType' can't be null"; + } + if ($this->container['periodCount'] === null) { + $invalidProperties[] = "'periodCount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets periodType + * + * @return string */ public function getPeriodType() { - return $this->periodType; + return $this->container['periodType']; } /** - * @param mixed $periodType + * Sets periodType + * + * @param string $periodType The subscription period type. Valid values are: YEAR: indicates that the subscription period is measured in years. MONTH: indicates that the subscription period is measured in months. WEEK: indicates that the subscription period is measured in weeks. DAY: indicates that the subscription period is measured in days. More information: Maximum length: 20 characters + * + * @return self */ public function setPeriodType($periodType) { - $this->periodType = $periodType; + $this->container['periodType'] = $periodType; + + return $this; } /** - * @return mixed + * Gets periodCount + * + * @return int */ public function getPeriodCount() { - return $this->periodCount; + return $this->container['periodCount']; } /** - * @param mixed $periodCount + * Sets periodCount + * + * @param int $periodCount The number of period types within one subscription period. For example, if the value of periodType is MONTH and the value of periodCount is 2, it means that the subscription period is two months. More information: Value range: [1, +∞) + * + * @return self */ public function setPeriodCount($periodCount) { - $this->periodCount = $periodCount; + $this->container['periodCount'] = $periodCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Plan.php b/model/Plan.php new file mode 100644 index 0000000..3cbdeed --- /dev/null +++ b/model/Plan.php @@ -0,0 +1,580 @@ + + */ +class Plan implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Plan'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'interestRate' => 'string', + 'minInstallmentAmount' => '\request\model\Amount', + 'maxInstallmentAmount' => '\request\model\Amount', + 'installmentNum' => 'string', + 'interval' => 'string', + 'enabled' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'interestRate' => null, + 'minInstallmentAmount' => null, + 'maxInstallmentAmount' => null, + 'installmentNum' => null, + 'interval' => null, + 'enabled' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'interestRate' => false, + 'minInstallmentAmount' => false, + 'maxInstallmentAmount' => false, + 'installmentNum' => false, + 'interval' => false, + 'enabled' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'interestRate' => 'interestRate', + 'minInstallmentAmount' => 'minInstallmentAmount', + 'maxInstallmentAmount' => 'maxInstallmentAmount', + 'installmentNum' => 'installmentNum', + 'interval' => 'interval', + 'enabled' => 'enabled' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'interestRate' => 'setInterestRate', + 'minInstallmentAmount' => 'setMinInstallmentAmount', + 'maxInstallmentAmount' => 'setMaxInstallmentAmount', + 'installmentNum' => 'setInstallmentNum', + 'interval' => 'setInterval', + 'enabled' => 'setEnabled' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'interestRate' => 'getInterestRate', + 'minInstallmentAmount' => 'getMinInstallmentAmount', + 'maxInstallmentAmount' => 'getMaxInstallmentAmount', + 'installmentNum' => 'getInstallmentNum', + 'interval' => 'getInterval', + 'enabled' => 'getEnabled' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('interestRate', $data ?? [], null); + $this->setIfExists('minInstallmentAmount', $data ?? [], null); + $this->setIfExists('maxInstallmentAmount', $data ?? [], null); + $this->setIfExists('installmentNum', $data ?? [], null); + $this->setIfExists('interval', $data ?? [], null); + $this->setIfExists('enabled', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['minInstallmentAmount'] === null) { + $invalidProperties[] = "'minInstallmentAmount' can't be null"; + } + if ($this->container['maxInstallmentAmount'] === null) { + $invalidProperties[] = "'maxInstallmentAmount' can't be null"; + } + if ($this->container['installmentNum'] === null) { + $invalidProperties[] = "'installmentNum' can't be null"; + } + if ($this->container['interval'] === null) { + $invalidProperties[] = "'interval' can't be null"; + } + if ($this->container['enabled'] === null) { + $invalidProperties[] = "'enabled' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets interestRate + * + * @return string|null + */ + public function getInterestRate() + { + return $this->container['interestRate']; + } + + /** + * Sets interestRate + * + * @param string|null $interestRate The interest rate the customer is charged on the installments. More information: Maximum length: 8 characters + * + * @return self + */ + public function setInterestRate($interestRate) + { + $this->container['interestRate'] = $interestRate; + + return $this; + } + + /** + * Gets minInstallmentAmount + * + * @return \request\model\Amount + */ + public function getMinInstallmentAmount() + { + return $this->container['minInstallmentAmount']; + } + + /** + * Sets minInstallmentAmount + * + * @param \request\model\Amount $minInstallmentAmount minInstallmentAmount + * + * @return self + */ + public function setMinInstallmentAmount($minInstallmentAmount) + { + $this->container['minInstallmentAmount'] = $minInstallmentAmount; + + return $this; + } + + /** + * Gets maxInstallmentAmount + * + * @return \request\model\Amount + */ + public function getMaxInstallmentAmount() + { + return $this->container['maxInstallmentAmount']; + } + + /** + * Sets maxInstallmentAmount + * + * @param \request\model\Amount $maxInstallmentAmount maxInstallmentAmount + * + * @return self + */ + public function setMaxInstallmentAmount($maxInstallmentAmount) + { + $this->container['maxInstallmentAmount'] = $maxInstallmentAmount; + + return $this; + } + + /** + * Gets installmentNum + * + * @return string + */ + public function getInstallmentNum() + { + return $this->container['installmentNum']; + } + + /** + * Sets installmentNum + * + * @param string $installmentNum The number of installment payments. The valid value is from 2 to 12. More information: Maximum length: 8 characters + * + * @return self + */ + public function setInstallmentNum($installmentNum) + { + $this->container['installmentNum'] = $installmentNum; + + return $this; + } + + /** + * Gets interval + * + * @return string + */ + public function getInterval() + { + return $this->container['interval']; + } + + /** + * Sets interval + * + * @param string $interval The interval of each installment payment. The valid value is MONTH. More information: Maximum length: 16 characters + * + * @return self + */ + public function setInterval($interval) + { + $this->container['interval'] = $interval; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled Indicates whether the installment payment is available. + * + * @return self + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PresentmentMode.php b/model/PresentmentMode.php index 3846824..d7d1606 100644 --- a/model/PresentmentMode.php +++ b/model/PresentmentMode.php @@ -1,12 +1,32 @@ + */ +class PromotionInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'promotionType' => '\request\model\PromotionType', + 'discount' => '\request\model\Discount', + 'interestFree' => '\request\model\InterestFree' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'promotionType' => null, + 'discount' => null, + 'interestFree' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'promotionType' => false, + 'discount' => false, + 'interestFree' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'promotionType' => 'promotionType', + 'discount' => 'discount', + 'interestFree' => 'interestFree' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'promotionType' => 'setPromotionType', + 'discount' => 'setDiscount', + 'interestFree' => 'setInterestFree' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'promotionType' => 'getPromotionType', + 'discount' => 'getDiscount', + 'interestFree' => 'getInterestFree' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('promotionType', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('interestFree', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['promotionType'] === null) { + $invalidProperties[] = "'promotionType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets promotionType + * + * @return \request\model\PromotionType + */ + public function getPromotionType() + { + return $this->container['promotionType']; + } + + /** + * Sets promotionType + * + * @param \request\model\PromotionType $promotionType promotionType + * + * @return self + */ + public function setPromotionType($promotionType) + { + $this->container['promotionType'] = $promotionType; + + return $this; + } + + /** + * Gets discount + * + * @return \request\model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \request\model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets interestFree + * + * @return \request\model\InterestFree|null + */ + public function getInterestFree() + { + return $this->container['interestFree']; + } + + /** + * Sets interestFree + * + * @param \request\model\InterestFree|null $interestFree interestFree + * + * @return self + */ + public function setInterestFree($interestFree) + { + $this->container['interestFree'] = $interestFree; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PromotionResult.php b/model/PromotionResult.php new file mode 100644 index 0000000..27628a1 --- /dev/null +++ b/model/PromotionResult.php @@ -0,0 +1,444 @@ + + */ +class PromotionResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'promotionType' => '\request\model\PromotionType', + 'discount' => '\request\model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'promotionType' => null, + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'promotionType' => false, + 'discount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'promotionType' => 'promotionType', + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'promotionType' => 'setPromotionType', + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'promotionType' => 'getPromotionType', + 'discount' => 'getDiscount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('promotionType', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['promotionType'] === null) { + $invalidProperties[] = "'promotionType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets promotionType + * + * @return \request\model\PromotionType + */ + public function getPromotionType() + { + return $this->container['promotionType']; + } + + /** + * Sets promotionType + * + * @param \request\model\PromotionType $promotionType promotionType + * + * @return self + */ + public function setPromotionType($promotionType) + { + $this->container['promotionType'] = $promotionType; + + return $this; + } + + /** + * Gets discount + * + * @return \request\model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \request\model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + $this->container['discount'] = $discount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/PromotionType.php b/model/PromotionType.php new file mode 100644 index 0000000..26fc0a6 --- /dev/null +++ b/model/PromotionType.php @@ -0,0 +1,31 @@ + + */ +class PspCustomerInfo implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PspCustomerInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'pspName' => 'string', + 'pspCustomerId' => 'string', + 'displayCustomerId' => 'string', + 'displayCustomerName' => 'string', + 'customer2088Id' => 'string', + 'extendInfo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'pspName' => null, + 'pspCustomerId' => null, + 'displayCustomerId' => null, + 'displayCustomerName' => null, + 'customer2088Id' => null, + 'extendInfo' => null + ]; - public $pspName; - public $pspCustomerId; - public $displayCustomerId; - public $displayCustomerName; - public $customer2088Id; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'pspName' => false, + 'pspCustomerId' => false, + 'displayCustomerId' => false, + 'displayCustomerName' => false, + 'customer2088Id' => false, + 'extendInfo' => false + ]; - public $extendInfo; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; /** - * @return mixed + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'pspName' => 'pspName', + 'pspCustomerId' => 'pspCustomerId', + 'displayCustomerId' => 'displayCustomerId', + 'displayCustomerName' => 'displayCustomerName', + 'customer2088Id' => 'customer2088Id', + 'extendInfo' => 'extendInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'pspName' => 'setPspName', + 'pspCustomerId' => 'setPspCustomerId', + 'displayCustomerId' => 'setDisplayCustomerId', + 'displayCustomerName' => 'setDisplayCustomerName', + 'customer2088Id' => 'setCustomer2088Id', + 'extendInfo' => 'setExtendInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'pspName' => 'getPspName', + 'pspCustomerId' => 'getPspCustomerId', + 'displayCustomerId' => 'getDisplayCustomerId', + 'displayCustomerName' => 'getDisplayCustomerName', + 'customer2088Id' => 'getCustomer2088Id', + 'extendInfo' => 'getExtendInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('pspName', $data ?? [], null); + $this->setIfExists('pspCustomerId', $data ?? [], null); + $this->setIfExists('displayCustomerId', $data ?? [], null); + $this->setIfExists('displayCustomerName', $data ?? [], null); + $this->setIfExists('customer2088Id', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets pspName + * + * @return string|null */ public function getPspName() { - return $this->pspName; + return $this->container['pspName']; } /** - * @param mixed $pspName + * Sets pspName + * + * @param string|null $pspName The name of Alipay+ payment methods. Note: This field is returned when the Alipay+ payment methods can provide the related information. More information: Maximum length: 64 characters + * + * @return self */ public function setPspName($pspName) { - $this->pspName = $pspName; + $this->container['pspName'] = $pspName; + + return $this; } /** - * @return mixed + * Gets pspCustomerId + * + * @return string|null */ public function getPspCustomerId() { - return $this->pspCustomerId; + return $this->container['pspCustomerId']; } /** - * @param mixed $pspCustomerId + * Sets pspCustomerId + * + * @param string|null $pspCustomerId The customer ID of Alipay+ payment methods. Note: This field is returned when the Alipay+ payment methods can provide the related information. More information: Maximum length: 64 characters + * + * @return self */ public function setPspCustomerId($pspCustomerId) { - $this->pspCustomerId = $pspCustomerId; + $this->container['pspCustomerId'] = $pspCustomerId; + + return $this; } /** - * @return mixed + * Gets displayCustomerId + * + * @return string|null */ public function getDisplayCustomerId() { - return $this->displayCustomerId; + return $this->container['displayCustomerId']; } /** - * @param mixed $displayCustomerId + * Sets displayCustomerId + * + * @param string|null $displayCustomerId The customer ID used for display. For example, loginId. Note: This field is returned when the Alipay+ payment methods can provide the related information. More information: Maximum length: 64 characters + * + * @return self */ public function setDisplayCustomerId($displayCustomerId) { - $this->displayCustomerId = $displayCustomerId; + $this->container['displayCustomerId'] = $displayCustomerId; + + return $this; } /** - * @return mixed + * Gets displayCustomerName + * + * @return string|null */ public function getDisplayCustomerName() { - return $this->displayCustomerName; + return $this->container['displayCustomerName']; } /** - * @param mixed $displayCustomerName + * Sets displayCustomerName + * + * @param string|null $displayCustomerName displayCustomerName + * + * @return self */ public function setDisplayCustomerName($displayCustomerName) { - $this->displayCustomerName = $displayCustomerName; + $this->container['displayCustomerName'] = $displayCustomerName; + + return $this; } /** - * @return mixed + * Gets customer2088Id + * + * @return string|null */ public function getCustomer2088Id() { - return $this->customer2088Id; + return $this->container['customer2088Id']; } /** - * @param mixed $customer2088Id + * Sets customer2088Id + * + * @param string|null $customer2088Id customer2088Id + * + * @return self */ public function setCustomer2088Id($customer2088Id) { - $this->customer2088Id = $customer2088Id; + $this->container['customer2088Id'] = $customer2088Id; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Quote.php b/model/Quote.php index bb4cee3..6b9d5fb 100644 --- a/model/Quote.php +++ b/model/Quote.php @@ -1,110 +1,571 @@ + */ +class Quote implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Quote'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quoteId' => 'string', + 'quoteCurrencyPair' => 'string', + 'quotePrice' => 'float', + 'quoteStartTime' => 'string', + 'quoteExpiryTime' => 'string', + 'guaranteed' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quoteId' => null, + 'quoteCurrencyPair' => null, + 'quotePrice' => null, + 'quoteStartTime' => null, + 'quoteExpiryTime' => null, + 'guaranteed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'quoteId' => false, + 'quoteCurrencyPair' => false, + 'quotePrice' => false, + 'quoteStartTime' => false, + 'quoteExpiryTime' => false, + 'guaranteed' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'quoteId' => 'quoteId', + 'quoteCurrencyPair' => 'quoteCurrencyPair', + 'quotePrice' => 'quotePrice', + 'quoteStartTime' => 'quoteStartTime', + 'quoteExpiryTime' => 'quoteExpiryTime', + 'guaranteed' => 'guaranteed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quoteId' => 'setQuoteId', + 'quoteCurrencyPair' => 'setQuoteCurrencyPair', + 'quotePrice' => 'setQuotePrice', + 'quoteStartTime' => 'setQuoteStartTime', + 'quoteExpiryTime' => 'setQuoteExpiryTime', + 'guaranteed' => 'setGuaranteed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quoteId' => 'getQuoteId', + 'quoteCurrencyPair' => 'getQuoteCurrencyPair', + 'quotePrice' => 'getQuotePrice', + 'quoteStartTime' => 'getQuoteStartTime', + 'quoteExpiryTime' => 'getQuoteExpiryTime', + 'guaranteed' => 'getGuaranteed' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + - public $quoteId; - public $quoteCurrencyPair; - public $quotePrice; - public $quoteStartTime; - public $quoteExpiryTime; - public $guaranteed; + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; /** - * @return mixed + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('quoteId', $data ?? [], null); + $this->setIfExists('quoteCurrencyPair', $data ?? [], null); + $this->setIfExists('quotePrice', $data ?? [], null); + $this->setIfExists('quoteStartTime', $data ?? [], null); + $this->setIfExists('quoteExpiryTime', $data ?? [], null); + $this->setIfExists('guaranteed', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['quoteCurrencyPair'] === null) { + $invalidProperties[] = "'quoteCurrencyPair' can't be null"; + } + if ($this->container['quotePrice'] === null) { + $invalidProperties[] = "'quotePrice' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets quoteId + * + * @return string|null */ public function getQuoteId() { - return $this->quoteId; + return $this->container['quoteId']; } /** - * @param mixed $quoteId + * Sets quoteId + * + * @param string|null $quoteId The unique ID that is assigned by Alipay to identify an exchange rate. More information: Maximum length: 64 characters + * + * @return self */ public function setQuoteId($quoteId) { - $this->quoteId = $quoteId; + $this->container['quoteId'] = $quoteId; + + return $this; } /** - * @return mixed + * Gets quoteCurrencyPair + * + * @return string */ public function getQuoteCurrencyPair() { - return $this->quoteCurrencyPair; + return $this->container['quoteCurrencyPair']; } /** - * @param mixed $quoteCurrencyPair + * Sets quoteCurrencyPair + * + * @param string $quoteCurrencyPair The exchange rate between settlement currency and transaction currency. Two currencies are separated with a slash and use the 3-letter ISO-4217 currency code. More information: Maximum length: 16 characters + * + * @return self */ public function setQuoteCurrencyPair($quoteCurrencyPair) { - $this->quoteCurrencyPair = $quoteCurrencyPair; + $this->container['quoteCurrencyPair'] = $quoteCurrencyPair; + + return $this; } /** - * @return mixed + * Gets quotePrice + * + * @return float */ public function getQuotePrice() { - return $this->quotePrice; + return $this->container['quotePrice']; } /** - * @param mixed $quotePrice + * Sets quotePrice + * + * @param float $quotePrice The exchange rate used when a currency conversion between settlement currency and transaction currency occurs. More information: Value range: 1 - unlimited + * + * @return self */ public function setQuotePrice($quotePrice) { - $this->quotePrice = $quotePrice; + $this->container['quotePrice'] = $quotePrice; + + return $this; } /** - * @return mixed + * Gets quoteStartTime + * + * @return string|null */ public function getQuoteStartTime() { - return $this->quoteStartTime; + return $this->container['quoteStartTime']; } /** - * @param mixed $quoteStartTime + * Sets quoteStartTime + * + * @param string|null $quoteStartTime Effective time of the exchange rate. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setQuoteStartTime($quoteStartTime) { - $this->quoteStartTime = $quoteStartTime; + $this->container['quoteStartTime'] = $quoteStartTime; + + return $this; } /** - * @return mixed + * Gets quoteExpiryTime + * + * @return string|null */ public function getQuoteExpiryTime() { - return $this->quoteExpiryTime; + return $this->container['quoteExpiryTime']; } /** - * @param mixed $quoteExpiryTime + * Sets quoteExpiryTime + * + * @param string|null $quoteExpiryTime Expiration time of the exchange rate. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setQuoteExpiryTime($quoteExpiryTime) { - $this->quoteExpiryTime = $quoteExpiryTime; + $this->container['quoteExpiryTime'] = $quoteExpiryTime; + + return $this; } /** - * @return mixed + * Gets guaranteed + * + * @return bool|null */ public function getGuaranteed() { - return $this->guaranteed; + return $this->container['guaranteed']; } /** - * @param mixed $guaranteed + * Sets guaranteed + * + * @param bool|null $guaranteed Guaranteed exchange rate available for payment. + * + * @return self */ public function setGuaranteed($guaranteed) { - $this->guaranteed = $guaranteed; + $this->container['guaranteed'] = $guaranteed; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RedirectActionForm.php b/model/RedirectActionForm.php index b76bf2d..b94a14d 100644 --- a/model/RedirectActionForm.php +++ b/model/RedirectActionForm.php @@ -1,60 +1,509 @@ + */ +class RedirectActionForm implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedirectActionForm'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'method' => 'string', + 'parameters' => 'string', + 'redirectUrl' => 'string', + 'actionFormType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'method' => null, + 'parameters' => null, + 'redirectUrl' => null, + 'actionFormType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'method' => false, + 'parameters' => false, + 'redirectUrl' => false, + 'actionFormType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - public $method; - public $parameters; - public $redirectUrl; + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'method' => 'method', + 'parameters' => 'parameters', + 'redirectUrl' => 'redirectUrl', + 'actionFormType' => 'actionFormType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'method' => 'setMethod', + 'parameters' => 'setParameters', + 'redirectUrl' => 'setRedirectUrl', + 'actionFormType' => 'setActionFormType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'method' => 'getMethod', + 'parameters' => 'getParameters', + 'redirectUrl' => 'getRedirectUrl', + 'actionFormType' => 'getActionFormType' + ]; /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('method', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('redirectUrl', $data ?? [], null); + $this->setIfExists('actionFormType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['redirectUrl'] === null) { + $invalidProperties[] = "'redirectUrl' can't be null"; + } + if ($this->container['actionFormType'] === null) { + $invalidProperties[] = "'actionFormType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets method + * + * @return string|null */ public function getMethod() { - return $this->method; + return $this->container['method']; } /** - * @param mixed $method + * Sets method + * + * @param string|null $method The HTTP method to be used when the merchant initiates a redirection to the redirection URL. Valid values are: POST: Indicates that the request that is sent to the redirection address needs to be a POST request. GET: Indicates that the request that is sent to the redirection address needs to be a GET request. + * + * @return self */ public function setMethod($method) { - $this->method = $method; + $this->container['method'] = $method; + + return $this; } /** - * @return mixed + * Gets parameters + * + * @return string|null */ public function getParameters() { - return $this->parameters; + return $this->container['parameters']; } /** - * @param mixed $parameters + * Sets parameters + * + * @param string|null $parameters Parameters required for the HTTP method in the key-value pair. Note: This field is returned only when the method is POST. More information: Maximum length: 2048 characters + * + * @return self */ public function setParameters($parameters) { - $this->parameters = $parameters; + $this->container['parameters'] = $parameters; + + return $this; } /** - * @return mixed + * Gets redirectUrl + * + * @return string */ public function getRedirectUrl() { - return $this->redirectUrl; + return $this->container['redirectUrl']; } /** - * @param mixed $redirectUrl + * Sets redirectUrl + * + * @param string $redirectUrl The URL where the user is redirected to. More information: Maximum length: 2048 characters + * + * @return self */ public function setRedirectUrl($redirectUrl) { - $this->redirectUrl = $redirectUrl; + $this->container['redirectUrl'] = $redirectUrl; + + return $this; } -} \ No newline at end of file + /** + * Gets actionFormType + * + * @return string + */ + public function getActionFormType() + { + return $this->container['actionFormType']; + } + + /** + * Sets actionFormType + * + * @param string $actionFormType The value is fixed as RedirectActionForm. More information: Maximum length: 32 characters + * + * @return self + */ + public function setActionFormType($actionFormType) + { + $this->container['actionFormType'] = $actionFormType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RefundDetail.php b/model/RefundDetail.php new file mode 100644 index 0000000..326cdd9 --- /dev/null +++ b/model/RefundDetail.php @@ -0,0 +1,447 @@ + + */ +class RefundDetail implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RefundDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'refundAmount' => '\request\model\Amount', + 'refundFrom' => '\request\model\RefundFromType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'refundAmount' => null, + 'refundFrom' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'refundAmount' => false, + 'refundFrom' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'refundAmount' => 'refundAmount', + 'refundFrom' => 'refundFrom' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'refundAmount' => 'setRefundAmount', + 'refundFrom' => 'setRefundFrom' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'refundAmount' => 'getRefundAmount', + 'refundFrom' => 'getRefundFrom' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('refundAmount', $data ?? [], null); + $this->setIfExists('refundFrom', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['refundAmount'] === null) { + $invalidProperties[] = "'refundAmount' can't be null"; + } + if ($this->container['refundFrom'] === null) { + $invalidProperties[] = "'refundFrom' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets refundAmount + * + * @return \request\model\Amount + */ + public function getRefundAmount() + { + return $this->container['refundAmount']; + } + + /** + * Sets refundAmount + * + * @param \request\model\Amount $refundAmount refundAmount + * + * @return self + */ + public function setRefundAmount($refundAmount) + { + $this->container['refundAmount'] = $refundAmount; + + return $this; + } + + /** + * Gets refundFrom + * + * @return \request\model\RefundFromType + */ + public function getRefundFrom() + { + return $this->container['refundFrom']; + } + + /** + * Sets refundFrom + * + * @param \request\model\RefundFromType $refundFrom refundFrom + * + * @return self + */ + public function setRefundFrom($refundFrom) + { + $this->container['refundFrom'] = $refundFrom; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RefundFromType.php b/model/RefundFromType.php new file mode 100644 index 0000000..2c77170 --- /dev/null +++ b/model/RefundFromType.php @@ -0,0 +1,32 @@ + + */ +class Result implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Result'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'resultCode' => 'string', + 'resultStatus' => '\request\model\ResultStatusType', + 'resultMessage' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'resultCode' => null, + 'resultStatus' => null, + 'resultMessage' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'resultCode' => false, + 'resultStatus' => false, + 'resultMessage' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'resultCode' => 'resultCode', + 'resultStatus' => 'resultStatus', + 'resultMessage' => 'resultMessage' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'resultCode' => 'setResultCode', + 'resultStatus' => 'setResultStatus', + 'resultMessage' => 'setResultMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'resultCode' => 'getResultCode', + 'resultStatus' => 'getResultStatus', + 'resultMessage' => 'getResultMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('resultCode', $data ?? [], null); + $this->setIfExists('resultStatus', $data ?? [], null); + $this->setIfExists('resultMessage', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['resultCode'] === null) { + $invalidProperties[] = "'resultCode' can't be null"; + } + if ($this->container['resultStatus'] === null) { + $invalidProperties[] = "'resultStatus' can't be null"; + } + if ($this->container['resultMessage'] === null) { + $invalidProperties[] = "'resultMessage' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } - public $resultCode; - public $resultStatus; - public $resultMessage; /** - * @return mixed + * Gets resultCode + * + * @return string */ public function getResultCode() { - return $this->resultCode; + return $this->container['resultCode']; } /** - * @param mixed $resultCode + * Sets resultCode + * + * @param string $resultCode The result code. + * + * @return self */ public function setResultCode($resultCode) { - $this->resultCode = $resultCode; + $this->container['resultCode'] = $resultCode; + + return $this; } /** - * @return mixed + * Gets resultStatus + * + * @return \request\model\ResultStatusType */ public function getResultStatus() { - return $this->resultStatus; + return $this->container['resultStatus']; } /** - * @param mixed $resultStatus + * Sets resultStatus + * + * @param \request\model\ResultStatusType $resultStatus resultStatus + * + * @return self */ public function setResultStatus($resultStatus) { - $this->resultStatus = $resultStatus; + $this->container['resultStatus'] = $resultStatus; + + return $this; } /** - * @return mixed + * Gets resultMessage + * + * @return string */ public function getResultMessage() { - return $this->resultMessage; + return $this->container['resultMessage']; } /** - * @param mixed $resultMessage + * Sets resultMessage + * + * @param string $resultMessage The result message. + * + * @return self */ public function setResultMessage($resultMessage) { - $this->resultMessage = $resultMessage; + $this->container['resultMessage'] = $resultMessage; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/ResultStatusType.php b/model/ResultStatusType.php index 1d24ddf..8bc1c9a 100644 --- a/model/ResultStatusType.php +++ b/model/ResultStatusType.php @@ -1,10 +1,32 @@ + */ +class RiskAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RiskAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'shippingPhoneType' => 'string', + 'isBillShipStateSame' => 'bool', + 'isPreviousStateSame' => 'bool', + 'locToShipDistance' => 'int', + 'minPreviousShipToBillDistance' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'shippingPhoneType' => null, + 'isBillShipStateSame' => null, + 'isPreviousStateSame' => null, + 'locToShipDistance' => null, + 'minPreviousShipToBillDistance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'shippingPhoneType' => false, + 'isBillShipStateSame' => false, + 'isPreviousStateSame' => false, + 'locToShipDistance' => true, + 'minPreviousShipToBillDistance' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'shippingPhoneType' => 'shippingPhoneType', + 'isBillShipStateSame' => 'isBillShipStateSame', + 'isPreviousStateSame' => 'isPreviousStateSame', + 'locToShipDistance' => 'locToShipDistance', + 'minPreviousShipToBillDistance' => 'minPreviousShipToBillDistance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'shippingPhoneType' => 'setShippingPhoneType', + 'isBillShipStateSame' => 'setIsBillShipStateSame', + 'isPreviousStateSame' => 'setIsPreviousStateSame', + 'locToShipDistance' => 'setLocToShipDistance', + 'minPreviousShipToBillDistance' => 'setMinPreviousShipToBillDistance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'shippingPhoneType' => 'getShippingPhoneType', + 'isBillShipStateSame' => 'getIsBillShipStateSame', + 'isPreviousStateSame' => 'getIsPreviousStateSame', + 'locToShipDistance' => 'getLocToShipDistance', + 'minPreviousShipToBillDistance' => 'getMinPreviousShipToBillDistance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('shippingPhoneType', $data ?? [], null); + $this->setIfExists('isBillShipStateSame', $data ?? [], null); + $this->setIfExists('isPreviousStateSame', $data ?? [], null); + $this->setIfExists('locToShipDistance', $data ?? [], null); + $this->setIfExists('minPreviousShipToBillDistance', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['shippingPhoneType'] === null) { + $invalidProperties[] = "'shippingPhoneType' can't be null"; + } + if ($this->container['isBillShipStateSame'] === null) { + $invalidProperties[] = "'isBillShipStateSame' can't be null"; + } + if ($this->container['isPreviousStateSame'] === null) { + $invalidProperties[] = "'isPreviousStateSame' can't be null"; + } + if ($this->container['locToShipDistance'] === null) { + $invalidProperties[] = "'locToShipDistance' can't be null"; + } + if ($this->container['minPreviousShipToBillDistance'] === null) { + $invalidProperties[] = "'minPreviousShipToBillDistance' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets shippingPhoneType + * + * @return string + */ + public function getShippingPhoneType() + { + return $this->container['shippingPhoneType']; + } + + /** + * Sets shippingPhoneType + * + * @param string $shippingPhoneType The type of the receiver's phone number + * + * @return self + */ + public function setShippingPhoneType($shippingPhoneType) + { + $this->container['shippingPhoneType'] = $shippingPhoneType; + + return $this; + } + + /** + * Gets isBillShipStateSame + * + * @return bool + */ + public function getIsBillShipStateSame() + { + return $this->container['isBillShipStateSame']; + } + + /** + * Sets isBillShipStateSame + * + * @param bool $isBillShipStateSame Indicates whether the billing state is the same as the shipping state + * + * @return self + */ + public function setIsBillShipStateSame($isBillShipStateSame) + { + $this->container['isBillShipStateSame'] = $isBillShipStateSame; + + return $this; + } + + /** + * Gets isPreviousStateSame + * + * @return bool + */ + public function getIsPreviousStateSame() + { + return $this->container['isPreviousStateSame']; + } + + /** + * Sets isPreviousStateSame + * + * @param bool $isPreviousStateSame Indicates whether a previous billing state is the same as the shipping state + * + * @return self + */ + public function setIsPreviousStateSame($isPreviousStateSame) + { + $this->container['isPreviousStateSame'] = $isPreviousStateSame; + + return $this; + } + + /** + * Gets locToShipDistance + * + * @return int + */ + public function getLocToShipDistance() + { + return $this->container['locToShipDistance']; + } + + /** + * Sets locToShipDistance + * + * @param int $locToShipDistance The distance in meters between the buyer's location and their shipping address. + * + * @return self + */ + public function setLocToShipDistance($locToShipDistance) + { + $this->container['locToShipDistance'] = $locToShipDistance; + + return $this; + } + + /** + * Gets minPreviousShipToBillDistance + * + * @return int + */ + public function getMinPreviousShipToBillDistance() + { + return $this->container['minPreviousShipToBillDistance']; + } + + /** + * Sets minPreviousShipToBillDistance + * + * @param int $minPreviousShipToBillDistance The minimum distance in meters between the buyer's previous shipping address and their billing address. + * + * @return self + */ + public function setMinPreviousShipToBillDistance($minPreviousShipToBillDistance) + { + $this->container['minPreviousShipToBillDistance'] = $minPreviousShipToBillDistance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RiskBuyer.php b/model/RiskBuyer.php new file mode 100644 index 0000000..53ef832 --- /dev/null +++ b/model/RiskBuyer.php @@ -0,0 +1,515 @@ + + */ +class RiskBuyer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RiskBuyer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'noteToMerchant' => 'string', + 'noteToShipping' => 'string', + 'orderCountIn1H' => 'int', + 'orderCountIn24H' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'noteToMerchant' => null, + 'noteToShipping' => null, + 'orderCountIn1H' => null, + 'orderCountIn24H' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'noteToMerchant' => false, + 'noteToShipping' => false, + 'orderCountIn1H' => true, + 'orderCountIn24H' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'noteToMerchant' => 'noteToMerchant', + 'noteToShipping' => 'noteToShipping', + 'orderCountIn1H' => 'orderCountIn1H', + 'orderCountIn24H' => 'orderCountIn24H' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'noteToMerchant' => 'setNoteToMerchant', + 'noteToShipping' => 'setNoteToShipping', + 'orderCountIn1H' => 'setOrderCountIn1H', + 'orderCountIn24H' => 'setOrderCountIn24H' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'noteToMerchant' => 'getNoteToMerchant', + 'noteToShipping' => 'getNoteToShipping', + 'orderCountIn1H' => 'getOrderCountIn1H', + 'orderCountIn24H' => 'getOrderCountIn24H' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('noteToMerchant', $data ?? [], null); + $this->setIfExists('noteToShipping', $data ?? [], null); + $this->setIfExists('orderCountIn1H', $data ?? [], null); + $this->setIfExists('orderCountIn24H', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['noteToMerchant'] === null) { + $invalidProperties[] = "'noteToMerchant' can't be null"; + } + if ($this->container['noteToShipping'] === null) { + $invalidProperties[] = "'noteToShipping' can't be null"; + } + if ($this->container['orderCountIn1H'] === null) { + $invalidProperties[] = "'orderCountIn1H' can't be null"; + } + if ($this->container['orderCountIn24H'] === null) { + $invalidProperties[] = "'orderCountIn24H' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets noteToMerchant + * + * @return string + */ + public function getNoteToMerchant() + { + return $this->container['noteToMerchant']; + } + + /** + * Sets noteToMerchant + * + * @param string $noteToMerchant The buyer's note to a merchant. + * + * @return self + */ + public function setNoteToMerchant($noteToMerchant) + { + $this->container['noteToMerchant'] = $noteToMerchant; + + return $this; + } + + /** + * Gets noteToShipping + * + * @return string + */ + public function getNoteToShipping() + { + return $this->container['noteToShipping']; + } + + /** + * Sets noteToShipping + * + * @param string $noteToShipping The buyer's note to a deliveryman or a take-out rider. + * + * @return self + */ + public function setNoteToShipping($noteToShipping) + { + $this->container['noteToShipping'] = $noteToShipping; + + return $this; + } + + /** + * Gets orderCountIn1H + * + * @return int + */ + public function getOrderCountIn1H() + { + return $this->container['orderCountIn1H']; + } + + /** + * Sets orderCountIn1H + * + * @param int $orderCountIn1H The successful orders the buyer made within the last one hour. + * + * @return self + */ + public function setOrderCountIn1H($orderCountIn1H) + { + $this->container['orderCountIn1H'] = $orderCountIn1H; + + return $this; + } + + /** + * Gets orderCountIn24H + * + * @return int + */ + public function getOrderCountIn24H() + { + return $this->container['orderCountIn24H']; + } + + /** + * Sets orderCountIn24H + * + * @param int $orderCountIn24H The successful orders the buyer made within the last 24 hour. + * + * @return self + */ + public function setOrderCountIn24H($orderCountIn24H) + { + $this->container['orderCountIn24H'] = $orderCountIn24H; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RiskData.php b/model/RiskData.php new file mode 100644 index 0000000..4a88f76 --- /dev/null +++ b/model/RiskData.php @@ -0,0 +1,565 @@ + + */ +class RiskData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RiskData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => '\request\model\RiskOrder', + 'buyer' => '\request\model\RiskBuyer', + 'env' => '\request\model\RiskEnv', + 'riskSignal' => '\request\model\RiskSignal', + 'address' => '\request\model\RiskAddress', + 'cardVerificationResult' => '\request\model\CardVerificationResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'buyer' => null, + 'env' => null, + 'riskSignal' => null, + 'address' => null, + 'cardVerificationResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'order' => false, + 'buyer' => false, + 'env' => false, + 'riskSignal' => false, + 'address' => false, + 'cardVerificationResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'order' => 'order', + 'buyer' => 'buyer', + 'env' => 'env', + 'riskSignal' => 'riskSignal', + 'address' => 'address', + 'cardVerificationResult' => 'cardVerificationResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'buyer' => 'setBuyer', + 'env' => 'setEnv', + 'riskSignal' => 'setRiskSignal', + 'address' => 'setAddress', + 'cardVerificationResult' => 'setCardVerificationResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'buyer' => 'getBuyer', + 'env' => 'getEnv', + 'riskSignal' => 'getRiskSignal', + 'address' => 'getAddress', + 'cardVerificationResult' => 'getCardVerificationResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('buyer', $data ?? [], null); + $this->setIfExists('env', $data ?? [], null); + $this->setIfExists('riskSignal', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('cardVerificationResult', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets order + * + * @return \request\model\RiskOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \request\model\RiskOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets buyer + * + * @return \request\model\RiskBuyer|null + */ + public function getBuyer() + { + return $this->container['buyer']; + } + + /** + * Sets buyer + * + * @param \request\model\RiskBuyer|null $buyer buyer + * + * @return self + */ + public function setBuyer($buyer) + { + $this->container['buyer'] = $buyer; + + return $this; + } + + /** + * Gets env + * + * @return \request\model\RiskEnv|null + */ + public function getEnv() + { + return $this->container['env']; + } + + /** + * Sets env + * + * @param \request\model\RiskEnv|null $env env + * + * @return self + */ + public function setEnv($env) + { + $this->container['env'] = $env; + + return $this; + } + + /** + * Gets riskSignal + * + * @return \request\model\RiskSignal|null + */ + public function getRiskSignal() + { + return $this->container['riskSignal']; + } + + /** + * Sets riskSignal + * + * @param \request\model\RiskSignal|null $riskSignal riskSignal + * + * @return self + */ + public function setRiskSignal($riskSignal) + { + $this->container['riskSignal'] = $riskSignal; + + return $this; + } + + /** + * Gets address + * + * @return \request\model\RiskAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \request\model\RiskAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets cardVerificationResult + * + * @return \request\model\CardVerificationResult|null + */ + public function getCardVerificationResult() + { + return $this->container['cardVerificationResult']; + } + + /** + * Sets cardVerificationResult + * + * @param \request\model\CardVerificationResult|null $cardVerificationResult cardVerificationResult + * + * @return self + */ + public function setCardVerificationResult($cardVerificationResult) + { + $this->container['cardVerificationResult'] = $cardVerificationResult; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RiskEnv.php b/model/RiskEnv.php new file mode 100644 index 0000000..f403fdf --- /dev/null +++ b/model/RiskEnv.php @@ -0,0 +1,413 @@ + + */ +class RiskEnv implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RiskEnv'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ipAddressType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ipAddressType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'ipAddressType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ipAddressType' => 'ipAddressType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ipAddressType' => 'setIpAddressType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ipAddressType' => 'getIpAddressType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ipAddressType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ipAddressType'] === null) { + $invalidProperties[] = "'ipAddressType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ipAddressType + * + * @return string + */ + public function getIpAddressType() + { + return $this->container['ipAddressType']; + } + + /** + * Sets ipAddressType + * + * @param string $ipAddressType The type of an IP address + * + * @return self + */ + public function setIpAddressType($ipAddressType) + { + $this->container['ipAddressType'] = $ipAddressType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RiskOrder.php b/model/RiskOrder.php new file mode 100644 index 0000000..a780047 --- /dev/null +++ b/model/RiskOrder.php @@ -0,0 +1,447 @@ + + */ +class RiskOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RiskOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'orderType' => 'string', + 'referringSite' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'orderType' => null, + 'referringSite' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'orderType' => false, + 'referringSite' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'orderType' => 'orderType', + 'referringSite' => 'referringSite' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'orderType' => 'setOrderType', + 'referringSite' => 'setReferringSite' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'orderType' => 'getOrderType', + 'referringSite' => 'getReferringSite' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('orderType', $data ?? [], null); + $this->setIfExists('referringSite', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['orderType'] === null) { + $invalidProperties[] = "'orderType' can't be null"; + } + if ($this->container['referringSite'] === null) { + $invalidProperties[] = "'referringSite' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets orderType + * + * @return string + */ + public function getOrderType() + { + return $this->container['orderType']; + } + + /** + * Sets orderType + * + * @param string $orderType The order type + * + * @return self + */ + public function setOrderType($orderType) + { + $this->container['orderType'] = $orderType; + + return $this; + } + + /** + * Gets referringSite + * + * @return string + */ + public function getReferringSite() + { + return $this->container['referringSite']; + } + + /** + * Sets referringSite + * + * @param string $referringSite The webpage where the buyer accessed the merchant. + * + * @return self + */ + public function setReferringSite($referringSite) + { + $this->container['referringSite'] = $referringSite; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RiskSignal.php b/model/RiskSignal.php new file mode 100644 index 0000000..abd3b5c --- /dev/null +++ b/model/RiskSignal.php @@ -0,0 +1,447 @@ + + */ +class RiskSignal implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RiskSignal'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'riskCode' => 'string', + 'riskReason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'riskCode' => null, + 'riskReason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'riskCode' => false, + 'riskReason' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'riskCode' => 'riskCode', + 'riskReason' => 'riskReason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'riskCode' => 'setRiskCode', + 'riskReason' => 'setRiskReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'riskCode' => 'getRiskCode', + 'riskReason' => 'getRiskReason' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('riskCode', $data ?? [], null); + $this->setIfExists('riskReason', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['riskCode'] === null) { + $invalidProperties[] = "'riskCode' can't be null"; + } + if ($this->container['riskReason'] === null) { + $invalidProperties[] = "'riskReason' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets riskCode + * + * @return string + */ + public function getRiskCode() + { + return $this->container['riskCode']; + } + + /** + * Sets riskCode + * + * @param string $riskCode The tag assigned by a merchant to a risky transaction. + * + * @return self + */ + public function setRiskCode($riskCode) + { + $this->container['riskCode'] = $riskCode; + + return $this; + } + + /** + * Gets riskReason + * + * @return string + */ + public function getRiskReason() + { + return $this->container['riskReason']; + } + + /** + * Sets riskReason + * + * @param string $riskReason The reason why a transaction is identified as risky provided by a merchant. + * + * @return self + */ + public function setRiskReason($riskReason) + { + $this->container['riskReason'] = $riskReason; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/RiskThreeDSResult.php b/model/RiskThreeDSResult.php new file mode 100644 index 0000000..e7afc1e --- /dev/null +++ b/model/RiskThreeDSResult.php @@ -0,0 +1,515 @@ + + */ +class RiskThreeDSResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RiskThreeDSResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'threeDSVersion' => 'string', + 'threeDSInteractionMode' => 'string', + 'eci' => 'string', + 'cavv' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'threeDSVersion' => null, + 'threeDSInteractionMode' => null, + 'eci' => null, + 'cavv' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'threeDSVersion' => false, + 'threeDSInteractionMode' => false, + 'eci' => false, + 'cavv' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'threeDSVersion' => 'threeDSVersion', + 'threeDSInteractionMode' => 'threeDSInteractionMode', + 'eci' => 'eci', + 'cavv' => 'cavv' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'threeDSVersion' => 'setThreeDSVersion', + 'threeDSInteractionMode' => 'setThreeDSInteractionMode', + 'eci' => 'setEci', + 'cavv' => 'setCavv' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'threeDSVersion' => 'getThreeDSVersion', + 'threeDSInteractionMode' => 'getThreeDSInteractionMode', + 'eci' => 'getEci', + 'cavv' => 'getCavv' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('threeDSVersion', $data ?? [], null); + $this->setIfExists('threeDSInteractionMode', $data ?? [], null); + $this->setIfExists('eci', $data ?? [], null); + $this->setIfExists('cavv', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['threeDSVersion'] === null) { + $invalidProperties[] = "'threeDSVersion' can't be null"; + } + if ($this->container['threeDSInteractionMode'] === null) { + $invalidProperties[] = "'threeDSInteractionMode' can't be null"; + } + if ($this->container['eci'] === null) { + $invalidProperties[] = "'eci' can't be null"; + } + if ($this->container['cavv'] === null) { + $invalidProperties[] = "'cavv' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets threeDSVersion + * + * @return string + */ + public function getThreeDSVersion() + { + return $this->container['threeDSVersion']; + } + + /** + * Sets threeDSVersion + * + * @param string $threeDSVersion The version of 3D Secure protocol + * + * @return self + */ + public function setThreeDSVersion($threeDSVersion) + { + $this->container['threeDSVersion'] = $threeDSVersion; + + return $this; + } + + /** + * Gets threeDSInteractionMode + * + * @return string + */ + public function getThreeDSInteractionMode() + { + return $this->container['threeDSInteractionMode']; + } + + /** + * Sets threeDSInteractionMode + * + * @param string $threeDSInteractionMode Indicates the type of user interactions during 3DS 2.0 authentication + * + * @return self + */ + public function setThreeDSInteractionMode($threeDSInteractionMode) + { + $this->container['threeDSInteractionMode'] = $threeDSInteractionMode; + + return $this; + } + + /** + * Gets eci + * + * @return string + */ + public function getEci() + { + return $this->container['eci']; + } + + /** + * Sets eci + * + * @param string $eci Electronic Commerce Indicator (ECI) that is returned by the card scheme + * + * @return self + */ + public function setEci($eci) + { + $this->container['eci'] = $eci; + + return $this; + } + + /** + * Gets cavv + * + * @return string + */ + public function getCavv() + { + return $this->container['cavv']; + } + + /** + * Sets cavv + * + * @param string $cavv The cardholder authentication value + * + * @return self + */ + public function setCavv($cavv) + { + $this->container['cavv'] = $cavv; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/ScopeType.php b/model/ScopeType.php index d60a36b..e3ef6cb 100644 --- a/model/ScopeType.php +++ b/model/ScopeType.php @@ -1,14 +1,36 @@ + */ +class SettlementBankAccount implements ModelInterface, ArrayAccess, \JsonSerializable { - public $bankAccountNo; - public $accountHolderName; - public $swiftCode; - public $bankRegion; - public $accountHolderType; - public $routingNumber; - public $branchCode; - public $accountHolderTIN; - public $accountType; - public $bankName; - public $accountHolderAddress; - public $iban; - - /** - * @return mixed + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SettlementBankAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'bankAccountNo' => 'string', + 'accountHolderName' => 'string', + 'swiftCode' => 'string', + 'bankRegion' => 'string', + 'accountHolderType' => '\request\model\AccountHolderType', + 'routingNumber' => 'string', + 'branchCode' => 'string', + 'accountHolderTIN' => 'string', + 'accountType' => '\request\model\AccountType', + 'bankName' => 'string', + 'accountHolderAddress' => '\request\model\Address', + 'iban' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'bankAccountNo' => null, + 'accountHolderName' => null, + 'swiftCode' => null, + 'bankRegion' => null, + 'accountHolderType' => null, + 'routingNumber' => null, + 'branchCode' => null, + 'accountHolderTIN' => null, + 'accountType' => null, + 'bankName' => null, + 'accountHolderAddress' => null, + 'iban' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'bankAccountNo' => false, + 'accountHolderName' => false, + 'swiftCode' => false, + 'bankRegion' => false, + 'accountHolderType' => false, + 'routingNumber' => false, + 'branchCode' => false, + 'accountHolderTIN' => false, + 'accountType' => false, + 'bankName' => false, + 'accountHolderAddress' => false, + 'iban' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'bankAccountNo' => 'bankAccountNo', + 'accountHolderName' => 'accountHolderName', + 'swiftCode' => 'swiftCode', + 'bankRegion' => 'bankRegion', + 'accountHolderType' => 'accountHolderType', + 'routingNumber' => 'routingNumber', + 'branchCode' => 'branchCode', + 'accountHolderTIN' => 'accountHolderTIN', + 'accountType' => 'accountType', + 'bankName' => 'bankName', + 'accountHolderAddress' => 'accountHolderAddress', + 'iban' => 'iban' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bankAccountNo' => 'setBankAccountNo', + 'accountHolderName' => 'setAccountHolderName', + 'swiftCode' => 'setSwiftCode', + 'bankRegion' => 'setBankRegion', + 'accountHolderType' => 'setAccountHolderType', + 'routingNumber' => 'setRoutingNumber', + 'branchCode' => 'setBranchCode', + 'accountHolderTIN' => 'setAccountHolderTIN', + 'accountType' => 'setAccountType', + 'bankName' => 'setBankName', + 'accountHolderAddress' => 'setAccountHolderAddress', + 'iban' => 'setIban' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bankAccountNo' => 'getBankAccountNo', + 'accountHolderName' => 'getAccountHolderName', + 'swiftCode' => 'getSwiftCode', + 'bankRegion' => 'getBankRegion', + 'accountHolderType' => 'getAccountHolderType', + 'routingNumber' => 'getRoutingNumber', + 'branchCode' => 'getBranchCode', + 'accountHolderTIN' => 'getAccountHolderTIN', + 'accountType' => 'getAccountType', + 'bankName' => 'getBankName', + 'accountHolderAddress' => 'getAccountHolderAddress', + 'iban' => 'getIban' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('bankAccountNo', $data ?? [], null); + $this->setIfExists('accountHolderName', $data ?? [], null); + $this->setIfExists('swiftCode', $data ?? [], null); + $this->setIfExists('bankRegion', $data ?? [], null); + $this->setIfExists('accountHolderType', $data ?? [], null); + $this->setIfExists('routingNumber', $data ?? [], null); + $this->setIfExists('branchCode', $data ?? [], null); + $this->setIfExists('accountHolderTIN', $data ?? [], null); + $this->setIfExists('accountType', $data ?? [], null); + $this->setIfExists('bankName', $data ?? [], null); + $this->setIfExists('accountHolderAddress', $data ?? [], null); + $this->setIfExists('iban', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['bankAccountNo'] === null) { + $invalidProperties[] = "'bankAccountNo' can't be null"; + } + if ($this->container['accountHolderName'] === null) { + $invalidProperties[] = "'accountHolderName' can't be null"; + } + if ($this->container['bankRegion'] === null) { + $invalidProperties[] = "'bankRegion' can't be null"; + } + if ($this->container['accountHolderType'] === null) { + $invalidProperties[] = "'accountHolderType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets bankAccountNo + * + * @return string */ public function getBankAccountNo() { - return $this->bankAccountNo; + return $this->container['bankAccountNo']; } /** - * @param mixed $bankAccountNo + * Sets bankAccountNo + * + * @param string $bankAccountNo The international bank account number. The standardized formats in different areas are: Brazil: ^[0-9]{0,20}$ such as 123456789 More information: Maximum length: 64 characters + * + * @return self */ - public function setBankAccountNo($bankAccountNo) + public function setBankAccountNo($bankAccountNo) { - $this->bankAccountNo = $bankAccountNo; + $this->container['bankAccountNo'] = $bankAccountNo; + + return $this; } /** - * @return mixed + * Gets accountHolderName + * + * @return string */ public function getAccountHolderName() { - return $this->accountHolderName; + return $this->container['accountHolderName']; } /** - * @param mixed $accountHolderName + * Sets accountHolderName + * + * @param string $accountHolderName The full name of the account holder. The standardized formats in different areas are: Brazil: ^[A-Za-z0-9/() .,\\-?:'+]{0,50}$ More information: Maximum length: 64 characters + * + * @return self */ - public function setAccountHolderName($accountHolderName) + public function setAccountHolderName($accountHolderName) { - $this->accountHolderName = $accountHolderName; + $this->container['accountHolderName'] = $accountHolderName; + + return $this; } /** - * @return mixed + * Gets swiftCode + * + * @return string|null */ public function getSwiftCode() { - return $this->swiftCode; + return $this->container['swiftCode']; } /** - * @param mixed $swiftCode + * Sets swiftCode + * + * @param string|null $swiftCode The eight-character or eleven-character BIC or SWIFT code of the bank. Specify this parameter when the bank card issuing country is Brazil. More information: Maximum length: 11 characters + * + * @return self */ - public function setSwiftCode($swiftCode) + public function setSwiftCode($swiftCode) { - $this->swiftCode = $swiftCode; + $this->container['swiftCode'] = $swiftCode; + + return $this; } /** - * @return mixed + * Gets bankRegion + * + * @return string */ public function getBankRegion() { - return $this->bankRegion; + return $this->container['bankRegion']; } /** - * @param mixed $bankRegion + * Sets bankRegion + * + * @param string $bankRegion The region where the bank is located. The value of this parameter is a 2-letter region or country code that follows the ISO 3166 Country Codes standard. More information: Maximum length: 2 characters + * + * @return self */ - public function setBankRegion($bankRegion) + public function setBankRegion($bankRegion) { - $this->bankRegion = $bankRegion; + $this->container['bankRegion'] = $bankRegion; + + return $this; } /** - * @return mixed + * Gets accountHolderType + * + * @return \request\model\AccountHolderType */ public function getAccountHolderType() { - return $this->accountHolderType; + return $this->container['accountHolderType']; } /** - * @param mixed $accountHolderType + * Sets accountHolderType + * + * @param \request\model\AccountHolderType $accountHolderType accountHolderType + * + * @return self */ - public function setAccountHolderType($accountHolderType) + public function setAccountHolderType($accountHolderType) { - $this->accountHolderType = $accountHolderType; + $this->container['accountHolderType'] = $accountHolderType; + + return $this; } /** - * @return mixed + * Gets routingNumber + * + * @return string|null */ public function getRoutingNumber() { - return $this->routingNumber; + return $this->container['routingNumber']; } /** - * @param mixed $routingNumber + * Sets routingNumber + * + * @param string|null $routingNumber The routing number. See Bank routing number for valid values. Specify this parameter when the issuing bank is in Brazil. More information: Maximum length: 9 characters + * + * @return self */ - public function setRoutingNumber($routingNumber) + public function setRoutingNumber($routingNumber) { - $this->routingNumber = $routingNumber; + $this->container['routingNumber'] = $routingNumber; + + return $this; } /** - * @return mixed + * Gets branchCode + * + * @return string|null */ public function getBranchCode() { - return $this->branchCode; + return $this->container['branchCode']; } /** - * @param mixed $branchCode + * Sets branchCode + * + * @param string|null $branchCode The branch code of the bank. See Bank branch code for valid value s. Specify this parameter when the issuing bank is in Brazil. More information: Maximum length: 32 characters + * + * @return self */ - public function setBranchCode($branchCode) + public function setBranchCode($branchCode) { - $this->branchCode = $branchCode; + $this->container['branchCode'] = $branchCode; + + return $this; } /** - * @return mixed + * Gets accountHolderTIN + * + * @return string|null */ public function getAccountHolderTIN() { - return $this->accountHolderTIN; + return $this->container['accountHolderTIN']; } /** - * @param mixed $accountHolderTIN + * Sets accountHolderTIN + * + * @param string|null $accountHolderTIN The tax identification number (TIN) of the account holder. For the account holder in Brazil: If the account holder is an individual, the value of this parameter is an eleven-character tax ID known as CPF. If the account holder is a legal entity, the value of this parameter is a fourteen-character tax ID known as CNPJ. Specify this parameter when the issuing bank is in Brazil. More information: Maximum length: 32 characters + * + * @return self */ - public function setAccountHolderTIN($accountHolderTIN) + public function setAccountHolderTIN($accountHolderTIN) { - $this->accountHolderTIN = $accountHolderTIN; + $this->container['accountHolderTIN'] = $accountHolderTIN; + + return $this; } /** - * @return mixed + * Gets accountType + * + * @return \request\model\AccountType|null */ public function getAccountType() { - return $this->accountType; + return $this->container['accountType']; } /** - * @param mixed $accountType + * Sets accountType + * + * @param \request\model\AccountType|null $accountType accountType + * + * @return self */ - public function setAccountType($accountType) + public function setAccountType($accountType) { - $this->accountType = $accountType; + $this->container['accountType'] = $accountType; + + return $this; } /** - * @return mixed + * Gets bankName + * + * @return string|null */ public function getBankName() { - return $this->bankName; + return $this->container['bankName']; } /** - * @param mixed $bankName + * Sets bankName + * + * @param string|null $bankName The name of the bank. Specify this parameter when the card issuing country is the United States. More information: Maximum length: 256 characters + * + * @return self */ - public function setBankName($bankName) + public function setBankName($bankName) { - $this->bankName = $bankName; + $this->container['bankName'] = $bankName; + + return $this; } /** - * @return mixed + * Gets accountHolderAddress + * + * @return \request\model\Address|null */ public function getAccountHolderAddress() { - return $this->accountHolderAddress; + return $this->container['accountHolderAddress']; } /** - * @param mixed $accountHolderAddress + * Sets accountHolderAddress + * + * @param \request\model\Address|null $accountHolderAddress accountHolderAddress + * + * @return self */ - public function setAccountHolderAddress($accountHolderAddress) + public function setAccountHolderAddress($accountHolderAddress) { - $this->accountHolderAddress = $accountHolderAddress; + $this->container['accountHolderAddress'] = $accountHolderAddress; + + return $this; } /** - * @return mixed + * Gets iban + * + * @return string|null */ public function getIban() { - return $this->iban; + return $this->container['iban']; + } + + /** + * Sets iban + * + * @param string|null $iban The International Bank Account Number (IBAN) used to identify a bank account. Specify this parameter when the card issuing country is the United Kingdom or belongs to the European Union. More information: Maximum length: 34 characters + * + * @return self + */ + public function setIban($iban) + { + $this->container['iban'] = $iban; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); } /** - * @param mixed $iban + * 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. */ - public function setIban($iban) + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->iban = $iban; + return ObjectSerializer::sanitizeForSerialization($this); } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/SettlementDetail.php b/model/SettlementDetail.php index 59dba5d..09f9286 100644 --- a/model/SettlementDetail.php +++ b/model/SettlementDetail.php @@ -1,44 +1,447 @@ + */ +class SettlementDetail implements ModelInterface, ArrayAccess, \JsonSerializable { - public $settleTo; - public $settlementAmount; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SettlementDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'settleTo' => '\request\model\SettleToType', + 'settlementAmount' => '\request\model\Amount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'settleTo' => null, + 'settlementAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'settleTo' => false, + 'settlementAmount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'settleTo' => 'settleTo', + 'settlementAmount' => 'settlementAmount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'settleTo' => 'setSettleTo', + 'settlementAmount' => 'setSettlementAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'settleTo' => 'getSettleTo', + 'settlementAmount' => 'getSettlementAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('settleTo', $data ?? [], null); + $this->setIfExists('settlementAmount', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['settleTo'] === null) { + $invalidProperties[] = "'settleTo' can't be null"; + } + if ($this->container['settlementAmount'] === null) { + $invalidProperties[] = "'settlementAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets settleTo + * + * @return \request\model\SettleToType */ public function getSettleTo() { - return $this->settleTo; + return $this->container['settleTo']; } /** - * @param mixed $settleTo + * Sets settleTo + * + * @param \request\model\SettleToType $settleTo settleTo + * + * @return self */ - public function setSettleTo($settleTo) + public function setSettleTo($settleTo) { - $this->settleTo = $settleTo; + $this->container['settleTo'] = $settleTo; + + return $this; } /** - * @return mixed + * Gets settlementAmount + * + * @return \request\model\Amount */ public function getSettlementAmount() { - return $this->settlementAmount; + return $this->container['settlementAmount']; } /** - * @param mixed $settlementAmount + * Sets settlementAmount + * + * @param \request\model\Amount $settlementAmount settlementAmount + * + * @return self */ - public function setSettlementAmount($settlementAmount) + public function setSettlementAmount($settlementAmount) { - $this->settlementAmount = $settlementAmount; + $this->container['settlementAmount'] = $settlementAmount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/SettlementInfo.php b/model/SettlementInfo.php index 40c0943..5720ba7 100644 --- a/model/SettlementInfo.php +++ b/model/SettlementInfo.php @@ -1,43 +1,444 @@ + */ +class SettlementInfo implements ModelInterface, ArrayAccess, \JsonSerializable { - public $settlementCurrency; - public $settlementBankAccount; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SettlementInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'settlementCurrency' => 'string', + 'settlementBankAccount' => '\request\model\SettlementBankAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'settlementCurrency' => null, + 'settlementBankAccount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'settlementCurrency' => false, + 'settlementBankAccount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'settlementCurrency' => 'settlementCurrency', + 'settlementBankAccount' => 'settlementBankAccount' + ]; /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'settlementCurrency' => 'setSettlementCurrency', + 'settlementBankAccount' => 'setSettlementBankAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'settlementCurrency' => 'getSettlementCurrency', + 'settlementBankAccount' => 'getSettlementBankAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('settlementCurrency', $data ?? [], null); + $this->setIfExists('settlementBankAccount', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['settlementCurrency'] === null) { + $invalidProperties[] = "'settlementCurrency' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets settlementCurrency + * + * @return string */ public function getSettlementCurrency() { - return $this->settlementCurrency; + return $this->container['settlementCurrency']; } /** - * @param mixed $settlementCurrency + * Sets settlementCurrency + * + * @param string $settlementCurrency The sub-merchant's settlement currency that is specified in the settlement contract. The value of this parameter is a 3-letter currency code that follows the ISO 4217 standard. More information: Maximum length: 3 characters + * + * @return self */ - public function setSettlementCurrency($settlementCurrency) + public function setSettlementCurrency($settlementCurrency) { - $this->settlementCurrency = $settlementCurrency; + $this->container['settlementCurrency'] = $settlementCurrency; + + return $this; } /** - * @return mixed + * Gets settlementBankAccount + * + * @return \request\model\SettlementBankAccount|null */ public function getSettlementBankAccount() { - return $this->settlementBankAccount; + return $this->container['settlementBankAccount']; } /** - * @param mixed $settlementBankAccount + * Sets settlementBankAccount + * + * @param \request\model\SettlementBankAccount|null $settlementBankAccount settlementBankAccount + * + * @return self */ - public function setSettlementBankAccount($settlementBankAccount) + public function setSettlementBankAccount($settlementBankAccount) { - $this->settlementBankAccount = $settlementBankAccount; + $this->container['settlementBankAccount'] = $settlementBankAccount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/SettlementStrategy.php b/model/SettlementStrategy.php index b988588..537de40 100644 --- a/model/SettlementStrategy.php +++ b/model/SettlementStrategy.php @@ -1,26 +1,410 @@ + */ +class SettlementStrategy implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SettlementStrategy'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'settlementCurrency' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'settlementCurrency' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'settlementCurrency' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'settlementCurrency' => 'settlementCurrency' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'settlementCurrency' => 'setSettlementCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'settlementCurrency' => 'getSettlementCurrency' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('settlementCurrency', $data ?? [], null); - public $settlementCurrency; + } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets settlementCurrency + * + * @return string|null */ public function getSettlementCurrency() { - return $this->settlementCurrency; + return $this->container['settlementCurrency']; } /** - * @param mixed $settlementCurrency + * Sets settlementCurrency + * + * @param string|null $settlementCurrency The ISO currency code of the currency that the merchant wants to be settled against. The field is required if the merchant signed up for multiple currencies to settle. More information: Maximum length: 3 characters + * + * @return self */ public function setSettlementCurrency($settlementCurrency) { - $this->settlementCurrency = $settlementCurrency; + $this->container['settlementCurrency'] = $settlementCurrency; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } } diff --git a/model/Shipping.php b/model/Shipping.php index 756a829..8e95d4f 100644 --- a/model/Shipping.php +++ b/model/Shipping.php @@ -1,198 +1,658 @@ + */ +class Shipping implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Shipping'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'shippingName' => '\request\model\UserName', + 'shippingAddress' => '\request\model\Address', + 'shippingCarrier' => 'string', + 'shippingPhoneNo' => 'string', + 'shipToEmail' => 'string', + 'shippingFeeId' => 'string', + 'shippingFee' => '\request\model\Amount', + 'shippingDescription' => 'string', + 'deliveryEstimate' => '\request\model\DeliveryEstimate' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'shippingName' => null, + 'shippingAddress' => null, + 'shippingCarrier' => null, + 'shippingPhoneNo' => null, + 'shipToEmail' => null, + 'shippingFeeId' => null, + 'shippingFee' => null, + 'shippingDescription' => null, + 'deliveryEstimate' => null + ]; - public $shippingName; - public $shippingAddress; - public $shippingCarrier; - public $shippingPhoneNo; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'shippingName' => false, + 'shippingAddress' => false, + 'shippingCarrier' => false, + 'shippingPhoneNo' => false, + 'shipToEmail' => false, + 'shippingFeeId' => false, + 'shippingFee' => false, + 'shippingDescription' => false, + 'deliveryEstimate' => false + ]; - public $shippingNumber; - public $shipToEmail; - public $notes; - public $shippingFeeId; - public $shippingFee; - public $shippingDescription; - public $deliveryEstimate; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; /** - * @return mixed + * Array of property to type mappings. Used for (de)serialization + * + * @return array */ - public function getShippingNumber() + public static function openAPITypes() { - return $this->shippingNumber; + return self::$openAPITypes; } /** - * @param mixed $shippingNumber + * Array of property to format mappings. Used for (de)serialization + * + * @return array */ - public function setShippingNumber($shippingNumber) + public static function openAPIFormats() { - $this->shippingNumber = $shippingNumber; + return self::$openAPIFormats; } /** - * @return mixed + * Array of nullable properties + * + * @return array */ - public function getShipToEmail() + protected static function openAPINullables(): array { - return $this->shipToEmail; + return self::$openAPINullables; } /** - * @param mixed $shipToEmail + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public function setShipToEmail($shipToEmail) + private function getOpenAPINullablesSetToNull(): array { - $this->shipToEmail = $shipToEmail; + return $this->openAPINullablesSetToNull; } /** - * @return mixed + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull */ - public function getNotes() + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - return $this->notes; + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** - * @param mixed $notes + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public function setNotes($notes) + public static function isNullable(string $property): bool { - $this->notes = $notes; + return self::openAPINullables()[$property] ?? false; } /** - * @return mixed + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public function getShippingFeeId() + public function isNullableSetToNull(string $property): bool { - return $this->shippingFeeId; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * @param mixed $shippingFeeId + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public function setShippingFeeId($shippingFeeId) + protected static $attributeMap = [ + 'shippingName' => 'shippingName', + 'shippingAddress' => 'shippingAddress', + 'shippingCarrier' => 'shippingCarrier', + 'shippingPhoneNo' => 'shippingPhoneNo', + 'shipToEmail' => 'shipToEmail', + 'shippingFeeId' => 'shippingFeeId', + 'shippingFee' => 'shippingFee', + 'shippingDescription' => 'shippingDescription', + 'deliveryEstimate' => 'deliveryEstimate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'shippingName' => 'setShippingName', + 'shippingAddress' => 'setShippingAddress', + 'shippingCarrier' => 'setShippingCarrier', + 'shippingPhoneNo' => 'setShippingPhoneNo', + 'shipToEmail' => 'setShipToEmail', + 'shippingFeeId' => 'setShippingFeeId', + 'shippingFee' => 'setShippingFee', + 'shippingDescription' => 'setShippingDescription', + 'deliveryEstimate' => 'setDeliveryEstimate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'shippingName' => 'getShippingName', + 'shippingAddress' => 'getShippingAddress', + 'shippingCarrier' => 'getShippingCarrier', + 'shippingPhoneNo' => 'getShippingPhoneNo', + 'shipToEmail' => 'getShipToEmail', + 'shippingFeeId' => 'getShippingFeeId', + 'shippingFee' => 'getShippingFee', + 'shippingDescription' => 'getShippingDescription', + 'deliveryEstimate' => 'getDeliveryEstimate' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() { - $this->shippingFeeId = $shippingFeeId; + return self::$attributeMap; } /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public function getShippingFee() + public static function setters() { - return $this->shippingFee; + return self::$setters; } /** - * @param mixed $shippingFee + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public function setShippingFee($shippingFee) + public static function getters() { - $this->shippingFee = $shippingFee; + return self::$getters; } /** - * @return mixed + * The original name of the model. + * + * @return string */ - public function getShippingDescription() + public function getModelName() { - return $this->shippingDescription; + return self::$openAPIModelName; } + /** - * @param mixed $shippingDescription + * Associative array for storing property values + * + * @var mixed[] */ - public function setShippingDescription($shippingDescription) + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('shippingName', $data ?? [], null); + $this->setIfExists('shippingAddress', $data ?? [], null); + $this->setIfExists('shippingCarrier', $data ?? [], null); + $this->setIfExists('shippingPhoneNo', $data ?? [], null); + $this->setIfExists('shipToEmail', $data ?? [], null); + $this->setIfExists('shippingFeeId', $data ?? [], null); + $this->setIfExists('shippingFee', $data ?? [], null); + $this->setIfExists('shippingDescription', $data ?? [], null); + $this->setIfExists('deliveryEstimate', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - $this->shippingDescription = $shippingDescription; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** - * @return mixed + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public function getDeliveryEstimate() + public function listInvalidProperties() { - return $this->deliveryEstimate; + $invalidProperties = []; + + return $invalidProperties; } /** - * @param mixed $deliveryEstimate + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid */ - public function setDeliveryEstimate($deliveryEstimate) + public function valid() { - $this->deliveryEstimate = $deliveryEstimate; + return count($this->listInvalidProperties()) === 0; } /** - * @return String + * Gets shippingName + * + * @return \request\model\UserName|null */ public function getShippingName() { - return $this->shippingName; + return $this->container['shippingName']; } /** - * @param String $shippingName + * Sets shippingName + * + * @param \request\model\UserName|null $shippingName shippingName + * + * @return self */ public function setShippingName($shippingName) { - $this->shippingName = $shippingName; + $this->container['shippingName'] = $shippingName; + + return $this; } /** - * @return Address + * Gets shippingAddress + * + * @return \request\model\Address|null */ public function getShippingAddress() { - return $this->shippingAddress; + return $this->container['shippingAddress']; } /** - * @param Address $shippingAddress + * Sets shippingAddress + * + * @param \request\model\Address|null $shippingAddress shippingAddress + * + * @return self */ public function setShippingAddress($shippingAddress) { - $this->shippingAddress = $shippingAddress; + $this->container['shippingAddress'] = $shippingAddress; + + return $this; } /** - * @return String + * Gets shippingCarrier + * + * @return string|null */ public function getShippingCarrier() { - return $this->shippingCarrier; + return $this->container['shippingCarrier']; } /** - * @param String $shippingCarrier + * Sets shippingCarrier + * + * @param string|null $shippingCarrier The delivery service provider for shipping a physical product, such as FedEx, UPS, or USPS. Specify this parameter if you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 128 characters + * + * @return self */ public function setShippingCarrier($shippingCarrier) { - $this->shippingCarrier = $shippingCarrier; + $this->container['shippingCarrier'] = $shippingCarrier; + + return $this; } /** - * @return String + * Gets shippingPhoneNo + * + * @return string|null */ public function getShippingPhoneNo() { - return $this->shippingPhoneNo; + return $this->container['shippingPhoneNo']; } /** - * @param String $shippingPhoneNo + * Sets shippingPhoneNo + * + * @param string|null $shippingPhoneNo The phone number of a recipient (including extension). Specify this parameter when you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates. More information: Maximum length: 16 characters + * + * @return self */ public function setShippingPhoneNo($shippingPhoneNo) { - $this->shippingPhoneNo = $shippingPhoneNo; + $this->container['shippingPhoneNo'] = $shippingPhoneNo; + + return $this; + } + + /** + * Gets shipToEmail + * + * @return string|null + */ + public function getShipToEmail() + { + return $this->container['shipToEmail']; + } + + /** + * Sets shipToEmail + * + * @param string|null $shipToEmail The email address where virtual goods are sent. Specify this parameter when one of the following conditions is met: if you require risk control. if you are a digital and entertainment merchant. Providing this information helps to increase fraud and identity theft detection. More information: Maximum length: 64 characters + * + * @return self + */ + public function setShipToEmail($shipToEmail) + { + $this->container['shipToEmail'] = $shipToEmail; + + return $this; + } + + /** + * Gets shippingFeeId + * + * @return string|null + */ + public function getShippingFeeId() + { + return $this->container['shippingFeeId']; + } + + /** + * Sets shippingFeeId + * + * @param string|null $shippingFeeId The ID of the shipping fee used for identifying the shipping option. More information: Maximum length: 64 characters + * + * @return self + */ + public function setShippingFeeId($shippingFeeId) + { + $this->container['shippingFeeId'] = $shippingFeeId; + + return $this; + } + + /** + * Gets shippingFee + * + * @return \request\model\Amount|null + */ + public function getShippingFee() + { + return $this->container['shippingFee']; + } + + /** + * Sets shippingFee + * + * @param \request\model\Amount|null $shippingFee shippingFee + * + * @return self + */ + public function setShippingFee($shippingFee) + { + $this->container['shippingFee'] = $shippingFee; + + return $this; + } + + /** + * Gets shippingDescription + * + * @return string|null + */ + public function getShippingDescription() + { + return $this->container['shippingDescription']; + } + + /** + * Sets shippingDescription + * + * @param string|null $shippingDescription Extended information about logistics-related services, including shipping time, logistics companies, etc. More information: Maximum length: 64 characters + * + * @return self + */ + public function setShippingDescription($shippingDescription) + { + $this->container['shippingDescription'] = $shippingDescription; + + return $this; + } + + /** + * Gets deliveryEstimate + * + * @return \request\model\DeliveryEstimate|null + */ + public function getDeliveryEstimate() + { + return $this->container['deliveryEstimate']; + } + + /** + * Sets deliveryEstimate + * + * @param \request\model\DeliveryEstimate|null $deliveryEstimate deliveryEstimate + * + * @return self + */ + public function setDeliveryEstimate($deliveryEstimate) + { + $this->container['deliveryEstimate'] = $deliveryEstimate; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/StockInfo.php b/model/StockInfo.php index d925ed8..994890b 100644 --- a/model/StockInfo.php +++ b/model/StockInfo.php @@ -1,44 +1,444 @@ + */ +class StockInfo implements ModelInterface, ArrayAccess, \JsonSerializable { - public $listedRegion; - public $tickerSymbol; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StockInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'listedRegion' => 'string', + 'tickerSymbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'listedRegion' => null, + 'tickerSymbol' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'listedRegion' => false, + 'tickerSymbol' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'listedRegion' => 'listedRegion', + 'tickerSymbol' => 'tickerSymbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'listedRegion' => 'setListedRegion', + 'tickerSymbol' => 'setTickerSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'listedRegion' => 'getListedRegion', + 'tickerSymbol' => 'getTickerSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('listedRegion', $data ?? [], null); + $this->setIfExists('tickerSymbol', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['listedRegion'] === null) { + $invalidProperties[] = "'listedRegion' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets listedRegion + * + * @return string */ public function getListedRegion() { - return $this->listedRegion; + return $this->container['listedRegion']; } /** - * @param mixed $listedRegion + * Sets listedRegion + * + * @param string $listedRegion The region or country where the company is listed. More information: Maximum length: 2 characters + * + * @return self */ - public function setListedRegion($listedRegion) + public function setListedRegion($listedRegion) { - $this->listedRegion = $listedRegion; + $this->container['listedRegion'] = $listedRegion; + + return $this; } /** - * @return mixed + * Gets tickerSymbol + * + * @return string|null */ public function getTickerSymbol() { - return $this->tickerSymbol; + return $this->container['tickerSymbol']; } /** - * @param mixed $tickerSymbol + * Sets tickerSymbol + * + * @param string|null $tickerSymbol The ticker symbol of the stock. Specify this parameter when the value of merchantInfo.company.registeredAddress.region is US. More information: Maximum length: 32 characters + * + * @return self */ - public function setTickerSymbol($tickerSymbol) + public function setTickerSymbol($tickerSymbol) { - $this->tickerSymbol = $tickerSymbol; + $this->container['tickerSymbol'] = $tickerSymbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Store.php b/model/Store.php index 8e3df3f..9bf2b1c 100644 --- a/model/Store.php +++ b/model/Store.php @@ -1,145 +1,651 @@ + */ +class Store implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Store'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'referenceStoreId' => 'string', + 'storeName' => 'string', + 'storeMCC' => 'string', + 'storeDisplayName' => 'string', + 'storeTerminalId' => 'string', + 'storeOperatorId' => 'string', + 'storeAddress' => '\request\model\Address', + 'storePhoneNo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'referenceStoreId' => null, + 'storeName' => null, + 'storeMCC' => null, + 'storeDisplayName' => null, + 'storeTerminalId' => null, + 'storeOperatorId' => null, + 'storeAddress' => null, + 'storePhoneNo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'referenceStoreId' => false, + 'storeName' => false, + 'storeMCC' => false, + 'storeDisplayName' => false, + 'storeTerminalId' => false, + 'storeOperatorId' => false, + 'storeAddress' => false, + 'storePhoneNo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } - public $referenceStoreId; - public $storeName; - public $storeMCC; - public $storeDisplayName; - public $storeTerminalId; - public $storeOperatorId; - public $storeAddress; - public $storePhoneNo; + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } /** - * @return String + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'referenceStoreId' => 'referenceStoreId', + 'storeName' => 'storeName', + 'storeMCC' => 'storeMCC', + 'storeDisplayName' => 'storeDisplayName', + 'storeTerminalId' => 'storeTerminalId', + 'storeOperatorId' => 'storeOperatorId', + 'storeAddress' => 'storeAddress', + 'storePhoneNo' => 'storePhoneNo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'referenceStoreId' => 'setReferenceStoreId', + 'storeName' => 'setStoreName', + 'storeMCC' => 'setStoreMCC', + 'storeDisplayName' => 'setStoreDisplayName', + 'storeTerminalId' => 'setStoreTerminalId', + 'storeOperatorId' => 'setStoreOperatorId', + 'storeAddress' => 'setStoreAddress', + 'storePhoneNo' => 'setStorePhoneNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'referenceStoreId' => 'getReferenceStoreId', + 'storeName' => 'getStoreName', + 'storeMCC' => 'getStoreMCC', + 'storeDisplayName' => 'getStoreDisplayName', + 'storeTerminalId' => 'getStoreTerminalId', + 'storeOperatorId' => 'getStoreOperatorId', + 'storeAddress' => 'getStoreAddress', + 'storePhoneNo' => 'getStorePhoneNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('referenceStoreId', $data ?? [], null); + $this->setIfExists('storeName', $data ?? [], null); + $this->setIfExists('storeMCC', $data ?? [], null); + $this->setIfExists('storeDisplayName', $data ?? [], null); + $this->setIfExists('storeTerminalId', $data ?? [], null); + $this->setIfExists('storeOperatorId', $data ?? [], null); + $this->setIfExists('storeAddress', $data ?? [], null); + $this->setIfExists('storePhoneNo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['referenceStoreId'] === null) { + $invalidProperties[] = "'referenceStoreId' can't be null"; + } + if ($this->container['storeName'] === null) { + $invalidProperties[] = "'storeName' can't be null"; + } + if ($this->container['storeMCC'] === null) { + $invalidProperties[] = "'storeMCC' can't be null"; + } + if ($this->container['storeDisplayName'] === null) { + $invalidProperties[] = "'storeDisplayName' can't be null"; + } + if ($this->container['storeTerminalId'] === null) { + $invalidProperties[] = "'storeTerminalId' can't be null"; + } + if ($this->container['storeOperatorId'] === null) { + $invalidProperties[] = "'storeOperatorId' can't be null"; + } + if ($this->container['storeAddress'] === null) { + $invalidProperties[] = "'storeAddress' can't be null"; + } + if ($this->container['storePhoneNo'] === null) { + $invalidProperties[] = "'storePhoneNo' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets referenceStoreId + * + * @return string */ public function getReferenceStoreId() { - return $this->referenceStoreId; + return $this->container['referenceStoreId']; } /** - * @param String $referenceStoreId + * Sets referenceStoreId + * + * @param string $referenceStoreId referenceStoreId + * + * @return self */ public function setReferenceStoreId($referenceStoreId) { - $this->referenceStoreId = $referenceStoreId; + $this->container['referenceStoreId'] = $referenceStoreId; + + return $this; } /** - * @return String + * Gets storeName + * + * @return string */ public function getStoreName() { - return $this->storeName; + return $this->container['storeName']; } /** - * @param String $storeName + * Sets storeName + * + * @param string $storeName storeName + * + * @return self */ public function setStoreName($storeName) { - $this->storeName = $storeName; + $this->container['storeName'] = $storeName; + + return $this; } /** - * @return String + * Gets storeMCC + * + * @return string */ public function getStoreMCC() { - return $this->storeMCC; + return $this->container['storeMCC']; } /** - * @param String $storeMCC + * Sets storeMCC + * + * @param string $storeMCC storeMCC + * + * @return self */ public function setStoreMCC($storeMCC) { - $this->storeMCC = $storeMCC; + $this->container['storeMCC'] = $storeMCC; + + return $this; } /** - * @return String + * Gets storeDisplayName + * + * @return string */ public function getStoreDisplayName() { - return $this->storeDisplayName; + return $this->container['storeDisplayName']; } /** - * @param String $storeDisplayName + * Sets storeDisplayName + * + * @param string $storeDisplayName storeDisplayName + * + * @return self */ public function setStoreDisplayName($storeDisplayName) { - $this->storeDisplayName = $storeDisplayName; + $this->container['storeDisplayName'] = $storeDisplayName; + + return $this; } /** - * @return String + * Gets storeTerminalId + * + * @return string */ public function getStoreTerminalId() { - return $this->storeTerminalId; + return $this->container['storeTerminalId']; } /** - * @param String $storeTerminalId + * Sets storeTerminalId + * + * @param string $storeTerminalId storeTerminalId + * + * @return self */ public function setStoreTerminalId($storeTerminalId) { - $this->storeTerminalId = $storeTerminalId; + $this->container['storeTerminalId'] = $storeTerminalId; + + return $this; } /** - * @return String + * Gets storeOperatorId + * + * @return string */ public function getStoreOperatorId() { - return $this->storeOperatorId; + return $this->container['storeOperatorId']; } /** - * @param String $storeOperatorId + * Sets storeOperatorId + * + * @param string $storeOperatorId storeOperatorId + * + * @return self */ public function setStoreOperatorId($storeOperatorId) { - $this->storeOperatorId = $storeOperatorId; + $this->container['storeOperatorId'] = $storeOperatorId; + + return $this; } /** - * @return Address + * Gets storeAddress + * + * @return \request\model\Address */ public function getStoreAddress() { - return $this->storeAddress; + return $this->container['storeAddress']; } /** - * @param Address $storeAddress + * Sets storeAddress + * + * @param \request\model\Address $storeAddress storeAddress + * + * @return self */ public function setStoreAddress($storeAddress) { - $this->storeAddress = $storeAddress; + $this->container['storeAddress'] = $storeAddress; + + return $this; } /** - * @return String + * Gets storePhoneNo + * + * @return string */ public function getStorePhoneNo() { - return $this->storePhoneNo; + return $this->container['storePhoneNo']; } /** - * @param String $storePhoneNo + * Sets storePhoneNo + * + * @param string $storePhoneNo storePhoneNo + * + * @return self */ public function setStorePhoneNo($storePhoneNo) { - $this->storePhoneNo = $storePhoneNo; + $this->container['storePhoneNo'] = $storePhoneNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/SupportBank.php b/model/SupportBank.php new file mode 100644 index 0000000..7b5576e --- /dev/null +++ b/model/SupportBank.php @@ -0,0 +1,472 @@ + + */ +class SupportBank implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SupportBank'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'bankIdentifierCode' => 'string', + 'bankShortName' => 'string', + 'bankLogo' => '\request\model\Logo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'bankIdentifierCode' => null, + 'bankShortName' => null, + 'bankLogo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'bankIdentifierCode' => false, + 'bankShortName' => false, + 'bankLogo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'bankIdentifierCode' => 'bankIdentifierCode', + 'bankShortName' => 'bankShortName', + 'bankLogo' => 'bankLogo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bankIdentifierCode' => 'setBankIdentifierCode', + 'bankShortName' => 'setBankShortName', + 'bankLogo' => 'setBankLogo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bankIdentifierCode' => 'getBankIdentifierCode', + 'bankShortName' => 'getBankShortName', + 'bankLogo' => 'getBankLogo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('bankIdentifierCode', $data ?? [], null); + $this->setIfExists('bankShortName', $data ?? [], null); + $this->setIfExists('bankLogo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets bankIdentifierCode + * + * @return string|null + */ + public function getBankIdentifierCode() + { + return $this->container['bankIdentifierCode']; + } + + /** + * Sets bankIdentifierCode + * + * @param string|null $bankIdentifierCode The unique code of the bank. See the Bank list to check the valid values. + * + * @return self + */ + public function setBankIdentifierCode($bankIdentifierCode) + { + $this->container['bankIdentifierCode'] = $bankIdentifierCode; + + return $this; + } + + /** + * Gets bankShortName + * + * @return string|null + */ + public function getBankShortName() + { + return $this->container['bankShortName']; + } + + /** + * Sets bankShortName + * + * @param string|null $bankShortName The short name of the bank. The unique code of the bank. See the Bank list to check the valid values. + * + * @return self + */ + public function setBankShortName($bankShortName) + { + $this->container['bankShortName'] = $bankShortName; + + return $this; + } + + /** + * Gets bankLogo + * + * @return \request\model\Logo|null + */ + public function getBankLogo() + { + return $this->container['bankLogo']; + } + + /** + * Sets bankLogo + * + * @param \request\model\Logo|null $bankLogo bankLogo + * + * @return self + */ + public function setBankLogo($bankLogo) + { + $this->container['bankLogo'] = $bankLogo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/SupportCardBrand.php b/model/SupportCardBrand.php new file mode 100644 index 0000000..ff9c963 --- /dev/null +++ b/model/SupportCardBrand.php @@ -0,0 +1,447 @@ + + */ +class SupportCardBrand implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SupportCardBrand'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cardBrand' => 'string', + 'logo' => '\request\model\Logo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cardBrand' => null, + 'logo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'cardBrand' => false, + 'logo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'cardBrand' => 'cardBrand', + 'logo' => 'logo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cardBrand' => 'setCardBrand', + 'logo' => 'setLogo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cardBrand' => 'getCardBrand', + 'logo' => 'getLogo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('cardBrand', $data ?? [], null); + $this->setIfExists('logo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['cardBrand'] === null) { + $invalidProperties[] = "'cardBrand' can't be null"; + } + if ($this->container['logo'] === null) { + $invalidProperties[] = "'logo' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets cardBrand + * + * @return string + */ + public function getCardBrand() + { + return $this->container['cardBrand']; + } + + /** + * Sets cardBrand + * + * @param string $cardBrand The name of the card brand. Valid values are: VISA: indicates Visa. MASTERCARD: indicates Mastercard. AMEX: indicates American Express (Amex). HIPERCARD: indicates Hipercard. ELO: indicates Elo. + * + * @return self + */ + public function setCardBrand($cardBrand) + { + $this->container['cardBrand'] = $cardBrand; + + return $this; + } + + /** + * Gets logo + * + * @return \request\model\Logo + */ + public function getLogo() + { + return $this->container['logo']; + } + + /** + * Sets logo + * + * @param \request\model\Logo $logo logo + * + * @return self + */ + public function setLogo($logo) + { + $this->container['logo'] = $logo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/TerminalType.php b/model/TerminalType.php index aef9f5d..adf038d 100644 --- a/model/TerminalType.php +++ b/model/TerminalType.php @@ -1,13 +1,33 @@ + */ +class ThreeDSResult implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ThreeDSResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'threeDSVersion' => 'string', + 'eci' => 'string', + 'cavv' => 'string', + 'dsTransactionId' => 'string', + 'xid' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'threeDSVersion' => null, + 'eci' => null, + 'cavv' => null, + 'dsTransactionId' => null, + 'xid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'threeDSVersion' => false, + 'eci' => false, + 'cavv' => false, + 'dsTransactionId' => false, + 'xid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'threeDSVersion' => 'threeDSVersion', + 'eci' => 'eci', + 'cavv' => 'cavv', + 'dsTransactionId' => 'dsTransactionId', + 'xid' => 'xid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'threeDSVersion' => 'setThreeDSVersion', + 'eci' => 'setEci', + 'cavv' => 'setCavv', + 'dsTransactionId' => 'setDsTransactionId', + 'xid' => 'setXid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'threeDSVersion' => 'getThreeDSVersion', + 'eci' => 'getEci', + 'cavv' => 'getCavv', + 'dsTransactionId' => 'getDsTransactionId', + 'xid' => 'getXid' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $threeDSVersion; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $eci; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - public $cavv; - public $dsTransactionId; + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('threeDSVersion', $data ?? [], null); + $this->setIfExists('eci', $data ?? [], null); + $this->setIfExists('cavv', $data ?? [], null); + $this->setIfExists('dsTransactionId', $data ?? [], null); + $this->setIfExists('xid', $data ?? [], null); - public $xid; + } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets threeDSVersion + * + * @return string|null */ public function getThreeDSVersion() { - return $this->threeDSVersion; + return $this->container['threeDSVersion']; } /** - * @param mixed $threeDSVersion + * Sets threeDSVersion + * + * @param string|null $threeDSVersion The version of 3D Secure protocol + * + * @return self */ - public function setThreeDSVersion($threeDSVersion) + public function setThreeDSVersion($threeDSVersion) { - $this->threeDSVersion = $threeDSVersion; + $this->container['threeDSVersion'] = $threeDSVersion; + + return $this; } /** - * @return mixed + * Gets eci + * + * @return string|null */ public function getEci() { - return $this->eci; + return $this->container['eci']; } /** - * @param mixed $eci + * Sets eci + * + * @param string|null $eci Electronic Commerce Indicator (ECI) that is returned by the card scheme + * + * @return self */ - public function setEci($eci) + public function setEci($eci) { - $this->eci = $eci; + $this->container['eci'] = $eci; + + return $this; } /** - * @return mixed + * Gets cavv + * + * @return string|null */ public function getCavv() { - return $this->cavv; + return $this->container['cavv']; } /** - * @param mixed $cavv + * Sets cavv + * + * @param string|null $cavv The cardholder authentication value + * + * @return self */ - public function setCavv($cavv) + public function setCavv($cavv) { - $this->cavv = $cavv; + $this->container['cavv'] = $cavv; + + return $this; } /** - * @return mixed + * Gets dsTransactionId + * + * @return string|null */ public function getDsTransactionId() { - return $this->dsTransactionId; + return $this->container['dsTransactionId']; } /** - * @param mixed $dsTransactionId + * Sets dsTransactionId + * + * @param string|null $dsTransactionId dsTransactionId + * + * @return self */ - public function setDsTransactionId($dsTransactionId) + public function setDsTransactionId($dsTransactionId) { - $this->dsTransactionId = $dsTransactionId; + $this->container['dsTransactionId'] = $dsTransactionId; + + return $this; } /** - * @return mixed + * Gets xid + * + * @return string|null */ public function getXid() { - return $this->xid; + return $this->container['xid']; } /** - * @param mixed $xid + * Sets xid + * + * @param string|null $xid The unique transaction identifier assigned by the Directory Server (DS) for 3D Secure authentication + * + * @return self */ - public function setXid($xid) + public function setXid($xid) { - $this->xid = $xid; + $this->container['xid'] = $xid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Transaction.php b/model/Transaction.php index 57ff1a7..826f678 100644 --- a/model/Transaction.php +++ b/model/Transaction.php @@ -1,127 +1,645 @@ + */ +class Transaction implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Transaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transactionResult' => '\request\model\Result', + 'transactionId' => 'string', + 'transactionType' => '\request\model\TransactionType', + 'transactionStatus' => '\request\model\TransactionStatusType', + 'transactionAmount' => '\request\model\Amount', + 'transactionRequestId' => 'string', + 'transactionTime' => 'string', + 'acquirerInfo' => '\request\model\AcquirerInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transactionResult' => null, + 'transactionId' => null, + 'transactionType' => null, + 'transactionStatus' => null, + 'transactionAmount' => null, + 'transactionRequestId' => null, + 'transactionTime' => null, + 'acquirerInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transactionResult' => false, + 'transactionId' => false, + 'transactionType' => false, + 'transactionStatus' => false, + 'transactionAmount' => false, + 'transactionRequestId' => false, + 'transactionTime' => false, + 'acquirerInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transactionResult' => 'transactionResult', + 'transactionId' => 'transactionId', + 'transactionType' => 'transactionType', + 'transactionStatus' => 'transactionStatus', + 'transactionAmount' => 'transactionAmount', + 'transactionRequestId' => 'transactionRequestId', + 'transactionTime' => 'transactionTime', + 'acquirerInfo' => 'acquirerInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transactionResult' => 'setTransactionResult', + 'transactionId' => 'setTransactionId', + 'transactionType' => 'setTransactionType', + 'transactionStatus' => 'setTransactionStatus', + 'transactionAmount' => 'setTransactionAmount', + 'transactionRequestId' => 'setTransactionRequestId', + 'transactionTime' => 'setTransactionTime', + 'acquirerInfo' => 'setAcquirerInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transactionResult' => 'getTransactionResult', + 'transactionId' => 'getTransactionId', + 'transactionType' => 'getTransactionType', + 'transactionStatus' => 'getTransactionStatus', + 'transactionAmount' => 'getTransactionAmount', + 'transactionRequestId' => 'getTransactionRequestId', + 'transactionTime' => 'getTransactionTime', + 'acquirerInfo' => 'getAcquirerInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transactionResult', $data ?? [], null); + $this->setIfExists('transactionId', $data ?? [], null); + $this->setIfExists('transactionType', $data ?? [], null); + $this->setIfExists('transactionStatus', $data ?? [], null); + $this->setIfExists('transactionAmount', $data ?? [], null); + $this->setIfExists('transactionRequestId', $data ?? [], null); + $this->setIfExists('transactionTime', $data ?? [], null); + $this->setIfExists('acquirerInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['transactionResult'] === null) { + $invalidProperties[] = "'transactionResult' can't be null"; + } + if ($this->container['transactionId'] === null) { + $invalidProperties[] = "'transactionId' can't be null"; + } + if ($this->container['transactionType'] === null) { + $invalidProperties[] = "'transactionType' can't be null"; + } + if ($this->container['transactionStatus'] === null) { + $invalidProperties[] = "'transactionStatus' can't be null"; + } + if ($this->container['transactionAmount'] === null) { + $invalidProperties[] = "'transactionAmount' can't be null"; + } + if ($this->container['transactionRequestId'] === null) { + $invalidProperties[] = "'transactionRequestId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } - public $transactionResult; - public $transactionId; - public $transactionType; - public $transactionStatus; - public $transactionAmount; - public $transactionRequestId; - public $transactionTime; /** - * @return mixed + * Gets transactionResult + * + * @return \request\model\Result */ public function getTransactionResult() { - return $this->transactionResult; + return $this->container['transactionResult']; } /** - * @param mixed $transactionResult + * Sets transactionResult + * + * @param \request\model\Result $transactionResult transactionResult + * + * @return self */ public function setTransactionResult($transactionResult) { - $this->transactionResult = $transactionResult; + $this->container['transactionResult'] = $transactionResult; + + return $this; } /** - * @return mixed + * Gets transactionId + * + * @return string */ public function getTransactionId() { - return $this->transactionId; + return $this->container['transactionId']; } /** - * @param mixed $transactionId + * Sets transactionId + * + * @param string $transactionId The unique ID that is assigned by Antom to identify a transaction. When the transaction type is REFUND, the value of this parameter is identical to refundId. When the transaction type is CAPTURE, the value of this parameter is identical to captureId. More information: Maximum length: 64 characters + * + * @return self */ public function setTransactionId($transactionId) { - $this->transactionId = $transactionId; + $this->container['transactionId'] = $transactionId; + + return $this; } /** - * @return mixed + * Gets transactionType + * + * @return \request\model\TransactionType */ public function getTransactionType() { - return $this->transactionType; + return $this->container['transactionType']; } /** - * @param mixed $transactionType + * Sets transactionType + * + * @param \request\model\TransactionType $transactionType transactionType + * + * @return self */ public function setTransactionType($transactionType) { - $this->transactionType = $transactionType; + $this->container['transactionType'] = $transactionType; + + return $this; } /** - * @return mixed + * Gets transactionStatus + * + * @return \request\model\TransactionStatusType */ public function getTransactionStatus() { - return $this->transactionStatus; + return $this->container['transactionStatus']; } /** - * @param mixed $transactionStatus + * Sets transactionStatus + * + * @param \request\model\TransactionStatusType $transactionStatus transactionStatus + * + * @return self */ public function setTransactionStatus($transactionStatus) { - $this->transactionStatus = $transactionStatus; + $this->container['transactionStatus'] = $transactionStatus; + + return $this; } /** - * @return mixed + * Gets transactionAmount + * + * @return \request\model\Amount */ public function getTransactionAmount() { - return $this->transactionAmount; + return $this->container['transactionAmount']; } /** - * @param mixed $transactionAmount + * Sets transactionAmount + * + * @param \request\model\Amount $transactionAmount transactionAmount + * + * @return self */ public function setTransactionAmount($transactionAmount) { - $this->transactionAmount = $transactionAmount; + $this->container['transactionAmount'] = $transactionAmount; + + return $this; } /** - * @return mixed + * Gets transactionRequestId + * + * @return string */ public function getTransactionRequestId() { - return $this->transactionRequestId; + return $this->container['transactionRequestId']; } /** - * @param mixed $transactionRequestId + * Sets transactionRequestId + * + * @param string $transactionRequestId The unique ID that is assigned by the merchant to identify the transaction request. When the transaction type is REFUND, the value of this parameter is identical to refundRequestId. When the transaction type is CAPTURE, the value of this parameter is identical to captureRequestId. More information: Maximum length: 64 characters + * + * @return self */ public function setTransactionRequestId($transactionRequestId) { - $this->transactionRequestId = $transactionRequestId; + $this->container['transactionRequestId'] = $transactionRequestId; + + return $this; } /** - * @return mixed + * Gets transactionTime + * + * @return string|null */ public function getTransactionTime() { - return $this->transactionTime; + return $this->container['transactionTime']; } /** - * @param mixed $transactionTime + * Sets transactionTime + * + * @param string|null $transactionTime transactionTime + * + * @return self */ public function setTransactionTime($transactionTime) { - $this->transactionTime = $transactionTime; + $this->container['transactionTime'] = $transactionTime; + + return $this; + } + + /** + * Gets acquirerInfo + * + * @return \request\model\AcquirerInfo|null + */ + public function getAcquirerInfo() + { + return $this->container['acquirerInfo']; + } + + /** + * Sets acquirerInfo + * + * @param \request\model\AcquirerInfo|null $acquirerInfo acquirerInfo + * + * @return self + */ + public function setAcquirerInfo($acquirerInfo) + { + $this->container['acquirerInfo'] = $acquirerInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); } -} \ No newline at end of file + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/TransactionStatusType.php b/model/TransactionStatusType.php index 535f0b2..d77959c 100644 --- a/model/TransactionStatusType.php +++ b/model/TransactionStatusType.php @@ -1,11 +1,34 @@ + */ +class TransferFromDetail implements ModelInterface, ArrayAccess, \JsonSerializable { - public $transferFromMethod; - public $transferFromAmount; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransferFromDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transferFromMethod' => '\request\model\PaymentMethod', + 'transferFromAmount' => '\request\model\Amount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transferFromMethod' => null, + 'transferFromAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transferFromMethod' => false, + 'transferFromAmount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transferFromMethod' => 'transferFromMethod', + 'transferFromAmount' => 'transferFromAmount' + ]; /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transferFromMethod' => 'setTransferFromMethod', + 'transferFromAmount' => 'setTransferFromAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transferFromMethod' => 'getTransferFromMethod', + 'transferFromAmount' => 'getTransferFromAmount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transferFromMethod', $data ?? [], null); + $this->setIfExists('transferFromAmount', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['transferFromMethod'] === null) { + $invalidProperties[] = "'transferFromMethod' can't be null"; + } + if ($this->container['transferFromAmount'] === null) { + $invalidProperties[] = "'transferFromAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transferFromMethod + * + * @return \request\model\PaymentMethod */ public function getTransferFromMethod() { - return $this->transferFromMethod; + return $this->container['transferFromMethod']; } /** - * @param mixed $transferFromMethod + * Sets transferFromMethod + * + * @param \request\model\PaymentMethod $transferFromMethod transferFromMethod + * + * @return self */ - public function setTransferFromMethod($transferFromMethod) + public function setTransferFromMethod($transferFromMethod) { - $this->transferFromMethod = $transferFromMethod; + $this->container['transferFromMethod'] = $transferFromMethod; + + return $this; } /** - * @return mixed + * Gets transferFromAmount + * + * @return \request\model\Amount */ public function getTransferFromAmount() { - return $this->transferFromAmount; + return $this->container['transferFromAmount']; } /** - * @param mixed $transferFromAmount + * Sets transferFromAmount + * + * @param \request\model\Amount $transferFromAmount transferFromAmount + * + * @return self */ - public function setTransferFromAmount($transferFromAmount) + public function setTransferFromAmount($transferFromAmount) { - $this->transferFromAmount = $transferFromAmount; + $this->container['transferFromAmount'] = $transferFromAmount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/TransferToDetail.php b/model/TransferToDetail.php index 7f8fb2d..46e4ec0 100644 --- a/model/TransferToDetail.php +++ b/model/TransferToDetail.php @@ -1,130 +1,605 @@ + */ +class TransferToDetail implements ModelInterface, ArrayAccess, \JsonSerializable { - public $transferToMethod; - public $transferToCurrency; - public $feeAmount; - public $actualTransferToAmount; - public $purposeCode; - public $transferNotifyUrl; - public $transferRemark; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransferToDetail'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transferToMethod' => '\request\model\PaymentMethod', + 'transferToCurrency' => 'string', + 'feeAmount' => '\request\model\Amount', + 'actualTransferToAmount' => '\request\model\Amount', + 'purposeCode' => 'string', + 'transferNotifyUrl' => 'string', + 'transferRemark' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transferToMethod' => null, + 'transferToCurrency' => null, + 'feeAmount' => null, + 'actualTransferToAmount' => null, + 'purposeCode' => null, + 'transferNotifyUrl' => null, + 'transferRemark' => null + ]; /** - * @return mixed + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transferToMethod' => false, + 'transferToCurrency' => false, + 'feeAmount' => false, + 'actualTransferToAmount' => false, + 'purposeCode' => false, + 'transferNotifyUrl' => false, + 'transferRemark' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array */ - public function getTransferToMethod() + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transferToMethod' => 'transferToMethod', + 'transferToCurrency' => 'transferToCurrency', + 'feeAmount' => 'feeAmount', + 'actualTransferToAmount' => 'actualTransferToAmount', + 'purposeCode' => 'purposeCode', + 'transferNotifyUrl' => 'transferNotifyUrl', + 'transferRemark' => 'transferRemark' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transferToMethod' => 'setTransferToMethod', + 'transferToCurrency' => 'setTransferToCurrency', + 'feeAmount' => 'setFeeAmount', + 'actualTransferToAmount' => 'setActualTransferToAmount', + 'purposeCode' => 'setPurposeCode', + 'transferNotifyUrl' => 'setTransferNotifyUrl', + 'transferRemark' => 'setTransferRemark' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transferToMethod' => 'getTransferToMethod', + 'transferToCurrency' => 'getTransferToCurrency', + 'feeAmount' => 'getFeeAmount', + 'actualTransferToAmount' => 'getActualTransferToAmount', + 'purposeCode' => 'getPurposeCode', + 'transferNotifyUrl' => 'getTransferNotifyUrl', + 'transferRemark' => 'getTransferRemark' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() { - return $this->transferToMethod; + return self::$openAPIModelName; } + /** - * @param mixed $transferToMethod + * Associative array for storing property values + * + * @var mixed[] */ - public function setTransferToMethod($transferToMethod) + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transferToMethod', $data ?? [], null); + $this->setIfExists('transferToCurrency', $data ?? [], null); + $this->setIfExists('feeAmount', $data ?? [], null); + $this->setIfExists('actualTransferToAmount', $data ?? [], null); + $this->setIfExists('purposeCode', $data ?? [], null); + $this->setIfExists('transferNotifyUrl', $data ?? [], null); + $this->setIfExists('transferRemark', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - $this->transferToMethod = $transferToMethod; + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + if ($this->container['transferToMethod'] === null) { + $invalidProperties[] = "'transferToMethod' can't be null"; + } + if ($this->container['transferToCurrency'] === null) { + $invalidProperties[] = "'transferToCurrency' can't be null"; + } + if ($this->container['purposeCode'] === null) { + $invalidProperties[] = "'purposeCode' can't be null"; + } + return $invalidProperties; + } /** - * @return mixed + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transferToMethod + * + * @return \request\model\PaymentMethod + */ + public function getTransferToMethod() + { + return $this->container['transferToMethod']; + } + + /** + * Sets transferToMethod + * + * @param \request\model\PaymentMethod $transferToMethod transferToMethod + * + * @return self + */ + public function setTransferToMethod($transferToMethod) + { + $this->container['transferToMethod'] = $transferToMethod; + + return $this; + } + + /** + * Gets transferToCurrency + * + * @return string */ public function getTransferToCurrency() { - return $this->transferToCurrency; + return $this->container['transferToCurrency']; } /** - * @param mixed $transferToCurrency + * Sets transferToCurrency + * + * @param string $transferToCurrency A 3-character ISO-4217 currency code representing the currency that the beneficiary collects. More information: Maximum length: 3 characters + * + * @return self */ - public function setTransferToCurrency($transferToCurrency) + public function setTransferToCurrency($transferToCurrency) { - $this->transferToCurrency = $transferToCurrency; + $this->container['transferToCurrency'] = $transferToCurrency; + + return $this; } /** - * @return mixed + * Gets feeAmount + * + * @return \request\model\Amount|null */ public function getFeeAmount() { - return $this->feeAmount; + return $this->container['feeAmount']; } /** - * @param mixed $feeAmount + * Sets feeAmount + * + * @param \request\model\Amount|null $feeAmount feeAmount + * + * @return self */ - public function setFeeAmount($feeAmount) + public function setFeeAmount($feeAmount) { - $this->feeAmount = $feeAmount; + $this->container['feeAmount'] = $feeAmount; + + return $this; } /** - * @return mixed + * Gets actualTransferToAmount + * + * @return \request\model\Amount|null */ public function getActualTransferToAmount() { - return $this->actualTransferToAmount; + return $this->container['actualTransferToAmount']; } /** - * @param mixed $actualTransferToAmount + * Sets actualTransferToAmount + * + * @param \request\model\Amount|null $actualTransferToAmount actualTransferToAmount + * + * @return self */ - public function setActualTransferToAmount($actualTransferToAmount) + public function setActualTransferToAmount($actualTransferToAmount) { - $this->actualTransferToAmount = $actualTransferToAmount; + $this->container['actualTransferToAmount'] = $actualTransferToAmount; + + return $this; } /** - * @return mixed + * Gets purposeCode + * + * @return string */ public function getPurposeCode() { - return $this->purposeCode; + return $this->container['purposeCode']; } /** - * @param mixed $purposeCode + * Sets purposeCode + * + * @param string $purposeCode Defines the purpose of the transfer. The value of this parameter is fixed to GSD, which means goods bought or sold. More information: Maximum length: 3 characters + * + * @return self */ - public function setPurposeCode($purposeCode) + public function setPurposeCode($purposeCode) { - $this->purposeCode = $purposeCode; + $this->container['purposeCode'] = $purposeCode; + + return $this; } /** - * @return mixed + * Gets transferNotifyUrl + * + * @return string|null */ public function getTransferNotifyUrl() { - return $this->transferNotifyUrl; + return $this->container['transferNotifyUrl']; } /** - * @param mixed $transferNotifyUrl + * Sets transferNotifyUrl + * + * @param string|null $transferNotifyUrl If you specify this parameter, Antom will send the transfer result notification to this URL. The URL must be either specified in the request or set in Antom Dashboard. Specify this parameter if you want to receive an asynchronous notification of the transfer result. If this URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 2048 characters + * + * @return self */ - public function setTransferNotifyUrl($transferNotifyUrl) + public function setTransferNotifyUrl($transferNotifyUrl) { - $this->transferNotifyUrl = $transferNotifyUrl; + $this->container['transferNotifyUrl'] = $transferNotifyUrl; + + return $this; } /** - * @return mixed + * Gets transferRemark + * + * @return string|null */ public function getTransferRemark() { - return $this->transferRemark; + return $this->container['transferRemark']; + } + + /** + * Sets transferRemark + * + * @param string|null $transferRemark Remark information for the transfer. Specify this parameter if you want to provide additional remarks or relevant information regarding the payout. More information: Maximum length: 1024 characters + * + * @return self + */ + public function setTransferRemark($transferRemark) + { + $this->container['transferRemark'] = $transferRemark; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } /** - * @param mixed $transferRemark + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null */ - public function setTransferRemark($transferRemark) + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - $this->transferRemark = $transferRemark; + return $this->container[$offset] ?? null; } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Transit.php b/model/Transit.php index 930a16c..eb90f22 100644 --- a/model/Transit.php +++ b/model/Transit.php @@ -1,61 +1,472 @@ + */ +class Transit implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Transit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transitType' => '\request\model\TransitType', + 'legs' => '\request\model\Leg[]', + 'passengers' => '\request\model\Passenger[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transitType' => null, + 'legs' => null, + 'passengers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transitType' => false, + 'legs' => false, + 'passengers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transitType' => 'transitType', + 'legs' => 'legs', + 'passengers' => 'passengers' + ]; - public $transitType; - public $legs; - public $passengers; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transitType' => 'setTransitType', + 'legs' => 'setLegs', + 'passengers' => 'setPassengers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transitType' => 'getTransitType', + 'legs' => 'getLegs', + 'passengers' => 'getPassengers' + ]; /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transitType', $data ?? [], null); + $this->setIfExists('legs', $data ?? [], null); + $this->setIfExists('passengers', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transitType + * + * @return \request\model\TransitType|null */ public function getTransitType() { - return $this->transitType; + return $this->container['transitType']; } /** - * @param mixed $transitType + * Sets transitType + * + * @param \request\model\TransitType|null $transitType transitType + * + * @return self */ - public function setTransitType($transitType) + public function setTransitType($transitType) { - $this->transitType = $transitType; + $this->container['transitType'] = $transitType; + + return $this; } /** - * @return mixed + * Gets legs + * + * @return \request\model\Leg[]|null */ public function getLegs() { - return $this->legs; + return $this->container['legs']; } /** - * @param mixed $legs + * Sets legs + * + * @param \request\model\Leg[]|null $legs Information about sections of the trip, including departure time, arrival time, departure address, arrival address, transportation company name, carrier code and service type. More information: Maximum size: 10 elements + * + * @return self */ - public function setLegs($legs) + public function setLegs($legs) { - $this->legs = $legs; + $this->container['legs'] = $legs; + + return $this; } /** - * @return mixed + * Gets passengers + * + * @return \request\model\Passenger[]|null */ public function getPassengers() { - return $this->passengers; + return $this->container['passengers']; } /** - * @param mixed $passengers + * Sets passengers + * + * @param \request\model\Passenger[]|null $passengers Information about the passenger of the trip, including the passenger names, passenger email and phone number. More information: Maximum size: 100 elements + * + * @return self */ - public function setPassengers($passengers) + public function setPassengers($passengers) { - $this->passengers = $passengers; + $this->container['passengers'] = $passengers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/TransitType.php b/model/TransitType.php index 860abe7..0691a6c 100644 --- a/model/TransitType.php +++ b/model/TransitType.php @@ -1,12 +1,33 @@ + */ +class Trial implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Trial'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'trialStartPeriod' => 'int', + 'trialAmount' => '\request\model\Amount', + 'trialEndPeriod' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'trialStartPeriod' => null, + 'trialAmount' => null, + 'trialEndPeriod' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'trialStartPeriod' => true, + 'trialAmount' => false, + 'trialEndPeriod' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'trialStartPeriod' => 'trialStartPeriod', + 'trialAmount' => 'trialAmount', + 'trialEndPeriod' => 'trialEndPeriod' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'trialStartPeriod' => 'setTrialStartPeriod', + 'trialAmount' => 'setTrialAmount', + 'trialEndPeriod' => 'setTrialEndPeriod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'trialStartPeriod' => 'getTrialStartPeriod', + 'trialAmount' => 'getTrialAmount', + 'trialEndPeriod' => 'getTrialEndPeriod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $trialStartPeriod; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('trialStartPeriod', $data ?? [], null); + $this->setIfExists('trialAmount', $data ?? [], null); + $this->setIfExists('trialEndPeriod', $data ?? [], null); - public $trialAmount; + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['trialStartPeriod'] === null) { + $invalidProperties[] = "'trialStartPeriod' can't be null"; + } + if ($this->container['trialAmount'] === null) { + $invalidProperties[] = "'trialAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } - public $trialEndPeriod; /** - * @return mixed + * Gets trialStartPeriod + * + * @return int */ public function getTrialStartPeriod() { - return $this->trialStartPeriod; + return $this->container['trialStartPeriod']; } /** - * @param mixed $trialStartPeriod + * Sets trialStartPeriod + * + * @param int $trialStartPeriod The start subscription period of the trial. For example, if the trial starts from the first subscription period, specify this parameter as 1. More information: Value range: 1 - unlimited + * + * @return self */ public function setTrialStartPeriod($trialStartPeriod) { - $this->trialStartPeriod = $trialStartPeriod; + $this->container['trialStartPeriod'] = $trialStartPeriod; + + return $this; } /** - * @return mixed + * Gets trialAmount + * + * @return \request\model\Amount */ public function getTrialAmount() { - return $this->trialAmount; + return $this->container['trialAmount']; } /** - * @param mixed $trialAmount + * Sets trialAmount + * + * @param \request\model\Amount $trialAmount trialAmount + * + * @return self */ - public function setTrialAmount($trialAmount) + public function setTrialAmount($trialAmount) { - $this->trialAmount = $trialAmount; + $this->container['trialAmount'] = $trialAmount; + + return $this; } /** - * @return mixed + * Gets trialEndPeriod + * + * @return int|null */ public function getTrialEndPeriod() { - return $this->trialEndPeriod; + return $this->container['trialEndPeriod']; } /** - * @param mixed $trialEndPeriod + * Sets trialEndPeriod + * + * @param int|null $trialEndPeriod The end subscription period of the trial. For example, if the trial ends at the third subscription period, specify this parameter as 3. Note: Specify this parameter if the end subscription period is different from the start subscription period. If you leave this parameter empty, the default value of this parameter is the same as the value of trialStartPeriod. More information: Value range: 1 - unlimited + * + * @return self */ - public function setTrialEndPeriod($trialEndPeriod) + public function setTrialEndPeriod($trialEndPeriod) { - $this->trialEndPeriod = $trialEndPeriod; + $this->container['trialEndPeriod'] = $trialEndPeriod; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/UserName.php b/model/UserName.php index c2a8c73..6f8d9b3 100644 --- a/model/UserName.php +++ b/model/UserName.php @@ -1,77 +1,503 @@ + */ +class UserName implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UserName'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'firstName' => 'string', + 'middleName' => 'string', + 'lastName' => 'string', + 'fullName' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'firstName' => null, + 'middleName' => null, + 'lastName' => null, + 'fullName' => null + ]; - public $firstName; - public $middleName; - public $lastName; - public $fullName; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'firstName' => false, + 'middleName' => false, + 'lastName' => false, + 'fullName' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; /** - * @return String + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'firstName' => 'firstName', + 'middleName' => 'middleName', + 'lastName' => 'lastName', + 'fullName' => 'fullName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'firstName' => 'setFirstName', + 'middleName' => 'setMiddleName', + 'lastName' => 'setLastName', + 'fullName' => 'setFullName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'firstName' => 'getFirstName', + 'middleName' => 'getMiddleName', + 'lastName' => 'getLastName', + 'fullName' => 'getFullName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('middleName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('fullName', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets firstName + * + * @return string|null */ public function getFirstName() { - return $this->firstName; + return $this->container['firstName']; } /** - * @param String $firstName + * Sets firstName + * + * @param string|null $firstName firstName + * + * @return self */ public function setFirstName($firstName) { - $this->firstName = $firstName; + $this->container['firstName'] = $firstName; + + return $this; } /** - * @return String + * Gets middleName + * + * @return string|null */ public function getMiddleName() { - return $this->middleName; + return $this->container['middleName']; } /** - * @param String $middleName + * Sets middleName + * + * @param string|null $middleName middleName + * + * @return self */ public function setMiddleName($middleName) { - $this->middleName = $middleName; + $this->container['middleName'] = $middleName; + + return $this; } /** - * @return String + * Gets lastName + * + * @return string|null */ public function getLastName() { - return $this->lastName; + return $this->container['lastName']; } /** - * @param String $lastName + * Sets lastName + * + * @param string|null $lastName lastName + * + * @return self */ public function setLastName($lastName) { - $this->lastName = $lastName; + $this->container['lastName'] = $lastName; + + return $this; } /** - * @return String + * Gets fullName + * + * @return string|null */ public function getFullName() { - return $this->fullName; + return $this->container['fullName']; } /** - * @param String $fullName + * Sets fullName + * + * @param string|null $fullName fullName + * + * @return self */ public function setFullName($fullName) { - $this->fullName = $fullName; + $this->container['fullName'] = $fullName; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/Wallet.php b/model/Wallet.php new file mode 100644 index 0000000..e45039a --- /dev/null +++ b/model/Wallet.php @@ -0,0 +1,534 @@ + + */ +class Wallet implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Wallet'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'accountNo' => 'string', + 'accountHolderName' => '\request\model\UserName', + 'phoneNo' => 'string', + 'email' => 'string', + 'billingAddress' => '\request\model\Address' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'accountNo' => null, + 'accountHolderName' => null, + 'phoneNo' => null, + 'email' => null, + 'billingAddress' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'accountNo' => false, + 'accountHolderName' => false, + 'phoneNo' => false, + 'email' => false, + 'billingAddress' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'accountNo' => 'accountNo', + 'accountHolderName' => 'accountHolderName', + 'phoneNo' => 'phoneNo', + 'email' => 'email', + 'billingAddress' => 'billingAddress' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'accountNo' => 'setAccountNo', + 'accountHolderName' => 'setAccountHolderName', + 'phoneNo' => 'setPhoneNo', + 'email' => 'setEmail', + 'billingAddress' => 'setBillingAddress' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'accountNo' => 'getAccountNo', + 'accountHolderName' => 'getAccountHolderName', + 'phoneNo' => 'getPhoneNo', + 'email' => 'getEmail', + 'billingAddress' => 'getBillingAddress' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('accountNo', $data ?? [], null); + $this->setIfExists('accountHolderName', $data ?? [], null); + $this->setIfExists('phoneNo', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('billingAddress', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets accountNo + * + * @return string|null + */ + public function getAccountNo() + { + return $this->container['accountNo']; + } + + /** + * Sets accountNo + * + * @param string|null $accountNo accountNo + * + * @return self + */ + public function setAccountNo($accountNo) + { + $this->container['accountNo'] = $accountNo; + + return $this; + } + + /** + * Gets accountHolderName + * + * @return \request\model\UserName|null + */ + public function getAccountHolderName() + { + return $this->container['accountHolderName']; + } + + /** + * Sets accountHolderName + * + * @param \request\model\UserName|null $accountHolderName accountHolderName + * + * @return self + */ + public function setAccountHolderName($accountHolderName) + { + $this->container['accountHolderName'] = $accountHolderName; + + return $this; + } + + /** + * Gets phoneNo + * + * @return string|null + */ + public function getPhoneNo() + { + return $this->container['phoneNo']; + } + + /** + * Sets phoneNo + * + * @param string|null $phoneNo phoneNo + * + * @return self + */ + public function setPhoneNo($phoneNo) + { + $this->container['phoneNo'] = $phoneNo; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email email + * + * @return self + */ + public function setEmail($email) + { + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets billingAddress + * + * @return \request\model\Address|null + */ + public function getBillingAddress() + { + return $this->container['billingAddress']; + } + + /** + * Sets billingAddress + * + * @param \request\model\Address|null $billingAddress billingAddress + * + * @return self + */ + public function setBillingAddress($billingAddress) + { + $this->container['billingAddress'] = $billingAddress; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/model/WebSite.php b/model/WebSite.php index c2cc48f..42219c8 100644 --- a/model/WebSite.php +++ b/model/WebSite.php @@ -1,80 +1,506 @@ + */ +class WebSite implements ModelInterface, ArrayAccess, \JsonSerializable { - public $name; - public $url; - public $desc; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WebSite'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'url' => 'string', + 'desc' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'url' => null, + 'desc' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'name' => false, + 'url' => false, + 'desc' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'url' => 'url', + 'desc' => 'desc', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'url' => 'setUrl', + 'desc' => 'setDesc', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'url' => 'getUrl', + 'desc' => 'getDesc', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $type; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('desc', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + + } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null */ public function getName() { - return $this->name; + return $this->container['name']; } /** - * @param mixed $name + * Sets name + * + * @param string|null $name name + * + * @return self */ public function setName($name) { - $this->name = $name; + $this->container['name'] = $name; + + return $this; } /** - * @return mixed + * Gets url + * + * @return string */ public function getUrl() { - return $this->url; + return $this->container['url']; } /** - * @param mixed $url + * Sets url + * + * @param string $url The URL of the merchant website. More information: Maximum length: 2048 characters + * + * @return self */ public function setUrl($url) { - $this->url = $url; + $this->container['url'] = $url; + + return $this; } /** - * @return mixed + * Gets desc + * + * @return string|null */ public function getDesc() { - return $this->desc; + return $this->container['desc']; } /** - * @param mixed $desc + * Sets desc + * + * @param string|null $desc desc + * + * @return self */ public function setDesc($desc) { - $this->desc = $desc; + $this->container['desc'] = $desc; + + return $this; } /** - * @return mixed + * Gets type + * + * @return string|null */ public function getType() { - return $this->type; + return $this->container['type']; } /** - * @param mixed $type + * Sets type + * + * @param string|null $type Website type. Valid values are: COMPANY_INTRODUCE: the website that introduces company information. Specify websites.type as COMPANY_INTRODUCE when the value of paymentMethodType is TRUEMONEY. TRADING: the trading website. The same applies when the value is empty or you do not specify this parameter. More information: Maximum length: 32 characters + * + * @return self */ public function setType($type) { - $this->type = $type; + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/auth/AlipayAuthApplyTokenRequest.php b/request/auth/AlipayAuthApplyTokenRequest.php index a268241..09bcc83 100644 --- a/request/auth/AlipayAuthApplyTokenRequest.php +++ b/request/auth/AlipayAuthApplyTokenRequest.php @@ -1,122 +1,572 @@ + */ +class AlipayAuthApplyTokenRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAuthApplyTokenRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'grantType' => '\request\model\GrantType', + 'customerBelongsTo' => '\request\model\CustomerBelongsTo', + 'authCode' => 'string', + 'refreshToken' => 'string', + 'extendInfo' => 'string', + 'merchantRegion' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'grantType' => null, + 'customerBelongsTo' => null, + 'authCode' => null, + 'refreshToken' => null, + 'extendInfo' => null, + 'merchantRegion' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'grantType' => false, + 'customerBelongsTo' => false, + 'authCode' => false, + 'refreshToken' => false, + 'extendInfo' => false, + 'merchantRegion' => false + ]; - public $grantType; - public $customerBelongsTo; - public $authCode; - public $refreshToken; - public $extendInfo; - public $merchantRegion; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } - function __construct() + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() { - $this->setPath(AntomPathConstants::AUTH_APPLY_TOKEN_PATH); + return self::$openAPIFormats; } /** - * @return mixed + * Array of nullable properties + * + * @return array */ - public function getMerchantRegion() + protected static function openAPINullables(): array { - return $this->merchantRegion; + return self::$openAPINullables; } /** - * @param mixed $merchantRegion + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public function setMerchantRegion($merchantRegion) + private function getOpenAPINullablesSetToNull(): array { - $this->merchantRegion = $merchantRegion; + return $this->openAPINullablesSetToNull; } + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'grantType' => 'grantType', + 'customerBelongsTo' => 'customerBelongsTo', + 'authCode' => 'authCode', + 'refreshToken' => 'refreshToken', + 'extendInfo' => 'extendInfo', + 'merchantRegion' => 'merchantRegion' + ]; /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'grantType' => 'setGrantType', + 'customerBelongsTo' => 'setCustomerBelongsTo', + 'authCode' => 'setAuthCode', + 'refreshToken' => 'setRefreshToken', + 'extendInfo' => 'setExtendInfo', + 'merchantRegion' => 'setMerchantRegion' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'grantType' => 'getGrantType', + 'customerBelongsTo' => 'getCustomerBelongsTo', + 'authCode' => 'getAuthCode', + 'refreshToken' => 'getRefreshToken', + 'extendInfo' => 'getExtendInfo', + 'merchantRegion' => 'getMerchantRegion' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('grantType', $data ?? [], null); + $this->setIfExists('customerBelongsTo', $data ?? [], null); + $this->setIfExists('authCode', $data ?? [], null); + $this->setIfExists('refreshToken', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('merchantRegion', $data ?? [], null); + + $this->setPath("/ams/api/v1/authorizations/applyToken"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['grantType'] === null) { + $invalidProperties[] = "'grantType' can't be null"; + } + if ($this->container['customerBelongsTo'] === null) { + $invalidProperties[] = "'customerBelongsTo' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets grantType + * + * @return \request\model\GrantType */ public function getGrantType() { - return $this->grantType; + return $this->container['grantType']; } /** - * @param mixed $grantType + * Sets grantType + * + * @param \request\model\GrantType $grantType grantType + * + * @return self */ public function setGrantType($grantType) { - $this->grantType = $grantType; + $this->container['grantType'] = $grantType; + + return $this; } /** - * @return mixed + * Gets customerBelongsTo + * + * @return \request\model\CustomerBelongsTo */ public function getCustomerBelongsTo() { - return $this->customerBelongsTo; + return $this->container['customerBelongsTo']; } /** - * @param mixed $customerBelongsTo + * Sets customerBelongsTo + * + * @param \request\model\CustomerBelongsTo $customerBelongsTo customerBelongsTo + * + * @return self */ public function setCustomerBelongsTo($customerBelongsTo) { - $this->customerBelongsTo = $customerBelongsTo; + $this->container['customerBelongsTo'] = $customerBelongsTo; + + return $this; } /** - * @return mixed + * Gets authCode + * + * @return string|null */ public function getAuthCode() { - return $this->authCode; + return $this->container['authCode']; } /** - * @param mixed $authCode + * Sets authCode + * + * @param string|null $authCode The authorization code, used for getting an access token. The value of this field is obtained from the reconstructed redirection URL returned by the wallet. Note: Specify this field when the value of grantType is AUTHORIZATION_CODE. More information: Maximum length: 128 characters + * + * @return self */ public function setAuthCode($authCode) { - $this->authCode = $authCode; + $this->container['authCode'] = $authCode; + + return $this; } /** - * @return mixed + * Gets refreshToken + * + * @return string|null */ public function getRefreshToken() { - return $this->refreshToken; + return $this->container['refreshToken']; } /** - * @param mixed $refreshToken + * Sets refreshToken + * + * @param string|null $refreshToken The refresh token, used for getting a new access token when the access token is about to expire. The refresh token is obtained from the response of the successfully called applyToken API. Note: Specify this field when the value of grantType is REFRESH_TOKEN. More information: Maximum length: 128 characters + * + * @return self */ public function setRefreshToken($refreshToken) { - $this->refreshToken = $refreshToken; + $this->container['refreshToken'] = $refreshToken; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets merchantRegion + * + * @return string|null + */ + public function getMerchantRegion() + { + return $this->container['merchantRegion']; + } + + /** + * Sets merchantRegion + * + * @param string|null $merchantRegion The country or region where the merchant or secondary merchant operates the business. The parameter is a 2-letter country/region code that follows ISO 3166 Country Codes standard. Only US, JP, PK, SG are supported now. Note: This field is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + * + * @return self + */ + public function setMerchantRegion($merchantRegion) + { + $this->container['merchantRegion'] = $merchantRegion; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/auth/AlipayAuthConsultRequest.php b/request/auth/AlipayAuthConsultRequest.php index ef41237..1662dcf 100644 --- a/request/auth/AlipayAuthConsultRequest.php +++ b/request/auth/AlipayAuthConsultRequest.php @@ -1,206 +1,767 @@ + */ +class AlipayAuthConsultRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAuthConsultRequest'; - public $customerBelongsTo; - public $authClientId; - public $authRedirectUrl; - public $scopes; - public $authState; - public $terminalType; - public $osType; - public $osVersion; - public $extendInfo; - public $merchantRegion; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customerBelongsTo' => '\request\model\CustomerBelongsTo', + 'authClientId' => 'string', + 'authRedirectUrl' => 'string', + 'scopes' => '\request\model\ScopeType[]', + 'authState' => 'string', + 'terminalType' => '\request\model\TerminalType', + 'osType' => '\request\model\OsType', + 'osVersion' => 'string', + 'extendInfo' => 'string', + 'merchantRegion' => 'string', + 'recurringPayment' => 'bool', + 'authMetaData' => '\request\model\AuthMetaData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customerBelongsTo' => null, + 'authClientId' => null, + 'authRedirectUrl' => null, + 'scopes' => null, + 'authState' => null, + 'terminalType' => null, + 'osType' => null, + 'osVersion' => null, + 'extendInfo' => null, + 'merchantRegion' => null, + 'recurringPayment' => null, + 'authMetaData' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'customerBelongsTo' => false, + 'authClientId' => false, + 'authRedirectUrl' => false, + 'scopes' => false, + 'authState' => false, + 'terminalType' => false, + 'osType' => false, + 'osVersion' => false, + 'extendInfo' => false, + 'merchantRegion' => false, + 'recurringPayment' => false, + 'authMetaData' => false + ]; - public $authMetaData; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - function __construct() + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() { - $this->setPath(\Model\AntomPathConstants::AUTH_CONSULT_PATH); + return self::$openAPITypes; } /** - * @return mixed + * Array of property to format mappings. Used for (de)serialization + * + * @return array */ - public function getAuthMetaData() + public static function openAPIFormats() { - return $this->authMetaData; + return self::$openAPIFormats; } /** - * @param mixed $authMetaData + * Array of nullable properties + * + * @return array */ - public function setAuthMetaData($authMetaData) + protected static function openAPINullables(): array { - $this->authMetaData = $authMetaData; + return self::$openAPINullables; } + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } /** - * @return mixed + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public function getMerchantRegion() + public static function isNullable(string $property): bool { - return $this->merchantRegion; + return self::openAPINullables()[$property] ?? false; } /** - * @param mixed $merchantRegion + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public function setMerchantRegion($merchantRegion) + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customerBelongsTo' => 'customerBelongsTo', + 'authClientId' => 'authClientId', + 'authRedirectUrl' => 'authRedirectUrl', + 'scopes' => 'scopes', + 'authState' => 'authState', + 'terminalType' => 'terminalType', + 'osType' => 'osType', + 'osVersion' => 'osVersion', + 'extendInfo' => 'extendInfo', + 'merchantRegion' => 'merchantRegion', + 'recurringPayment' => 'recurringPayment', + 'authMetaData' => 'authMetaData' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customerBelongsTo' => 'setCustomerBelongsTo', + 'authClientId' => 'setAuthClientId', + 'authRedirectUrl' => 'setAuthRedirectUrl', + 'scopes' => 'setScopes', + 'authState' => 'setAuthState', + 'terminalType' => 'setTerminalType', + 'osType' => 'setOsType', + 'osVersion' => 'setOsVersion', + 'extendInfo' => 'setExtendInfo', + 'merchantRegion' => 'setMerchantRegion', + 'recurringPayment' => 'setRecurringPayment', + 'authMetaData' => 'setAuthMetaData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customerBelongsTo' => 'getCustomerBelongsTo', + 'authClientId' => 'getAuthClientId', + 'authRedirectUrl' => 'getAuthRedirectUrl', + 'scopes' => 'getScopes', + 'authState' => 'getAuthState', + 'terminalType' => 'getTerminalType', + 'osType' => 'getOsType', + 'osVersion' => 'getOsVersion', + 'extendInfo' => 'getExtendInfo', + 'merchantRegion' => 'getMerchantRegion', + 'recurringPayment' => 'getRecurringPayment', + 'authMetaData' => 'getAuthMetaData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('customerBelongsTo', $data ?? [], null); + $this->setIfExists('authClientId', $data ?? [], null); + $this->setIfExists('authRedirectUrl', $data ?? [], null); + $this->setIfExists('scopes', $data ?? [], null); + $this->setIfExists('authState', $data ?? [], null); + $this->setIfExists('terminalType', $data ?? [], null); + $this->setIfExists('osType', $data ?? [], null); + $this->setIfExists('osVersion', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('merchantRegion', $data ?? [], null); + $this->setIfExists('recurringPayment', $data ?? [], null); + $this->setIfExists('authMetaData', $data ?? [], null); + + $this->setPath("/ams/api/v1/authorizations/consult"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['customerBelongsTo'] === null) { + $invalidProperties[] = "'customerBelongsTo' can't be null"; + } + if ($this->container['authRedirectUrl'] === null) { + $invalidProperties[] = "'authRedirectUrl' can't be null"; + } + if ($this->container['scopes'] === null) { + $invalidProperties[] = "'scopes' can't be null"; + } + if ($this->container['authState'] === null) { + $invalidProperties[] = "'authState' can't be null"; + } + if ($this->container['terminalType'] === null) { + $invalidProperties[] = "'terminalType' 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() { - $this->merchantRegion = $merchantRegion; + return count($this->listInvalidProperties()) === 0; } /** - * @return mixed + * Gets customerBelongsTo + * + * @return \request\model\CustomerBelongsTo */ public function getCustomerBelongsTo() { - return $this->customerBelongsTo; + return $this->container['customerBelongsTo']; } /** - * @param mixed $customerBelongsTo + * Sets customerBelongsTo + * + * @param \request\model\CustomerBelongsTo $customerBelongsTo customerBelongsTo + * + * @return self */ public function setCustomerBelongsTo($customerBelongsTo) { - $this->customerBelongsTo = $customerBelongsTo; + $this->container['customerBelongsTo'] = $customerBelongsTo; + + return $this; } /** - * @return mixed + * Gets authClientId + * + * @return string|null */ public function getAuthClientId() { - return $this->authClientId; + return $this->container['authClientId']; } /** - * @param mixed $authClientId + * Sets authClientId + * + * @param string|null $authClientId The unique ID of the secondary merchant to which the user grants resource access permission. The value is specified by the acquirer and needs to be registered in Antom. Notes: Specify this field if you are an acquirer with secondary merchants. For an Alipay+ payment methods, the value of this field is the same as the value of the referenceMerchantId field in the pay (Auto Debit) interface. More information: Maximum length: 64 characters + * + * @return self */ public function setAuthClientId($authClientId) { - $this->authClientId = $authClientId; + $this->container['authClientId'] = $authClientId; + + return $this; } /** - * @return mixed + * Gets authRedirectUrl + * + * @return string */ public function getAuthRedirectUrl() { - return $this->authRedirectUrl; + return $this->container['authRedirectUrl']; } /** - * @param mixed $authRedirectUrl + * Sets authRedirectUrl + * + * @param string $authRedirectUrl The redirection URL that the user is redirected to after the user agrees to authorize. This value is provided by the merchant. More information: Maximum length: 1024 characters + * + * @return self */ public function setAuthRedirectUrl($authRedirectUrl) { - $this->authRedirectUrl = $authRedirectUrl; + $this->container['authRedirectUrl'] = $authRedirectUrl; + + return $this; } /** - * @return mixed + * Gets scopes + * + * @return \request\model\ScopeType[] */ public function getScopes() { - return $this->scopes; + return $this->container['scopes']; } /** - * @param mixed $scopes + * Sets scopes + * + * @param \request\model\ScopeType[] $scopes The authorization scope. Valid values are: BASE_USER_INFO: Indicates that the unique user ID can be obtained. USER_INFO: Indicates that the complete user information can be obtained, for example, user name, avatar, and other user information. AGREEMENT_PAY: Indicates that the user agrees to authorize for auto debit so that the merchant can use the access token to automatically deduct money from the user's account. More information: Maximum size: 4 elements + * + * @return self */ public function setScopes($scopes) { - $this->scopes = $scopes; + $this->container['scopes'] = $scopes; + + return $this; } /** - * @return mixed + * Gets authState + * + * @return string */ public function getAuthState() { - return $this->authState; + return $this->container['authState']; } /** - * @param mixed $authState + * Sets authState + * + * @param string $authState The unique ID generated by the merchant to represent the consult request. The consistency of this field and that in the redirection URL when the user agrees to authorize needs to be guaranteed. More information: Maximum length: 256 characters + * + * @return self */ public function setAuthState($authState) { - $this->authState = $authState; + $this->container['authState'] = $authState; + + return $this; } /** - * @return mixed + * Gets terminalType + * + * @return \request\model\TerminalType */ public function getTerminalType() { - return $this->terminalType; + return $this->container['terminalType']; } /** - * @param mixed $terminalType + * Sets terminalType + * + * @param \request\model\TerminalType $terminalType terminalType + * + * @return self */ public function setTerminalType($terminalType) { - $this->terminalType = $terminalType; + $this->container['terminalType'] = $terminalType; + + return $this; } /** - * @return mixed + * Gets osType + * + * @return \request\model\OsType|null */ public function getOsType() { - return $this->osType; + return $this->container['osType']; } /** - * @param mixed $osType + * Sets osType + * + * @param \request\model\OsType|null $osType osType + * + * @return self */ public function setOsType($osType) { - $this->osType = $osType; + $this->container['osType'] = $osType; + + return $this; } /** - * @return mixed + * Gets osVersion + * + * @return string|null */ public function getOsVersion() { - return $this->osVersion; + return $this->container['osVersion']; } /** - * @param mixed $osVersion + * Sets osVersion + * + * @param string|null $osVersion The OS version. Note: Specify this parameter when the value of terminalType is APP or WAP and you have this information. Providing this information makes the user's payment experience better. More information: Maximum length: 16 characters + * + * @return self */ public function setOsVersion($osVersion) { - $this->osVersion = $osVersion; + $this->container['osVersion'] = $osVersion; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets merchantRegion + * + * @return string|null + */ + public function getMerchantRegion() + { + return $this->container['merchantRegion']; + } + + /** + * Sets merchantRegion + * + * @param string|null $merchantRegion The country or region where the merchant or secondary merchant operates the business. The parameter is a 2-letter country/region code that follows ISO 3166 Country Codes standard. Only US, JP, PK, SG are supported now. Note: This field is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + * + * @return self + */ + public function setMerchantRegion($merchantRegion) + { + $this->container['merchantRegion'] = $merchantRegion; + + return $this; + } + + /** + * Gets recurringPayment + * + * @return bool|null + */ + public function getRecurringPayment() + { + return $this->container['recurringPayment']; + } + + /** + * Sets recurringPayment + * + * @param bool|null $recurringPayment Indicates whether the auto debit is used for recurring payments. Valid values are: true: indicates the auto debit is for recurring payments. false: indicates the auto debit is not for recurring payments. Specify this parameter when the value of customerBelongsTo is PAYPAY. + * + * @return self + */ + public function setRecurringPayment($recurringPayment) + { + $this->container['recurringPayment'] = $recurringPayment; + + return $this; + } + + /** + * Gets authMetaData + * + * @return \request\model\AuthMetaData|null + */ + public function getAuthMetaData() + { + return $this->container['authMetaData']; } -} \ No newline at end of file + /** + * Sets authMetaData + * + * @param \request\model\AuthMetaData|null $authMetaData authMetaData + * + * @return self + */ + public function setAuthMetaData($authMetaData) + { + $this->container['authMetaData'] = $authMetaData; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/auth/AlipayAuthRevokeTokenRequest.php b/request/auth/AlipayAuthRevokeTokenRequest.php index fae75e7..a5773cc 100644 --- a/request/auth/AlipayAuthRevokeTokenRequest.php +++ b/request/auth/AlipayAuthRevokeTokenRequest.php @@ -1,52 +1,445 @@ + */ +class AlipayAuthRevokeTokenRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAuthRevokeTokenRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'accessToken' => 'string', + 'extendInfo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'accessToken' => null, + 'extendInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'accessToken' => false, + 'extendInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $accessToken; - public $extendInfo; + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - function __construct() + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool { - $this->setPath(AntomPathConstants::AUTH_REVOKE_PATH); + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'accessToken' => 'accessToken', + 'extendInfo' => 'extendInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'accessToken' => 'setAccessToken', + 'extendInfo' => 'setExtendInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'accessToken' => 'getAccessToken', + 'extendInfo' => 'getExtendInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } /** - * @return mixed + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('accessToken', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + + $this->setPath("/ams/api/v1/authorizations/revoke"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['accessToken'] === null) { + $invalidProperties[] = "'accessToken' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets accessToken + * + * @return string */ public function getAccessToken() { - return $this->accessToken; + return $this->container['accessToken']; } /** - * @param mixed $accessToken + * Sets accessToken + * + * @param string $accessToken The access token that is used to access the corresponding scope of the user resource. More information: Maximum length: 128 characters + * + * @return self */ public function setAccessToken($accessToken) { - $this->accessToken = $accessToken; + $this->container['accessToken'] = $accessToken; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/dispute/AlipayAcceptDisputeRequest.php b/request/dispute/AlipayAcceptDisputeRequest.php index 26a1882..1c75a17 100644 --- a/request/dispute/AlipayAcceptDisputeRequest.php +++ b/request/dispute/AlipayAcceptDisputeRequest.php @@ -1,36 +1,414 @@ + */ +class AlipayAcceptDisputeRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - public $disputeId; + public const DISCRIMINATOR = null; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAcceptDisputeRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputeId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputeId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputeId' => false + ]; - function __construct() + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { - $this->setPath(AntomPathConstants::ACCEPT_DISPUTE_PATH); + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** - * @return mixed + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'disputeId' => 'disputeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputeId' => 'setDisputeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputeId' => 'getDisputeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('disputeId', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/acceptDispute"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['disputeId'] === null) { + $invalidProperties[] = "'disputeId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets disputeId + * + * @return string */ public function getDisputeId() { - return $this->disputeId; + return $this->container['disputeId']; + } + + /** + * Sets disputeId + * + * @param string $disputeId The unique ID assigned by Antom to identify a dispute. More information: Maximum length: 64 characters + * + * @return self + */ + public function setDisputeId($disputeId) + { + $this->container['disputeId'] = $disputeId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** - * @param mixed $disputeId + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void */ - public function setDisputeId($disputeId) + public function offsetUnset($offset): void { - $this->disputeId = $disputeId; + unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/dispute/AlipayDownloadDisputeEvidenceRequest.php b/request/dispute/AlipayDownloadDisputeEvidenceRequest.php index 71ba425..76bd2f7 100644 --- a/request/dispute/AlipayDownloadDisputeEvidenceRequest.php +++ b/request/dispute/AlipayDownloadDisputeEvidenceRequest.php @@ -1,52 +1,448 @@ + */ +class AlipayDownloadDisputeEvidenceRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - public $disputeId; - public $disputeEvidenceType; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayDownloadDisputeEvidenceRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputeId' => 'string', + 'disputeEvidenceType' => '\request\model\DisputeEvidenceType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputeId' => null, + 'disputeEvidenceType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputeId' => false, + 'disputeEvidenceType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - function __construct() + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool { - $this->setPath(AntomPathConstants::DOWNLOAD_DISPUTE_EVIDENCE_PATH); + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'disputeId' => 'disputeId', + 'disputeEvidenceType' => 'disputeEvidenceType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputeId' => 'setDisputeId', + 'disputeEvidenceType' => 'setDisputeEvidenceType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputeId' => 'getDisputeId', + 'disputeEvidenceType' => 'getDisputeEvidenceType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('disputeId', $data ?? [], null); + $this->setIfExists('disputeEvidenceType', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/downloadDisputeEvidence"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['disputeId'] === null) { + $invalidProperties[] = "'disputeId' can't be null"; + } + if ($this->container['disputeEvidenceType'] === null) { + $invalidProperties[] = "'disputeEvidenceType' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets disputeId + * + * @return string */ public function getDisputeId() { - return $this->disputeId; + return $this->container['disputeId']; } /** - * @param mixed $disputeId + * Sets disputeId + * + * @param string $disputeId The unique ID that is assigned by Antom to identify a dispute. More information: Maximum length: 64 characters + * + * @return self */ - public function setDisputeId($disputeId) + public function setDisputeId($disputeId) { - $this->disputeId = $disputeId; + $this->container['disputeId'] = $disputeId; + + return $this; } /** - * @return mixed + * Gets disputeEvidenceType + * + * @return \request\model\DisputeEvidenceType */ public function getDisputeEvidenceType() { - return $this->disputeEvidenceType; + return $this->container['disputeEvidenceType']; + } + + /** + * Sets disputeEvidenceType + * + * @param \request\model\DisputeEvidenceType $disputeEvidenceType disputeEvidenceType + * + * @return self + */ + public function setDisputeEvidenceType($disputeEvidenceType) + { + $this->container['disputeEvidenceType'] = $disputeEvidenceType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $disputeEvidenceType + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setDisputeEvidenceType($disputeEvidenceType) + public function offsetSet($offset, $value): void { - $this->disputeEvidenceType = $disputeEvidenceType; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/dispute/AlipaySupplyDefenseDocumentRequest.php b/request/dispute/AlipaySupplyDefenseDocumentRequest.php index 53f573a..0efe0af 100644 --- a/request/dispute/AlipaySupplyDefenseDocumentRequest.php +++ b/request/dispute/AlipaySupplyDefenseDocumentRequest.php @@ -1,53 +1,448 @@ + */ +class AlipaySupplyDefenseDocumentRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; - public $disputeId; - public $disputeEvidence; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySupplyDefenseDocumentRequest'; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disputeId' => 'string', + 'disputeEvidence' => 'string' + ]; - function __construct() + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disputeId' => null, + 'disputeEvidence' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'disputeId' => false, + 'disputeEvidence' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() { - $this->setPath(AntomPathConstants::SUPPLY_DEFENCE_DOC_PATH); + return self::$openAPITypes; } /** - * @return mixed + * Array of property to format mappings. Used for (de)serialization + * + * @return array */ - public function getDisputeEvidence() + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'disputeId' => 'disputeId', + 'disputeEvidence' => 'disputeEvidence' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disputeId' => 'setDisputeId', + 'disputeEvidence' => 'setDisputeEvidence' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disputeId' => 'getDisputeId', + 'disputeEvidence' => 'getDisputeEvidence' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() { - return $this->disputeEvidence; + return self::$openAPIModelName; } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + /** - * @param mixed $disputeEvidence + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function setDisputeEvidence($disputeEvidence) + public function __construct(?array $data = null) { - $this->disputeEvidence = $disputeEvidence; + $this->setIfExists('disputeId', $data ?? [], null); + $this->setIfExists('disputeEvidence', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/supplyDefenseDocument"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['disputeId'] === null) { + $invalidProperties[] = "'disputeId' can't be null"; + } + if ($this->container['disputeEvidence'] === null) { + $invalidProperties[] = "'disputeEvidence' can't be null"; + } + return $invalidProperties; } /** - * @return mixed + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets disputeId + * + * @return string */ public function getDisputeId() { - return $this->disputeId; + return $this->container['disputeId']; + } + + /** + * Sets disputeId + * + * @param string $disputeId The unique ID assigned by Antom to identify a dispute. More information: Maximum length: 64 characters + * + * @return self + */ + public function setDisputeId($disputeId) + { + $this->container['disputeId'] = $disputeId; + + return $this; + } + + /** + * Gets disputeEvidence + * + * @return string + */ + public function getDisputeEvidence() + { + return $this->container['disputeEvidence']; } /** - * @param mixed $disputeId + * Sets disputeEvidence + * + * @param string $disputeEvidence The dispute defense document that you prepare for defending the dispute, which is encoded in the Base64 format. More information: Maximum length: 1000000 characters + * + * @return self */ - public function setDisputeId($disputeId) + public function setDisputeEvidence($disputeEvidence) { - $this->disputeId = $disputeId; + $this->container['disputeEvidence'] = $disputeEvidence; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/marketplace/AlipayCreatePayoutRequest.php b/request/marketplace/AlipayCreatePayoutRequest.php index b122fc0..ca9ca0f 100644 --- a/request/marketplace/AlipayCreatePayoutRequest.php +++ b/request/marketplace/AlipayCreatePayoutRequest.php @@ -1,71 +1,482 @@ + */ +class AlipayCreatePayoutRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayCreatePayoutRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transferRequestId' => 'string', + 'transferFromDetail' => '\request\model\TransferFromDetail', + 'transferToDetail' => '\request\model\TransferToDetail' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transferRequestId' => null, + 'transferFromDetail' => null, + 'transferToDetail' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transferRequestId' => false, + 'transferFromDetail' => false, + 'transferToDetail' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transferRequestId' => 'transferRequestId', + 'transferFromDetail' => 'transferFromDetail', + 'transferToDetail' => 'transferToDetail' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transferRequestId' => 'setTransferRequestId', + 'transferFromDetail' => 'setTransferFromDetail', + 'transferToDetail' => 'setTransferToDetail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transferRequestId' => 'getTransferRequestId', + 'transferFromDetail' => 'getTransferFromDetail', + 'transferToDetail' => 'getTransferToDetail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $transferRequestId; - public $transferFromDetail; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $transferToDetail; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - function __construct() + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - $this->setPath(AntomPathConstants::MARKETPLACE_CREATEPAYOUT_PATH); + $this->setIfExists('transferRequestId', $data ?? [], null); + $this->setIfExists('transferFromDetail', $data ?? [], null); + $this->setIfExists('transferToDetail', $data ?? [], null); + + $this->setPath("/ams/api/v1/funds/createPayout"); } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['transferRequestId'] === null) { + $invalidProperties[] = "'transferRequestId' can't be null"; + } + if ($this->container['transferFromDetail'] === null) { + $invalidProperties[] = "'transferFromDetail' can't be null"; + } + if ($this->container['transferToDetail'] === null) { + $invalidProperties[] = "'transferToDetail' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transferRequestId + * + * @return string */ public function getTransferRequestId() { - return $this->transferRequestId; + return $this->container['transferRequestId']; } /** - * @param mixed $transferRequestId + * Sets transferRequestId + * + * @param string $transferRequestId The unique ID assigned by the marketplace to identify a payout request. More information: This field is an API idempotency field.For requests that are initiated with the same value of transferRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ - public function setTransferRequestId($transferRequestId) + public function setTransferRequestId($transferRequestId) { - $this->transferRequestId = $transferRequestId; + $this->container['transferRequestId'] = $transferRequestId; + + return $this; } /** - * @return mixed + * Gets transferFromDetail + * + * @return \request\model\TransferFromDetail */ public function getTransferFromDetail() { - return $this->transferFromDetail; + return $this->container['transferFromDetail']; } /** - * @param mixed $transferFromDetail + * Sets transferFromDetail + * + * @param \request\model\TransferFromDetail $transferFromDetail transferFromDetail + * + * @return self */ - public function setTransferFromDetail($transferFromDetail) + public function setTransferFromDetail($transferFromDetail) { - $this->transferFromDetail = $transferFromDetail; + $this->container['transferFromDetail'] = $transferFromDetail; + + return $this; } /** - * @return mixed + * Gets transferToDetail + * + * @return \request\model\TransferToDetail */ public function getTransferToDetail() { - return $this->transferToDetail; + return $this->container['transferToDetail']; + } + + /** + * Sets transferToDetail + * + * @param \request\model\TransferToDetail $transferToDetail transferToDetail + * + * @return self + */ + public function setTransferToDetail($transferToDetail) + { + $this->container['transferToDetail'] = $transferToDetail; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $transferToDetail + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setTransferToDetail($transferToDetail) + public function offsetSet($offset, $value): void { - $this->transferToDetail = $transferToDetail; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/marketplace/AlipayCreateTransferRequest.php b/request/marketplace/AlipayCreateTransferRequest.php index ff4cbe0..8eaa1cb 100644 --- a/request/marketplace/AlipayCreateTransferRequest.php +++ b/request/marketplace/AlipayCreateTransferRequest.php @@ -1,71 +1,482 @@ + */ +class AlipayCreateTransferRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayCreateTransferRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transferRequestId' => 'string', + 'transferFromDetail' => '\request\model\TransferFromDetail', + 'transferToDetail' => '\request\model\TransferToDetail' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transferRequestId' => null, + 'transferFromDetail' => null, + 'transferToDetail' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transferRequestId' => false, + 'transferFromDetail' => false, + 'transferToDetail' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transferRequestId' => 'transferRequestId', + 'transferFromDetail' => 'transferFromDetail', + 'transferToDetail' => 'transferToDetail' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transferRequestId' => 'setTransferRequestId', + 'transferFromDetail' => 'setTransferFromDetail', + 'transferToDetail' => 'setTransferToDetail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transferRequestId' => 'getTransferRequestId', + 'transferFromDetail' => 'getTransferFromDetail', + 'transferToDetail' => 'getTransferToDetail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $transferRequestId; - public $transferFromDetail; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $transferToDetail; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - function __construct() + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - $this->setPath(AntomPathConstants::MARKETPLACE_CREATETRANSFER_PATH); + $this->setIfExists('transferRequestId', $data ?? [], null); + $this->setIfExists('transferFromDetail', $data ?? [], null); + $this->setIfExists('transferToDetail', $data ?? [], null); + + $this->setPath("/ams/api/v1/funds/createTransfer"); } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['transferRequestId'] === null) { + $invalidProperties[] = "'transferRequestId' can't be null"; + } + if ($this->container['transferFromDetail'] === null) { + $invalidProperties[] = "'transferFromDetail' can't be null"; + } + if ($this->container['transferToDetail'] === null) { + $invalidProperties[] = "'transferToDetail' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transferRequestId + * + * @return string */ public function getTransferRequestId() { - return $this->transferRequestId; + return $this->container['transferRequestId']; } /** - * @param mixed $transferRequestId + * Sets transferRequestId + * + * @param string $transferRequestId The unique ID assigned by the marketplace to identify a transfer request. More information: This field is an API idempotency field.For requests that are initiated with the same value of transferRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ - public function setTransferRequestId($transferRequestId) + public function setTransferRequestId($transferRequestId) { - $this->transferRequestId = $transferRequestId; + $this->container['transferRequestId'] = $transferRequestId; + + return $this; } /** - * @return mixed + * Gets transferFromDetail + * + * @return \request\model\TransferFromDetail */ public function getTransferFromDetail() { - return $this->transferFromDetail; + return $this->container['transferFromDetail']; } /** - * @param mixed $transferFromDetail + * Sets transferFromDetail + * + * @param \request\model\TransferFromDetail $transferFromDetail transferFromDetail + * + * @return self */ - public function setTransferFromDetail($transferFromDetail) + public function setTransferFromDetail($transferFromDetail) { - $this->transferFromDetail = $transferFromDetail; + $this->container['transferFromDetail'] = $transferFromDetail; + + return $this; } /** - * @return mixed + * Gets transferToDetail + * + * @return \request\model\TransferToDetail */ public function getTransferToDetail() { - return $this->transferToDetail; + return $this->container['transferToDetail']; + } + + /** + * Sets transferToDetail + * + * @param \request\model\TransferToDetail $transferToDetail transferToDetail + * + * @return self + */ + public function setTransferToDetail($transferToDetail) + { + $this->container['transferToDetail'] = $transferToDetail; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } /** - * @param mixed $transferToDetail + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setTransferToDetail($transferToDetail) + public function offsetSet($offset, $value): void { - $this->transferToDetail = $transferToDetail; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/marketplace/AlipayInquireBalanceRequest.php b/request/marketplace/AlipayInquireBalanceRequest.php index ae70fc3..e334e4e 100644 --- a/request/marketplace/AlipayInquireBalanceRequest.php +++ b/request/marketplace/AlipayInquireBalanceRequest.php @@ -1,33 +1,411 @@ + */ +class AlipayInquireBalanceRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - public $referenceMerchantId; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayInquireBalanceRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'referenceMerchantId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'referenceMerchantId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'referenceMerchantId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'referenceMerchantId' => 'referenceMerchantId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'referenceMerchantId' => 'setReferenceMerchantId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'referenceMerchantId' => 'getReferenceMerchantId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - function __construct() + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('referenceMerchantId', $data ?? [], null); + + $this->setPath("/ams/api/v1/accounts/inquireBalance"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() { - $this->setPath(AntomPathConstants::MARKETPLACE_INQUIREBALANCE_PATH); + return count($this->listInvalidProperties()) === 0; } + /** - * @return mixed + * Gets referenceMerchantId + * + * @return string|null */ public function getReferenceMerchantId() { - return $this->referenceMerchantId; + return $this->container['referenceMerchantId']; } /** - * @param mixed $referenceMerchantId + * Sets referenceMerchantId + * + * @param string|null $referenceMerchantId The unique ID that is assigned by the marketplace to identify the sub-merchant. Specify this parameter if you inquire about the account balance of the sub-merchant. If you leave this parameter empty or do not specify this parameter, the default action is to inquire about the account balance of the marketplace. More information: Maximum length: 32 characters + * + * @return self */ - public function setReferenceMerchantId($referenceMerchantId) + public function setReferenceMerchantId($referenceMerchantId) { - $this->referenceMerchantId = $referenceMerchantId; + $this->container['referenceMerchantId'] = $referenceMerchantId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } -} \ No newline at end of file + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/marketplace/AlipayRegisterRequest.php b/request/marketplace/AlipayRegisterRequest.php index 775567a..2282c45 100644 --- a/request/marketplace/AlipayRegisterRequest.php +++ b/request/marketplace/AlipayRegisterRequest.php @@ -1,87 +1,516 @@ + */ +class AlipayRegisterRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - public $registrationRequestId; - public $settlementInfos; - public $merchantInfo; - public $paymentMethods; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayRegisterRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'registrationRequestId' => 'string', + 'settlementInfos' => '\request\model\SettlementInfo[]', + 'merchantInfo' => '\request\model\MerchantInfo', + 'paymentMethods' => '\request\model\PaymentMethod[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'registrationRequestId' => null, + 'settlementInfos' => null, + 'merchantInfo' => null, + 'paymentMethods' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'registrationRequestId' => false, + 'settlementInfos' => false, + 'merchantInfo' => false, + 'paymentMethods' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'registrationRequestId' => 'registrationRequestId', + 'settlementInfos' => 'settlementInfos', + 'merchantInfo' => 'merchantInfo', + 'paymentMethods' => 'paymentMethods' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'registrationRequestId' => 'setRegistrationRequestId', + 'settlementInfos' => 'setSettlementInfos', + 'merchantInfo' => 'setMerchantInfo', + 'paymentMethods' => 'setPaymentMethods' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'registrationRequestId' => 'getRegistrationRequestId', + 'settlementInfos' => 'getSettlementInfos', + 'merchantInfo' => 'getMerchantInfo', + 'paymentMethods' => 'getPaymentMethods' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - function __construct() + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() { - $this->setPath(AntomPathConstants::MARKETPLACE_REGISTER_PATH); + return self::$openAPIModelName; } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('registrationRequestId', $data ?? [], null); + $this->setIfExists('settlementInfos', $data ?? [], null); + $this->setIfExists('merchantInfo', $data ?? [], null); + $this->setIfExists('paymentMethods', $data ?? [], null); + + $this->setPath("/ams/api/v1/merchants/register"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['registrationRequestId'] === null) { + $invalidProperties[] = "'registrationRequestId' can't be null"; + } + if ($this->container['settlementInfos'] === null) { + $invalidProperties[] = "'settlementInfos' can't be null"; + } + if ($this->container['merchantInfo'] === null) { + $invalidProperties[] = "'merchantInfo' can't be null"; + } + if ($this->container['paymentMethods'] === null) { + $invalidProperties[] = "'paymentMethods' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** - * @return mixed + * Gets registrationRequestId + * + * @return string */ public function getRegistrationRequestId() { - return $this->registrationRequestId; + return $this->container['registrationRequestId']; } /** - * @param mixed $registrationRequestId + * Sets registrationRequestId + * + * @param string $registrationRequestId The unique ID that is assigned by the marketplace to identify a registration request. Alipay uses this field for idempotence control. More information: This field is an API idempotency field.For registration requests that are initiated with the same value of registrationRequestId and reach a final status (resultStatus = S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ - public function setRegistrationRequestId($registrationRequestId) + public function setRegistrationRequestId($registrationRequestId) { - $this->registrationRequestId = $registrationRequestId; + $this->container['registrationRequestId'] = $registrationRequestId; + + return $this; } /** - * @return mixed + * Gets settlementInfos + * + * @return \request\model\SettlementInfo[] */ public function getSettlementInfos() { - return $this->settlementInfos; + return $this->container['settlementInfos']; } /** - * @param mixed $settlementInfos + * Sets settlementInfos + * + * @param \request\model\SettlementInfo[] $settlementInfos The list of sub-merchants' settlement information. One settlement currency corresponds to one settlement bank account. More information: Maximum size: 10 elements + * + * @return self */ - public function setSettlementInfos($settlementInfos) + public function setSettlementInfos($settlementInfos) { - $this->settlementInfos = $settlementInfos; + $this->container['settlementInfos'] = $settlementInfos; + + return $this; } /** - * @return mixed + * Gets merchantInfo + * + * @return \request\model\MerchantInfo */ public function getMerchantInfo() { - return $this->merchantInfo; + return $this->container['merchantInfo']; } /** - * @param mixed $merchantInfo + * Sets merchantInfo + * + * @param \request\model\MerchantInfo $merchantInfo merchantInfo + * + * @return self */ - public function setMerchantInfo($merchantInfo) + public function setMerchantInfo($merchantInfo) { - $this->merchantInfo = $merchantInfo; + $this->container['merchantInfo'] = $merchantInfo; + + return $this; } /** - * @return mixed + * Gets paymentMethods + * + * @return \request\model\PaymentMethod[] */ public function getPaymentMethods() { - return $this->paymentMethods; + return $this->container['paymentMethods']; } /** - * @param mixed $paymentMethods + * Sets paymentMethods + * + * @param \request\model\PaymentMethod[] $paymentMethods The payment method that is used to collect the payment by the merchant or acquirer. The payment method must be already supportd by the platform merchant before they can be assigned for sub-merchants. More information: Maximum length: 100 characters + * + * @return self */ - public function setPaymentMethods($paymentMethods) + public function setPaymentMethods($paymentMethods) { - $this->paymentMethods = $paymentMethods; + $this->container['paymentMethods'] = $paymentMethods; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/marketplace/AlipaySettleRequest.php b/request/marketplace/AlipaySettleRequest.php index 2c2a6a7..d2f2ff8 100644 --- a/request/marketplace/AlipaySettleRequest.php +++ b/request/marketplace/AlipaySettleRequest.php @@ -1,72 +1,482 @@ + */ +class AlipaySettleRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - public $settlementRequestId; + public const DISCRIMINATOR = null; - public $paymentId; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySettleRequest'; - public $settlementDetails; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'settlementRequestId' => 'string', + 'paymentId' => 'string', + 'settlementDetails' => '\request\model\SettlementDetail[]' + ]; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'settlementRequestId' => null, + 'paymentId' => null, + 'settlementDetails' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'settlementRequestId' => false, + 'paymentId' => false, + 'settlementDetails' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - function __construct() + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'settlementRequestId' => 'settlementRequestId', + 'paymentId' => 'paymentId', + 'settlementDetails' => 'settlementDetails' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'settlementRequestId' => 'setSettlementRequestId', + 'paymentId' => 'setPaymentId', + 'settlementDetails' => 'setSettlementDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'settlementRequestId' => 'getSettlementRequestId', + 'paymentId' => 'getPaymentId', + 'settlementDetails' => 'getSettlementDetails' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() { - $this->setPath(AntomPathConstants::MARKETPLACE_SETTLE_PATH); + return self::$getters; } /** - * @return mixed + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('settlementRequestId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('settlementDetails', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/settle"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['settlementRequestId'] === null) { + $invalidProperties[] = "'settlementRequestId' can't be null"; + } + if ($this->container['paymentId'] === null) { + $invalidProperties[] = "'paymentId' can't be null"; + } + if ($this->container['settlementDetails'] === null) { + $invalidProperties[] = "'settlementDetails' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets settlementRequestId + * + * @return string */ public function getSettlementRequestId() { - return $this->settlementRequestId; + return $this->container['settlementRequestId']; } /** - * @param mixed $settlementRequestId + * Sets settlementRequestId + * + * @param string $settlementRequestId The unique ID that is assigned by the marketplace to identify a settlement request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For registration requests that are initiated with the same value of settlementRequestId and reach a final status (resultStatus = S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ - public function setSettlementRequestId($settlementRequestId) + public function setSettlementRequestId($settlementRequestId) { - $this->settlementRequestId = $settlementRequestId; + $this->container['settlementRequestId'] = $settlementRequestId; + + return $this; } /** - * @return mixed + * Gets paymentId + * + * @return string */ public function getPaymentId() { - return $this->paymentId; + return $this->container['paymentId']; } /** - * @param mixed $paymentId + * Sets paymentId + * + * @param string $paymentId The unique ID that is assigned by Antom to identify a payment. The value of this parameter is returned through the same parameter in the pay (Cashier Payment) API. More information: Maximum length: 64 characters + * + * @return self */ - public function setPaymentId($paymentId) + public function setPaymentId($paymentId) { - $this->paymentId = $paymentId; + $this->container['paymentId'] = $paymentId; + + return $this; } /** - * @return mixed + * Gets settlementDetails + * + * @return \request\model\SettlementDetail[] */ public function getSettlementDetails() { - return $this->settlementDetails; + return $this->container['settlementDetails']; + } + + /** + * Sets settlementDetails + * + * @param \request\model\SettlementDetail[] $settlementDetails The settlement details for a payment. More information: Maximum length: 20 characters + * + * @return self + */ + public function setSettlementDetails($settlementDetails) + { + $this->container['settlementDetails'] = $settlementDetails; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } /** - * @param mixed $settlementDetails + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void */ - public function setSettlementDetails($settlementDetails) + public function offsetUnset($offset): void { - $this->settlementDetails = $settlementDetails; + unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/marketplace/AlipaySettlementInfoUpdateRequest.php b/request/marketplace/AlipaySettlementInfoUpdateRequest.php index 7746a0c..4028e64 100644 --- a/request/marketplace/AlipaySettlementInfoUpdateRequest.php +++ b/request/marketplace/AlipaySettlementInfoUpdateRequest.php @@ -1,85 +1,516 @@ + */ +class AlipaySettlementInfoUpdateRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - public $updateRequestId; - public $referenceMerchantId; - public $settlementCurrency; - public $settlementBankAccount; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySettlementInfoUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'updateRequestId' => 'string', + 'referenceMerchantId' => 'string', + 'settlementCurrency' => 'string', + 'settlementBankAccount' => '\request\model\SettlementBankAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'updateRequestId' => null, + 'referenceMerchantId' => null, + 'settlementCurrency' => null, + 'settlementBankAccount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'updateRequestId' => false, + 'referenceMerchantId' => false, + 'settlementCurrency' => false, + 'settlementBankAccount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'updateRequestId' => 'updateRequestId', + 'referenceMerchantId' => 'referenceMerchantId', + 'settlementCurrency' => 'settlementCurrency', + 'settlementBankAccount' => 'settlementBankAccount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'updateRequestId' => 'setUpdateRequestId', + 'referenceMerchantId' => 'setReferenceMerchantId', + 'settlementCurrency' => 'setSettlementCurrency', + 'settlementBankAccount' => 'setSettlementBankAccount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'updateRequestId' => 'getUpdateRequestId', + 'referenceMerchantId' => 'getReferenceMerchantId', + 'settlementCurrency' => 'getSettlementCurrency', + 'settlementBankAccount' => 'getSettlementBankAccount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('updateRequestId', $data ?? [], null); + $this->setIfExists('referenceMerchantId', $data ?? [], null); + $this->setIfExists('settlementCurrency', $data ?? [], null); + $this->setIfExists('settlementBankAccount', $data ?? [], null); - function __construct() + $this->setPath("/ams/api/v1/merchants/settlementInfo/update"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void { - $this->setPath(AntomPathConstants::MARKETPLACE_SETTLEMENTINFO_UPDATE_PATH); + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** - * @return mixed + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['updateRequestId'] === null) { + $invalidProperties[] = "'updateRequestId' can't be null"; + } + if ($this->container['referenceMerchantId'] === null) { + $invalidProperties[] = "'referenceMerchantId' can't be null"; + } + if ($this->container['settlementCurrency'] === null) { + $invalidProperties[] = "'settlementCurrency' can't be null"; + } + if ($this->container['settlementBankAccount'] === null) { + $invalidProperties[] = "'settlementBankAccount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets updateRequestId + * + * @return string */ public function getUpdateRequestId() { - return $this->updateRequestId; + return $this->container['updateRequestId']; } /** - * @param mixed $updateRequestId + * Sets updateRequestId + * + * @param string $updateRequestId The unique ID that is assigned by the marketplace to identify an update request for settlement information. Alipay uses this field for idempotence control. More information: This field is an API idempotency field.For registration requests that are initiated with the same value of registrationRequestId and reach a final status (resultStatus = S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ - public function setUpdateRequestId($updateRequestId) + public function setUpdateRequestId($updateRequestId) { - $this->updateRequestId = $updateRequestId; + $this->container['updateRequestId'] = $updateRequestId; + + return $this; } /** - * @return mixed + * Gets referenceMerchantId + * + * @return string */ public function getReferenceMerchantId() { - return $this->referenceMerchantId; + return $this->container['referenceMerchantId']; } /** - * @param mixed $referenceMerchantId + * Sets referenceMerchantId + * + * @param string $referenceMerchantId The unique ID that is assigned by the marketplace to identify the seller. More information: Maximum length: 64 characters + * + * @return self */ - public function setReferenceMerchantId($referenceMerchantId) + public function setReferenceMerchantId($referenceMerchantId) { - $this->referenceMerchantId = $referenceMerchantId; + $this->container['referenceMerchantId'] = $referenceMerchantId; + + return $this; } /** - * @return mixed + * Gets settlementCurrency + * + * @return string */ public function getSettlementCurrency() { - return $this->settlementCurrency; + return $this->container['settlementCurrency']; } /** - * @param mixed $settlementCurrency + * Sets settlementCurrency + * + * @param string $settlementCurrency The seller's settlement currency that is specified in the settlement contract. The value of this parameter is a 3-letter currency code that follows the ISO 4217 standard. More information: Maximum length: 3 characters + * + * @return self */ - public function setSettlementCurrency($settlementCurrency) + public function setSettlementCurrency($settlementCurrency) { - $this->settlementCurrency = $settlementCurrency; + $this->container['settlementCurrency'] = $settlementCurrency; + + return $this; } /** - * @return mixed + * Gets settlementBankAccount + * + * @return \request\model\SettlementBankAccount */ public function getSettlementBankAccount() { - return $this->settlementBankAccount; + return $this->container['settlementBankAccount']; } /** - * @param mixed $settlementBankAccount + * Sets settlementBankAccount + * + * @param \request\model\SettlementBankAccount $settlementBankAccount settlementBankAccount + * + * @return self */ - public function setSettlementBankAccount($settlementBankAccount) + public function setSettlementBankAccount($settlementBankAccount) { - $this->settlementBankAccount = $settlementBankAccount; + $this->container['settlementBankAccount'] = $settlementBankAccount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/marketplace/AlipaySubmitAttachmentRequest.php b/request/marketplace/AlipaySubmitAttachmentRequest.php index b24e3a1..762d864 100644 --- a/request/marketplace/AlipaySubmitAttachmentRequest.php +++ b/request/marketplace/AlipaySubmitAttachmentRequest.php @@ -1,69 +1,482 @@ + */ +class AlipaySubmitAttachmentRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - public $submitAttachmentRequestId; - public $attachmentType; - public $fileSha256; + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubmitAttachmentRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'submitAttachmentRequestId' => 'string', + 'attachmentType' => '\request\model\AttachmentType', + 'fileSha256' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'submitAttachmentRequestId' => null, + 'attachmentType' => null, + 'fileSha256' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'submitAttachmentRequestId' => false, + 'attachmentType' => false, + 'fileSha256' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'submitAttachmentRequestId' => 'submitAttachmentRequestId', + 'attachmentType' => 'attachmentType', + 'fileSha256' => 'fileSha256' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'submitAttachmentRequestId' => 'setSubmitAttachmentRequestId', + 'attachmentType' => 'setAttachmentType', + 'fileSha256' => 'setFileSha256' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'submitAttachmentRequestId' => 'getSubmitAttachmentRequestId', + 'attachmentType' => 'getAttachmentType', + 'fileSha256' => 'getFileSha256' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - function __construct() + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('submitAttachmentRequestId', $data ?? [], null); + $this->setIfExists('attachmentType', $data ?? [], null); + $this->setIfExists('fileSha256', $data ?? [], null); + + $this->setPath("/ams/api/open/openapiv2_file/v1/business/attachment/submitAttachment"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['submitAttachmentRequestId'] === null) { + $invalidProperties[] = "'submitAttachmentRequestId' can't be null"; + } + if ($this->container['attachmentType'] === null) { + $invalidProperties[] = "'attachmentType' can't be null"; + } + if ($this->container['fileSha256'] === null) { + $invalidProperties[] = "'fileSha256' 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() { - $this->setPath(AntomPathConstants::MARKETPLACE_SUBMITATTACHMENT_PATH); + return count($this->listInvalidProperties()) === 0; } + /** - * @return mixed + * Gets submitAttachmentRequestId + * + * @return string */ public function getSubmitAttachmentRequestId() { - return $this->submitAttachmentRequestId; + return $this->container['submitAttachmentRequestId']; } /** - * @param mixed $submitAttachmentRequestId + * Sets submitAttachmentRequestId + * + * @param string $submitAttachmentRequestId The unique ID assigned by the marketplace to identify an attachment submission request. More information: This field is an API idempotency field. For attachment submission requests that are initiated with the same value of attachmentSubmissionRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 32 characters + * + * @return self */ - public function setSubmitAttachmentRequestId($submitAttachmentRequestId) + public function setSubmitAttachmentRequestId($submitAttachmentRequestId) { - $this->submitAttachmentRequestId = $submitAttachmentRequestId; + $this->container['submitAttachmentRequestId'] = $submitAttachmentRequestId; + + return $this; } /** - * @return mixed + * Gets attachmentType + * + * @return \request\model\AttachmentType */ public function getAttachmentType() { - return $this->attachmentType; + return $this->container['attachmentType']; } /** - * @param mixed $attachmentType + * Sets attachmentType + * + * @param \request\model\AttachmentType $attachmentType attachmentType + * + * @return self */ - public function setAttachmentType($attachmentType) + public function setAttachmentType($attachmentType) { - $this->attachmentType = $attachmentType; + $this->container['attachmentType'] = $attachmentType; + + return $this; } /** - * @return mixed + * Gets fileSha256 + * + * @return string */ public function getFileSha256() { - return $this->fileSha256; + return $this->container['fileSha256']; } /** - * @param mixed $fileSha256 + * Sets fileSha256 + * + * @param string $fileSha256 The SHA-256 hash value of the file, used to uniquely identify and verify its integrity and authenticity. For more information, see How to calculate the SHA256 digest of a file. More information: Maximum length: 64 characters + * + * @return self */ - public function setFileSha256($fileSha256) + public function setFileSha256($fileSha256) { - $this->fileSha256 = $fileSha256; + $this->container['fileSha256'] = $fileSha256; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayCaptureRequest.php b/request/pay/AlipayCaptureRequest.php index a7959ca..525a806 100644 --- a/request/pay/AlipayCaptureRequest.php +++ b/request/pay/AlipayCaptureRequest.php @@ -1,88 +1,513 @@ + */ +class AlipayCaptureRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayCaptureRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'captureRequestId' => 'string', + 'paymentId' => 'string', + 'captureAmount' => '\request\model\Amount', + 'isLastCapture' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'captureRequestId' => null, + 'paymentId' => null, + 'captureAmount' => null, + 'isLastCapture' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'captureRequestId' => false, + 'paymentId' => false, + 'captureAmount' => false, + 'isLastCapture' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $captureRequestId; - public $paymentId; - public $captureAmount; - public $isLastCapture; + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'captureRequestId' => 'captureRequestId', + 'paymentId' => 'paymentId', + 'captureAmount' => 'captureAmount', + 'isLastCapture' => 'isLastCapture' + ]; - function __construct() + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'captureRequestId' => 'setCaptureRequestId', + 'paymentId' => 'setPaymentId', + 'captureAmount' => 'setCaptureAmount', + 'isLastCapture' => 'setIsLastCapture' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'captureRequestId' => 'getCaptureRequestId', + 'paymentId' => 'getPaymentId', + 'captureAmount' => 'getCaptureAmount', + 'isLastCapture' => 'getIsLastCapture' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() { - $this->setPath(AntomPathConstants::CAPTURE_PATH); + return self::$setters; } + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } /** - * @return mixed + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('captureRequestId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('captureAmount', $data ?? [], null); + $this->setIfExists('isLastCapture', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/capture"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['captureRequestId'] === null) { + $invalidProperties[] = "'captureRequestId' can't be null"; + } + if ($this->container['paymentId'] === null) { + $invalidProperties[] = "'paymentId' can't be null"; + } + if ($this->container['captureAmount'] === null) { + $invalidProperties[] = "'captureAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets captureRequestId + * + * @return string */ public function getCaptureRequestId() { - return $this->captureRequestId; + return $this->container['captureRequestId']; } /** - * @param mixed $captureRequestId + * Sets captureRequestId + * + * @param string $captureRequestId The unique ID that is assigned by the merchant to identify a capture request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For capture requests that are initiated with the same value of captureRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ public function setCaptureRequestId($captureRequestId) { - $this->captureRequestId = $captureRequestId; + $this->container['captureRequestId'] = $captureRequestId; + + return $this; } /** - * @return mixed + * Gets paymentId + * + * @return string */ public function getPaymentId() { - return $this->paymentId; + return $this->container['paymentId']; } /** - * @param mixed $paymentId + * Sets paymentId + * + * @param string $paymentId The unique ID that is assigned by Antom to identify a payment. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentId($paymentId) { - $this->paymentId = $paymentId; + $this->container['paymentId'] = $paymentId; + + return $this; } /** - * @return mixed + * Gets captureAmount + * + * @return \request\model\Amount */ public function getCaptureAmount() { - return $this->captureAmount; + return $this->container['captureAmount']; } /** - * @param mixed $captureAmount + * Sets captureAmount + * + * @param \request\model\Amount $captureAmount captureAmount + * + * @return self */ public function setCaptureAmount($captureAmount) { - $this->captureAmount = $captureAmount; + $this->container['captureAmount'] = $captureAmount; + + return $this; } /** - * @return mixed + * Gets isLastCapture + * + * @return bool|null */ public function getIsLastCapture() { - return $this->isLastCapture; + return $this->container['isLastCapture']; } /** - * @param mixed $isLastCapture + * Sets isLastCapture + * + * @param bool|null $isLastCapture isLastCapture + * + * @return self */ public function setIsLastCapture($isLastCapture) { - $this->isLastCapture = $isLastCapture; + $this->container['isLastCapture'] = $isLastCapture; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayInquiryRefundRequest.php b/request/pay/AlipayInquiryRefundRequest.php index 4501c5a..6c33988 100644 --- a/request/pay/AlipayInquiryRefundRequest.php +++ b/request/pay/AlipayInquiryRefundRequest.php @@ -1,81 +1,473 @@ + */ +class AlipayInquiryRefundRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayInquiryRefundRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'refundRequestId' => 'string', + 'refundId' => 'string', + 'merchantAccountId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'refundRequestId' => null, + 'refundId' => null, + 'merchantAccountId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'refundRequestId' => false, + 'refundId' => false, + 'merchantAccountId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } /** - * The unique ID assigned by a merchant to identify a refund request + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public $refundRequestId; + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } /** - * The unique ID assigned by Alipay to identify a refund + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public $refundId; + protected static $attributeMap = [ + 'refundRequestId' => 'refundRequestId', + 'refundId' => 'refundId', + 'merchantAccountId' => 'merchantAccountId' + ]; /** - * The unique ID to identify a merchant account. + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] */ - public $merchantAccountId; + protected static $setters = [ + 'refundRequestId' => 'setRefundRequestId', + 'refundId' => 'setRefundId', + 'merchantAccountId' => 'setMerchantAccountId' + ]; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'refundRequestId' => 'getRefundRequestId', + 'refundId' => 'getRefundId', + 'merchantAccountId' => 'getMerchantAccountId' + ]; - function __construct() + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() { - $this->setPath(AntomPathConstants::INQUIRY_REFUND_PATH); + return self::$setters; } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('refundRequestId', $data ?? [], null); + $this->setIfExists('refundId', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/inquiryRefund"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets refundRequestId + * + * @return string|null */ public function getRefundRequestId() { - return $this->refundRequestId; + return $this->container['refundRequestId']; } /** - * @param mixed $refundRequestId + * Sets refundRequestId + * + * @param string|null $refundRequestId The unique ID assigned by a merchant to identify a refund request. refundRequestId and refundId cannot both be null. Special characters are not supported. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + * + * @return self */ - public function setRefundRequestId($refundRequestId) + public function setRefundRequestId($refundRequestId) { - $this->refundRequestId = $refundRequestId; + $this->container['refundRequestId'] = $refundRequestId; + + return $this; } /** - * @return mixed + * Gets refundId + * + * @return string|null */ public function getRefundId() { - return $this->refundId; + return $this->container['refundId']; } /** - * @param mixed $refundId + * Sets refundId + * + * @param string|null $refundId The unique ID assigned by Antom to identify a refund. refundRequestId and refundId cannot both be null. A one-to-one correspondence between refundId and refundRequestId exists. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + * + * @return self */ - public function setRefundId($refundId) + public function setRefundId($refundId) { - $this->refundId = $refundId; + $this->container['refundId'] = $refundId; + + return $this; } /** - * @return mixed + * Gets merchantAccountId + * + * @return string|null */ public function getMerchantAccountId() { - return $this->merchantAccountId; + return $this->container['merchantAccountId']; } /** - * @param mixed $merchantAccountId + * Sets merchantAccountId + * + * @param string|null $merchantAccountId merchantAccountId + * + * @return self */ - public function setMerchantAccountId($merchantAccountId) + public function setMerchantAccountId($merchantAccountId) { - $this->merchantAccountId = $merchantAccountId; + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } -} \ No newline at end of file + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayPayCancelRequest.php b/request/pay/AlipayPayCancelRequest.php index a71161b..532334a 100644 --- a/request/pay/AlipayPayCancelRequest.php +++ b/request/pay/AlipayPayCancelRequest.php @@ -1,71 +1,473 @@ + */ +class AlipayPayCancelRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayCancelRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentId' => 'string', + 'paymentRequestId' => 'string', + 'merchantAccountId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentId' => null, + 'paymentRequestId' => null, + 'merchantAccountId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentId' => false, + 'paymentRequestId' => false, + 'merchantAccountId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentId' => 'paymentId', + 'paymentRequestId' => 'paymentRequestId', + 'merchantAccountId' => 'merchantAccountId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentId' => 'setPaymentId', + 'paymentRequestId' => 'setPaymentRequestId', + 'merchantAccountId' => 'setMerchantAccountId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentId' => 'getPaymentId', + 'paymentRequestId' => 'getPaymentRequestId', + 'merchantAccountId' => 'getMerchantAccountId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $paymentId; - public $paymentRequestId; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $merchantAccountId; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } - function __construct() + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - $this->setPath(AntomPathConstants::CANCEL_PATH); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('paymentRequestId', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/cancel"); } + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } /** - * @return mixed + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentId + * + * @return string|null */ public function getPaymentId() { - return $this->paymentId; + return $this->container['paymentId']; } /** - * @param mixed $paymentId + * Sets paymentId + * + * @param string|null $paymentId The original payment ID of the payment request to be canceled, generated by Antom to uniquely identify the payment when the merchant initiates the original payment. paymentId and paymentRequestId cannot both be null. A one-to-one correspondence between paymentId and paymentRequestId exists. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentId($paymentId) { - $this->paymentId = $paymentId; + $this->container['paymentId'] = $paymentId; + + return $this; } /** - * @return mixed + * Gets paymentRequestId + * + * @return string|null */ public function getPaymentRequestId() { - return $this->paymentRequestId; + return $this->container['paymentRequestId']; } /** - * @param mixed $paymentRequestId + * Sets paymentRequestId + * + * @param string|null $paymentRequestId The original payment request ID of the payment request to be canceled, generated by the merchant to uniquely identify a payment request. paymentRequestId and paymentId cannot both be null. If both paymentRequestId and paymentId are provided, paymentId takes precedence. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentRequestId($paymentRequestId) { - $this->paymentRequestId = $paymentRequestId; + $this->container['paymentRequestId'] = $paymentRequestId; + + return $this; } /** - * @return mixed + * Gets merchantAccountId + * + * @return string|null */ public function getMerchantAccountId() { - return $this->merchantAccountId; + return $this->container['merchantAccountId']; } /** - * @param mixed $merchantAccountId + * Sets merchantAccountId + * + * @param string|null $merchantAccountId The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + * + * @return self */ public function setMerchantAccountId($merchantAccountId) { - $this->merchantAccountId = $merchantAccountId; + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayPayConsultRequest.php b/request/pay/AlipayPayConsultRequest.php index 868a55c..34ac8ed 100644 --- a/request/pay/AlipayPayConsultRequest.php +++ b/request/pay/AlipayPayConsultRequest.php @@ -1,330 +1,947 @@ + */ +class AlipayPayConsultRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayConsultRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productCode' => '\request\model\ProductCodeType', + 'paymentAmount' => '\request\model\Amount', + 'merchantRegion' => 'string', + 'allowedPaymentMethodRegions' => 'string[]', + 'allowedPaymentMethods' => 'string[]', + 'blockedPaymentMethods' => 'string[]', + 'region' => 'string', + 'customerId' => 'string', + 'referenceUserId' => 'string', + 'env' => '\request\model\Env', + 'extendInfo' => 'string', + 'userRegion' => 'string', + 'paymentFactor' => '\request\model\PaymentFactor', + 'settlementStrategy' => '\request\model\SettlementStrategy', + 'merchant' => '\request\model\Merchant', + 'allowedPspRegions' => 'string[]', + 'buyer' => '\request\model\Buyer', + 'merchantAccountId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productCode' => null, + 'paymentAmount' => null, + 'merchantRegion' => null, + 'allowedPaymentMethodRegions' => null, + 'allowedPaymentMethods' => null, + 'blockedPaymentMethods' => null, + 'region' => null, + 'customerId' => null, + 'referenceUserId' => null, + 'env' => null, + 'extendInfo' => null, + 'userRegion' => null, + 'paymentFactor' => null, + 'settlementStrategy' => null, + 'merchant' => null, + 'allowedPspRegions' => null, + 'buyer' => null, + 'merchantAccountId' => null + ]; - public $productCode; - public $paymentAmount; - public $allowedPaymentMethods; - public $allowedPaymentMethodRegions; - public $blockedPaymentMethods; - public $region; - public $customerId; - public $referenceUserId; - public $env; - public $extendInfo; - public $userRegion; - public $paymentFactor; - public $settlementStrategy; - public $merchant; - public $allowedPspRegions; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'productCode' => false, + 'paymentAmount' => false, + 'merchantRegion' => false, + 'allowedPaymentMethodRegions' => false, + 'allowedPaymentMethods' => false, + 'blockedPaymentMethods' => false, + 'region' => false, + 'customerId' => false, + 'referenceUserId' => false, + 'env' => false, + 'extendInfo' => false, + 'userRegion' => false, + 'paymentFactor' => false, + 'settlementStrategy' => false, + 'merchant' => false, + 'allowedPspRegions' => false, + 'buyer' => false, + 'merchantAccountId' => false + ]; - public $merchantAccountId; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - public $merchantRegion; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } - public $buyer; + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'productCode' => 'productCode', + 'paymentAmount' => 'paymentAmount', + 'merchantRegion' => 'merchantRegion', + 'allowedPaymentMethodRegions' => 'allowedPaymentMethodRegions', + 'allowedPaymentMethods' => 'allowedPaymentMethods', + 'blockedPaymentMethods' => 'blockedPaymentMethods', + 'region' => 'region', + 'customerId' => 'customerId', + 'referenceUserId' => 'referenceUserId', + 'env' => 'env', + 'extendInfo' => 'extendInfo', + 'userRegion' => 'userRegion', + 'paymentFactor' => 'paymentFactor', + 'settlementStrategy' => 'settlementStrategy', + 'merchant' => 'merchant', + 'allowedPspRegions' => 'allowedPspRegions', + 'buyer' => 'buyer', + 'merchantAccountId' => 'merchantAccountId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'productCode' => 'setProductCode', + 'paymentAmount' => 'setPaymentAmount', + 'merchantRegion' => 'setMerchantRegion', + 'allowedPaymentMethodRegions' => 'setAllowedPaymentMethodRegions', + 'allowedPaymentMethods' => 'setAllowedPaymentMethods', + 'blockedPaymentMethods' => 'setBlockedPaymentMethods', + 'region' => 'setRegion', + 'customerId' => 'setCustomerId', + 'referenceUserId' => 'setReferenceUserId', + 'env' => 'setEnv', + 'extendInfo' => 'setExtendInfo', + 'userRegion' => 'setUserRegion', + 'paymentFactor' => 'setPaymentFactor', + 'settlementStrategy' => 'setSettlementStrategy', + 'merchant' => 'setMerchant', + 'allowedPspRegions' => 'setAllowedPspRegions', + 'buyer' => 'setBuyer', + 'merchantAccountId' => 'setMerchantAccountId' + ]; - function __construct() + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'productCode' => 'getProductCode', + 'paymentAmount' => 'getPaymentAmount', + 'merchantRegion' => 'getMerchantRegion', + 'allowedPaymentMethodRegions' => 'getAllowedPaymentMethodRegions', + 'allowedPaymentMethods' => 'getAllowedPaymentMethods', + 'blockedPaymentMethods' => 'getBlockedPaymentMethods', + 'region' => 'getRegion', + 'customerId' => 'getCustomerId', + 'referenceUserId' => 'getReferenceUserId', + 'env' => 'getEnv', + 'extendInfo' => 'getExtendInfo', + 'userRegion' => 'getUserRegion', + 'paymentFactor' => 'getPaymentFactor', + 'settlementStrategy' => 'getSettlementStrategy', + 'merchant' => 'getMerchant', + 'allowedPspRegions' => 'getAllowedPspRegions', + 'buyer' => 'getBuyer', + 'merchantAccountId' => 'getMerchantAccountId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() { - $this->setPath(AntomPathConstants::CONSULT_PAYMENT_PATH); + return self::$attributeMap; } + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public function getMerchantRegion() + public static function getters() { - return $this->merchantRegion; + return self::$getters; } /** - * @param mixed $merchantRegion + * The original name of the model. + * + * @return string */ - public function setMerchantRegion($merchantRegion) + public function getModelName() { - $this->merchantRegion = $merchantRegion; + return self::$openAPIModelName; } + /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] */ - public function getAllowedPaymentMethodRegions() + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - return $this->allowedPaymentMethodRegions; + $this->setIfExists('productCode', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('merchantRegion', $data ?? [], null); + $this->setIfExists('allowedPaymentMethodRegions', $data ?? [], null); + $this->setIfExists('allowedPaymentMethods', $data ?? [], null); + $this->setIfExists('blockedPaymentMethods', $data ?? [], null); + $this->setIfExists('region', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referenceUserId', $data ?? [], null); + $this->setIfExists('env', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('userRegion', $data ?? [], null); + $this->setIfExists('paymentFactor', $data ?? [], null); + $this->setIfExists('settlementStrategy', $data ?? [], null); + $this->setIfExists('merchant', $data ?? [], null); + $this->setIfExists('allowedPspRegions', $data ?? [], null); + $this->setIfExists('buyer', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/consult"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** - * @param mixed $allowedPaymentMethodRegions + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public function setAllowedPaymentMethodRegions($allowedPaymentMethodRegions) + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['productCode'] === null) { + $invalidProperties[] = "'productCode' can't be null"; + } + if ($this->container['paymentAmount'] === null) { + $invalidProperties[] = "'paymentAmount' can't be null"; + } + if ($this->container['env'] === null) { + $invalidProperties[] = "'env' 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() { - $this->allowedPaymentMethodRegions = $allowedPaymentMethodRegions; + return count($this->listInvalidProperties()) === 0; } /** - * @return mixed + * Gets productCode + * + * @return \request\model\ProductCodeType */ public function getProductCode() { - return $this->productCode; + return $this->container['productCode']; } /** - * @param mixed $productCode + * Sets productCode + * + * @param \request\model\ProductCodeType $productCode productCode + * + * @return self */ public function setProductCode($productCode) { - $this->productCode = $productCode; + $this->container['productCode'] = $productCode; + + return $this; } /** - * @return mixed + * Gets paymentAmount + * + * @return \request\model\Amount */ public function getPaymentAmount() { - return $this->paymentAmount; + return $this->container['paymentAmount']; } /** - * @param mixed $paymentAmount + * Sets paymentAmount + * + * @param \request\model\Amount $paymentAmount paymentAmount + * + * @return self */ public function setPaymentAmount($paymentAmount) { - $this->paymentAmount = $paymentAmount; + $this->container['paymentAmount'] = $paymentAmount; + + return $this; + } + + /** + * Gets merchantRegion + * + * @return string|null + */ + public function getMerchantRegion() + { + return $this->container['merchantRegion']; + } + + /** + * Sets merchantRegion + * + * @param string|null $merchantRegion The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: This parameter is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + * + * @return self + */ + public function setMerchantRegion($merchantRegion) + { + $this->container['merchantRegion'] = $merchantRegion; + + return $this; + } + + /** + * Gets allowedPaymentMethodRegions + * + * @return string[]|null + */ + public function getAllowedPaymentMethodRegions() + { + return $this->container['allowedPaymentMethodRegions']; + } + + /** + * Sets allowedPaymentMethodRegions + * + * @param string[]|null $allowedPaymentMethodRegions A list of region codes that represent the countries or regions of payment methods. The value of this parameter is a 2-letter ISO country code or GLOBAL. Note: Specify this parameter if you want available payment methods from specific regions to be returned. For example, if you pass in GLOBAL, global cards Visa and Mastercard are returned. More information: Maximum length: 6 characters + * + * @return self + */ + public function setAllowedPaymentMethodRegions($allowedPaymentMethodRegions) + { + $this->container['allowedPaymentMethodRegions'] = $allowedPaymentMethodRegions; + + return $this; } /** - * @return mixed + * Gets allowedPaymentMethods + * + * @return string[]|null */ public function getAllowedPaymentMethods() { - return $this->allowedPaymentMethods; + return $this->container['allowedPaymentMethods']; } /** - * @param mixed $allowedPaymentMethods + * Sets allowedPaymentMethods + * + * @param string[]|null $allowedPaymentMethods allowedPaymentMethods + * + * @return self */ public function setAllowedPaymentMethods($allowedPaymentMethods) { - $this->allowedPaymentMethods = $allowedPaymentMethods; + $this->container['allowedPaymentMethods'] = $allowedPaymentMethods; + + return $this; } /** - * @return mixed + * Gets blockedPaymentMethods + * + * @return string[]|null */ public function getBlockedPaymentMethods() { - return $this->blockedPaymentMethods; + return $this->container['blockedPaymentMethods']; } /** - * @param mixed $blockedPaymentMethods + * Sets blockedPaymentMethods + * + * @param string[]|null $blockedPaymentMethods blockedPaymentMethods + * + * @return self */ public function setBlockedPaymentMethods($blockedPaymentMethods) { - $this->blockedPaymentMethods = $blockedPaymentMethods; + $this->container['blockedPaymentMethods'] = $blockedPaymentMethods; + + return $this; } /** - * @return mixed + * Gets region + * + * @return string|null */ public function getRegion() { - return $this->region; + return $this->container['region']; } /** - * @param mixed $region + * Sets region + * + * @param string|null $region region + * + * @return self */ public function setRegion($region) { - $this->region = $region; + $this->container['region'] = $region; + + return $this; } /** - * @return mixed + * Gets customerId + * + * @return string|null */ public function getCustomerId() { - return $this->customerId; + return $this->container['customerId']; } /** - * @param mixed $customerId + * Sets customerId + * + * @param string|null $customerId customerId + * + * @return self */ public function setCustomerId($customerId) { - $this->customerId = $customerId; + $this->container['customerId'] = $customerId; + + return $this; } /** - * @return mixed + * Gets referenceUserId + * + * @return string|null */ public function getReferenceUserId() { - return $this->referenceUserId; + return $this->container['referenceUserId']; } /** - * @param mixed $referenceUserId + * Sets referenceUserId + * + * @param string|null $referenceUserId referenceUserId + * + * @return self */ public function setReferenceUserId($referenceUserId) { - $this->referenceUserId = $referenceUserId; + $this->container['referenceUserId'] = $referenceUserId; + + return $this; } /** - * @return mixed + * Gets env + * + * @return \request\model\Env */ public function getEnv() { - return $this->env; + return $this->container['env']; } /** - * @param mixed $env + * Sets env + * + * @param \request\model\Env $env env + * + * @return self */ public function setEnv($env) { - $this->env = $env; + $this->container['env'] = $env; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ public function getExtendInfo() { - return $this->extendInfo; + return $this->container['extendInfo']; } /** - * @param mixed $extendInfo + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ public function setExtendInfo($extendInfo) { - $this->extendInfo = $extendInfo; + $this->container['extendInfo'] = $extendInfo; + + return $this; } /** - * @return mixed + * Gets userRegion + * + * @return string|null */ public function getUserRegion() { - return $this->userRegion; + return $this->container['userRegion']; } /** - * @param mixed $userRegion + * Sets userRegion + * + * @param string|null $userRegion The 2-letter country or region code. For more information, see ISO 3166 Country Codes standard. The payment methods will be sorted based on payment method relevance for the given user's region. More information: Maximum length: 2 characters + * + * @return self */ public function setUserRegion($userRegion) { - $this->userRegion = $userRegion; + $this->container['userRegion'] = $userRegion; + + return $this; } /** - * @return mixed + * Gets paymentFactor + * + * @return \request\model\PaymentFactor|null */ public function getPaymentFactor() { - return $this->paymentFactor; + return $this->container['paymentFactor']; } /** - * @param mixed $paymentFactor + * Sets paymentFactor + * + * @param \request\model\PaymentFactor|null $paymentFactor paymentFactor + * + * @return self */ public function setPaymentFactor($paymentFactor) { - $this->paymentFactor = $paymentFactor; + $this->container['paymentFactor'] = $paymentFactor; + + return $this; } /** - * @return mixed + * Gets settlementStrategy + * + * @return \request\model\SettlementStrategy|null */ public function getSettlementStrategy() { - return $this->settlementStrategy; + return $this->container['settlementStrategy']; } /** - * @param mixed $settlementStrategy + * Sets settlementStrategy + * + * @param \request\model\SettlementStrategy|null $settlementStrategy settlementStrategy + * + * @return self */ public function setSettlementStrategy($settlementStrategy) { - $this->settlementStrategy = $settlementStrategy; + $this->container['settlementStrategy'] = $settlementStrategy; + + return $this; } /** - * @return mixed + * Gets merchant + * + * @return \request\model\Merchant|null */ public function getMerchant() { - return $this->merchant; + return $this->container['merchant']; } /** - * @param mixed $merchant + * Sets merchant + * + * @param \request\model\Merchant|null $merchant merchant + * + * @return self */ public function setMerchant($merchant) { - $this->merchant = $merchant; + $this->container['merchant'] = $merchant; + + return $this; } /** - * @return mixed + * Gets allowedPspRegions + * + * @return string[]|null */ public function getAllowedPspRegions() { - return $this->allowedPspRegions; + return $this->container['allowedPspRegions']; } /** - * @param mixed $allowedPspRegions + * Sets allowedPspRegions + * + * @param string[]|null $allowedPspRegions allowedPspRegions + * + * @return self */ public function setAllowedPspRegions($allowedPspRegions) { - $this->allowedPspRegions = $allowedPspRegions; + $this->container['allowedPspRegions'] = $allowedPspRegions; + + return $this; } /** - * @return mixed + * Gets buyer + * + * @return \request\model\Buyer|null + */ + public function getBuyer() + { + return $this->container['buyer']; + } + + /** + * Sets buyer + * + * @param \request\model\Buyer|null $buyer buyer + * + * @return self + */ + public function setBuyer($buyer) + { + $this->container['buyer'] = $buyer; + + return $this; + } + + /** + * Gets merchantAccountId + * + * @return string|null */ public function getMerchantAccountId() { - return $this->merchantAccountId; + return $this->container['merchantAccountId']; } /** - * @param mixed $merchantAccountId + * Sets merchantAccountId + * + * @param string|null $merchantAccountId The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + * + * @return self */ public function setMerchantAccountId($merchantAccountId) { - $this->merchantAccountId = $merchantAccountId; + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } /** - * @return mixed + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null */ - public function getBuyer() + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - return $this->buyer; + return $this->container[$offset] ?? null; } /** - * @param mixed $buyer + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setBuyer($buyer) + public function offsetSet($offset, $value): void { - $this->buyer = $buyer; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayPayQueryRequest.php b/request/pay/AlipayPayQueryRequest.php index 2b11f25..8c396ef 100644 --- a/request/pay/AlipayPayQueryRequest.php +++ b/request/pay/AlipayPayQueryRequest.php @@ -1,71 +1,473 @@ + */ +class AlipayPayQueryRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayQueryRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentRequestId' => 'string', + 'paymentId' => 'string', + 'merchantAccountId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentRequestId' => null, + 'paymentId' => null, + 'merchantAccountId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentRequestId' => false, + 'paymentId' => false, + 'merchantAccountId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentRequestId' => 'paymentRequestId', + 'paymentId' => 'paymentId', + 'merchantAccountId' => 'merchantAccountId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentRequestId' => 'setPaymentRequestId', + 'paymentId' => 'setPaymentId', + 'merchantAccountId' => 'setMerchantAccountId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentRequestId' => 'getPaymentRequestId', + 'paymentId' => 'getPaymentId', + 'merchantAccountId' => 'getMerchantAccountId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } - public $paymentRequestId; - public $paymentId; + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } - public $merchantAccountId; + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; - function __construct() + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - $this->setPath(AntomPathConstants::INQUIRY_PAYMENT_PATH); + $this->setIfExists('paymentRequestId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/inquiryPayment"); } /** - * @return mixed + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentRequestId + * + * @return string|null */ public function getPaymentRequestId() { - return $this->paymentRequestId; + return $this->container['paymentRequestId']; } /** - * @param mixed $paymentRequestId + * Sets paymentRequestId + * + * @param string|null $paymentRequestId The unique ID that is assigned by a merchant to identify a payment request. paymentRequestId and paymentId cannot both be null. If both paymentRequestId and paymentId are specified, paymentId takes precedence. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentRequestId($paymentRequestId) { - $this->paymentRequestId = $paymentRequestId; + $this->container['paymentRequestId'] = $paymentRequestId; + + return $this; } /** - * @return mixed + * Gets paymentId + * + * @return string|null */ public function getPaymentId() { - return $this->paymentId; + return $this->container['paymentId']; } /** - * @param mixed $paymentId + * Sets paymentId + * + * @param string|null $paymentId The unique ID that is assigned by Antom to identify a payment. paymentRequestId and paymentId cannot both be null. A one-to-one correspondence between paymentId and paymentRequestId exists. If both paymentRequestId and paymentId are specified, paymentId takes precedence. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentId($paymentId) { - $this->paymentId = $paymentId; + $this->container['paymentId'] = $paymentId; + + return $this; } /** - * @return mixed + * Gets merchantAccountId + * + * @return string|null */ public function getMerchantAccountId() { - return $this->merchantAccountId; + return $this->container['merchantAccountId']; } /** - * @param mixed $merchantAccountId + * Sets merchantAccountId + * + * @param string|null $merchantAccountId The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + * + * @return self */ public function setMerchantAccountId($merchantAccountId) { - $this->merchantAccountId = $merchantAccountId; + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayPayRequest.php b/request/pay/AlipayPayRequest.php index 50f2fb5..68e9bc8 100644 --- a/request/pay/AlipayPayRequest.php +++ b/request/pay/AlipayPayRequest.php @@ -1,400 +1,1086 @@ + */ +class AlipayPayRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; - public $productCode; - public $paymentRequestId; - public $order; - public $paymentAmount; - public $payToMethod; - public $paymentMethod; - public $paymentExpiryTime; - public $paymentRedirectUrl; - public $paymentNotifyUrl; - public $isAuthorization; - public $paymentVerificationData; - public $paymentFactor; - public $merchant; - public $extendInfo; - public $creditPayPlan; - public $settlementStrategy; - public $appId; - public $merchantRegion; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayRequest'; - public $env; - public $merchantAccountId; + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productCode' => '\request\model\ProductCodeType', + 'paymentRequestId' => 'string', + 'order' => '\request\model\Order', + 'paymentAmount' => '\request\model\Amount', + 'paymentMethod' => '\request\model\PaymentMethod', + 'paymentExpiryTime' => 'string', + 'paymentRedirectUrl' => 'string', + 'paymentNotifyUrl' => 'string', + 'paymentFactor' => '\request\model\PaymentFactor', + 'settlementStrategy' => '\request\model\SettlementStrategy', + 'creditPayPlan' => '\request\model\CreditPayPlan', + 'appId' => 'string', + 'merchantRegion' => 'string', + 'userRegion' => 'string', + 'env' => '\request\model\Env', + 'payToMethod' => '\request\model\PaymentMethod', + 'isAuthorization' => 'bool', + 'merchant' => '\request\model\Merchant', + 'paymentVerificationData' => '\request\model\PaymentVerificationData', + 'extendInfo' => 'string', + 'merchantAccountId' => 'string', + 'dualOfflinePayment' => 'bool' + ]; - public $userRegion; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productCode' => null, + 'paymentRequestId' => null, + 'order' => null, + 'paymentAmount' => null, + 'paymentMethod' => null, + 'paymentExpiryTime' => null, + 'paymentRedirectUrl' => null, + 'paymentNotifyUrl' => null, + 'paymentFactor' => null, + 'settlementStrategy' => null, + 'creditPayPlan' => null, + 'appId' => null, + 'merchantRegion' => null, + 'userRegion' => null, + 'env' => null, + 'payToMethod' => null, + 'isAuthorization' => null, + 'merchant' => null, + 'paymentVerificationData' => null, + 'extendInfo' => null, + 'merchantAccountId' => null, + 'dualOfflinePayment' => null + ]; - public $subscriptionInfo; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'productCode' => false, + 'paymentRequestId' => false, + 'order' => false, + 'paymentAmount' => false, + 'paymentMethod' => false, + 'paymentExpiryTime' => false, + 'paymentRedirectUrl' => false, + 'paymentNotifyUrl' => false, + 'paymentFactor' => false, + 'settlementStrategy' => false, + 'creditPayPlan' => false, + 'appId' => false, + 'merchantRegion' => false, + 'userRegion' => false, + 'env' => false, + 'payToMethod' => false, + 'isAuthorization' => false, + 'merchant' => false, + 'paymentVerificationData' => false, + 'extendInfo' => false, + 'merchantAccountId' => false, + 'dualOfflinePayment' => false + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - function __construct() + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() { - $this->setPath(AntomPathConstants::PAYMENT_PATH); + return self::$openAPITypes; } + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** - * @return mixed + * Array of nullable properties + * + * @return array */ - public function getAppId() + protected static function openAPINullables(): array { - return $this->appId; + return self::$openAPINullables; } /** - * @param mixed $appId + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public function setAppId($appId) + private function getOpenAPINullablesSetToNull(): array { - $this->appId = $appId; + return $this->openAPINullablesSetToNull; } + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } /** - * @return mixed + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public function getMerchantRegion() + public static function isNullable(string $property): bool { - return $this->merchantRegion; + return self::openAPINullables()[$property] ?? false; } /** - * @param mixed $merchantRegion + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public function setMerchantRegion($merchantRegion) + public function isNullableSetToNull(string $property): bool { - $this->merchantRegion = $merchantRegion; + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); } /** - * @return mixed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public function getProductCode() + protected static $attributeMap = [ + 'productCode' => 'productCode', + 'paymentRequestId' => 'paymentRequestId', + 'order' => 'order', + 'paymentAmount' => 'paymentAmount', + 'paymentMethod' => 'paymentMethod', + 'paymentExpiryTime' => 'paymentExpiryTime', + 'paymentRedirectUrl' => 'paymentRedirectUrl', + 'paymentNotifyUrl' => 'paymentNotifyUrl', + 'paymentFactor' => 'paymentFactor', + 'settlementStrategy' => 'settlementStrategy', + 'creditPayPlan' => 'creditPayPlan', + 'appId' => 'appId', + 'merchantRegion' => 'merchantRegion', + 'userRegion' => 'userRegion', + 'env' => 'env', + 'payToMethod' => 'payToMethod', + 'isAuthorization' => 'isAuthorization', + 'merchant' => 'merchant', + 'paymentVerificationData' => 'paymentVerificationData', + 'extendInfo' => 'extendInfo', + 'merchantAccountId' => 'merchantAccountId', + 'dualOfflinePayment' => 'dualOfflinePayment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'productCode' => 'setProductCode', + 'paymentRequestId' => 'setPaymentRequestId', + 'order' => 'setOrder', + 'paymentAmount' => 'setPaymentAmount', + 'paymentMethod' => 'setPaymentMethod', + 'paymentExpiryTime' => 'setPaymentExpiryTime', + 'paymentRedirectUrl' => 'setPaymentRedirectUrl', + 'paymentNotifyUrl' => 'setPaymentNotifyUrl', + 'paymentFactor' => 'setPaymentFactor', + 'settlementStrategy' => 'setSettlementStrategy', + 'creditPayPlan' => 'setCreditPayPlan', + 'appId' => 'setAppId', + 'merchantRegion' => 'setMerchantRegion', + 'userRegion' => 'setUserRegion', + 'env' => 'setEnv', + 'payToMethod' => 'setPayToMethod', + 'isAuthorization' => 'setIsAuthorization', + 'merchant' => 'setMerchant', + 'paymentVerificationData' => 'setPaymentVerificationData', + 'extendInfo' => 'setExtendInfo', + 'merchantAccountId' => 'setMerchantAccountId', + 'dualOfflinePayment' => 'setDualOfflinePayment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'productCode' => 'getProductCode', + 'paymentRequestId' => 'getPaymentRequestId', + 'order' => 'getOrder', + 'paymentAmount' => 'getPaymentAmount', + 'paymentMethod' => 'getPaymentMethod', + 'paymentExpiryTime' => 'getPaymentExpiryTime', + 'paymentRedirectUrl' => 'getPaymentRedirectUrl', + 'paymentNotifyUrl' => 'getPaymentNotifyUrl', + 'paymentFactor' => 'getPaymentFactor', + 'settlementStrategy' => 'getSettlementStrategy', + 'creditPayPlan' => 'getCreditPayPlan', + 'appId' => 'getAppId', + 'merchantRegion' => 'getMerchantRegion', + 'userRegion' => 'getUserRegion', + 'env' => 'getEnv', + 'payToMethod' => 'getPayToMethod', + 'isAuthorization' => 'getIsAuthorization', + 'merchant' => 'getMerchant', + 'paymentVerificationData' => 'getPaymentVerificationData', + 'extendInfo' => 'getExtendInfo', + 'merchantAccountId' => 'getMerchantAccountId', + 'dualOfflinePayment' => 'getDualOfflinePayment' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() { - return $this->productCode; + return self::$attributeMap; } /** - * @param mixed $productCode + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public function setProductCode($productCode) + public static function setters() { - $this->productCode = $productCode; + return self::$setters; } /** - * @return mixed + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public function getPaymentRequestId() + public static function getters() { - return $this->paymentRequestId; + return self::$getters; } /** - * @param mixed $paymentRequestId + * The original name of the model. + * + * @return string */ - public function setPaymentRequestId($paymentRequestId) + public function getModelName() { - $this->paymentRequestId = $paymentRequestId; + return self::$openAPIModelName; } + /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] */ - public function getOrder() + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - return $this->order; + $this->setIfExists('productCode', $data ?? [], null); + $this->setIfExists('paymentRequestId', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('paymentExpiryTime', $data ?? [], null); + $this->setIfExists('paymentRedirectUrl', $data ?? [], null); + $this->setIfExists('paymentNotifyUrl', $data ?? [], null); + $this->setIfExists('paymentFactor', $data ?? [], null); + $this->setIfExists('settlementStrategy', $data ?? [], null); + $this->setIfExists('creditPayPlan', $data ?? [], null); + $this->setIfExists('appId', $data ?? [], null); + $this->setIfExists('merchantRegion', $data ?? [], null); + $this->setIfExists('userRegion', $data ?? [], null); + $this->setIfExists('env', $data ?? [], null); + $this->setIfExists('payToMethod', $data ?? [], null); + $this->setIfExists('isAuthorization', $data ?? [], null); + $this->setIfExists('merchant', $data ?? [], null); + $this->setIfExists('paymentVerificationData', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + $this->setIfExists('dualOfflinePayment', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/pay"); } /** - * @param mixed $order + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public function setOrder($order) + public function listInvalidProperties() { - $this->order = $order; + $invalidProperties = []; + + if ($this->container['productCode'] === null) { + $invalidProperties[] = "'productCode' can't be null"; + } + if ($this->container['paymentRequestId'] === null) { + $invalidProperties[] = "'paymentRequestId' can't be null"; + } + if ($this->container['order'] === null) { + $invalidProperties[] = "'order' can't be null"; + } + if ($this->container['paymentAmount'] === null) { + $invalidProperties[] = "'paymentAmount' can't be null"; + } + if ($this->container['paymentMethod'] === null) { + $invalidProperties[] = "'paymentMethod' can't be null"; + } + if ($this->container['paymentRedirectUrl'] === null) { + $invalidProperties[] = "'paymentRedirectUrl' can't be null"; + } + if ($this->container['settlementStrategy'] === null) { + $invalidProperties[] = "'settlementStrategy' can't be null"; + } + if ($this->container['env'] === null) { + $invalidProperties[] = "'env' can't be null"; + } + return $invalidProperties; } /** - * @return mixed + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid */ - public function getPaymentAmount() + public function valid() { - return $this->paymentAmount; + return count($this->listInvalidProperties()) === 0; } + /** - * @param mixed $paymentAmount + * Gets productCode + * + * @return \request\model\ProductCodeType */ - public function setPaymentAmount($paymentAmount) + public function getProductCode() { - $this->paymentAmount = $paymentAmount; + return $this->container['productCode']; } /** - * @return mixed + * Sets productCode + * + * @param \request\model\ProductCodeType $productCode productCode + * + * @return self */ - public function getPayToMethod() + public function setProductCode($productCode) { - return $this->payToMethod; + $this->container['productCode'] = $productCode; + + return $this; } /** - * @param mixed $payToMethod + * Gets paymentRequestId + * + * @return string */ - public function setPayToMethod($payToMethod) + public function getPaymentRequestId() + { + return $this->container['paymentRequestId']; + } + + /** + * Sets paymentRequestId + * + * @param string $paymentRequestId The unique ID assigned by a merchant to identify a payment request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For payment requests that are initiated with the same value of paymentRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self + */ + public function setPaymentRequestId($paymentRequestId) + { + $this->container['paymentRequestId'] = $paymentRequestId; + + return $this; + } + + /** + * Gets order + * + * @return \request\model\Order + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \request\model\Order $order order + * + * @return self + */ + public function setOrder($order) + { + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets paymentAmount + * + * @return \request\model\Amount + */ + public function getPaymentAmount() { - $this->payToMethod = $payToMethod; + return $this->container['paymentAmount']; } /** - * @return mixed + * Sets paymentAmount + * + * @param \request\model\Amount $paymentAmount paymentAmount + * + * @return self + */ + public function setPaymentAmount($paymentAmount) + { + $this->container['paymentAmount'] = $paymentAmount; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \request\model\PaymentMethod */ public function getPaymentMethod() { - return $this->paymentMethod; + return $this->container['paymentMethod']; } /** - * @param mixed $paymentMethod + * Sets paymentMethod + * + * @param \request\model\PaymentMethod $paymentMethod paymentMethod + * + * @return self */ public function setPaymentMethod($paymentMethod) { - $this->paymentMethod = $paymentMethod; + $this->container['paymentMethod'] = $paymentMethod; + + return $this; } /** - * @return mixed + * Gets paymentExpiryTime + * + * @return string|null */ public function getPaymentExpiryTime() { - return $this->paymentExpiryTime; + return $this->container['paymentExpiryTime']; } /** - * @param mixed $paymentExpiryTime + * Sets paymentExpiryTime + * + * @param string|null $paymentExpiryTime The payment expiration time is a specific time after which the payment will expire and the acquirer or merchant must terminate the order processing. Notes: For bank transfer payments, the default payment expiration time is 48 hours after the payment request is sent. For other payment categories, the default payment expiration time is usually 14 minutes after the payment request is sent. For example, if the request is sent on 2019-11-27T12:00:01+08:30, the payment expiration time is 2019-11-27T12:14:01+08:30. Specify this field if you want to use a payment expiration time that differs from the default time. For bank transfer payments, the specified payment expiration time must be less than 48 hours after the payment request is sent. For other payment categories, the specified payment expiration time must be less than 10 minutes after the payment request is sent. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setPaymentExpiryTime($paymentExpiryTime) { - $this->paymentExpiryTime = $paymentExpiryTime; + $this->container['paymentExpiryTime'] = $paymentExpiryTime; + + return $this; } /** - * @return mixed + * Gets paymentRedirectUrl + * + * @return string */ public function getPaymentRedirectUrl() { - return $this->paymentRedirectUrl; + return $this->container['paymentRedirectUrl']; } /** - * @param mixed $paymentRedirectUrl + * Sets paymentRedirectUrl + * + * @param string $paymentRedirectUrl The merchant page URL that the user is redirected to after the payment is completed. More information: Maximum length: 2048 characters + * + * @return self */ public function setPaymentRedirectUrl($paymentRedirectUrl) { - $this->paymentRedirectUrl = $paymentRedirectUrl; + $this->container['paymentRedirectUrl'] = $paymentRedirectUrl; + + return $this; } /** - * @return mixed + * Gets paymentNotifyUrl + * + * @return string|null */ public function getPaymentNotifyUrl() { - return $this->paymentNotifyUrl; + return $this->container['paymentNotifyUrl']; } /** - * @param mixed $paymentNotifyUrl + * Sets paymentNotifyUrl + * + * @param string|null $paymentNotifyUrl The URL that is used to receive the payment result notification. Note: Specify this parameter if you want to receive an asynchronous notification of the payment result. You can also set the URL to receive the result notification in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 2048 characters + * + * @return self */ public function setPaymentNotifyUrl($paymentNotifyUrl) { - $this->paymentNotifyUrl = $paymentNotifyUrl; + $this->container['paymentNotifyUrl'] = $paymentNotifyUrl; + + return $this; } /** - * @return mixed + * Gets paymentFactor + * + * @return \request\model\PaymentFactor|null */ - public function getIsAuthorization() + public function getPaymentFactor() { - return $this->isAuthorization; + return $this->container['paymentFactor']; } /** - * @param mixed $isAuthorization + * Sets paymentFactor + * + * @param \request\model\PaymentFactor|null $paymentFactor paymentFactor + * + * @return self */ - public function setIsAuthorization($isAuthorization) + public function setPaymentFactor($paymentFactor) { - $this->isAuthorization = $isAuthorization; + $this->container['paymentFactor'] = $paymentFactor; + + return $this; } /** - * @return mixed + * Gets settlementStrategy + * + * @return \request\model\SettlementStrategy */ - public function getPaymentVerificationData() + public function getSettlementStrategy() { - return $this->paymentVerificationData; + return $this->container['settlementStrategy']; } /** - * @param mixed $paymentVerificationData + * Sets settlementStrategy + * + * @param \request\model\SettlementStrategy $settlementStrategy settlementStrategy + * + * @return self */ - public function setPaymentVerificationData($paymentVerificationData) + public function setSettlementStrategy($settlementStrategy) { - $this->paymentVerificationData = $paymentVerificationData; + $this->container['settlementStrategy'] = $settlementStrategy; + + return $this; } /** - * @return mixed + * Gets creditPayPlan + * + * @return \request\model\CreditPayPlan|null */ - public function getPaymentFactor() + public function getCreditPayPlan() { - return $this->paymentFactor; + return $this->container['creditPayPlan']; } /** - * @param mixed $paymentFactor + * Sets creditPayPlan + * + * @param \request\model\CreditPayPlan|null $creditPayPlan creditPayPlan + * + * @return self */ - public function setPaymentFactor($paymentFactor) + public function setCreditPayPlan($creditPayPlan) { - $this->paymentFactor = $paymentFactor; + $this->container['creditPayPlan'] = $creditPayPlan; + + return $this; } /** - * @return mixed + * Gets appId + * + * @return string|null */ - public function getMerchant() + public function getAppId() { - return $this->merchant; + return $this->container['appId']; } /** - * @param mixed $merchant + * Sets appId + * + * @param string|null $appId The unique ID that is assigned by Antom to identify the mini program. Note: This field is required when terminalType is MINI_APP. More information: Maximum length: 32 characters + * + * @return self */ - public function setMerchant($merchant) + public function setAppId($appId) { - $this->merchant = $merchant; + $this->container['appId'] = $appId; + + return $this; } /** - * @return mixed + * Gets merchantRegion + * + * @return string|null */ - public function getExtendInfo() + public function getMerchantRegion() { - return $this->extendInfo; + return $this->container['merchantRegion']; } /** - * @param mixed $extendInfo + * Sets merchantRegion + * + * @param string|null $merchantRegion The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: This parameter is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + * + * @return self */ - public function setExtendInfo($extendInfo) + public function setMerchantRegion($merchantRegion) { - $this->extendInfo = $extendInfo; + $this->container['merchantRegion'] = $merchantRegion; + + return $this; } /** - * @return mixed + * Gets userRegion + * + * @return string|null */ - public function getCreditPayPlan() + public function getUserRegion() { - return $this->creditPayPlan; + return $this->container['userRegion']; } /** - * @param mixed $creditPayPlan + * Sets userRegion + * + * @param string|null $userRegion A 2-letter country or region code based on the standard of ISO 3166 Country Codes. This parameter is used to sort Alipay+ payment methods according to the user's region. For example, if ALIPAY_CN and KAKAOPAYare both on your payment method list and the user is from South Korea, KAKAOPAY will be listed first on the Alipay+ cashier page. Note: This parameter is only for the merchant that has integrated the Alipay+ cashier page. More information: Maximum length: 2 characters + * + * @return self */ - public function setCreditPayPlan($creditPayPlan) + public function setUserRegion($userRegion) { - $this->creditPayPlan = $creditPayPlan; + $this->container['userRegion'] = $userRegion; + + return $this; } /** - * @return mixed + * Gets env + * + * @return \request\model\Env */ - public function getSettlementStrategy() + public function getEnv() { - return $this->settlementStrategy; + return $this->container['env']; } /** - * @param mixed $settlementStrategy + * Sets env + * + * @param \request\model\Env $env env + * + * @return self */ - public function setSettlementStrategy($settlementStrategy) + public function setEnv($env) { - $this->settlementStrategy = $settlementStrategy; + $this->container['env'] = $env; + + return $this; } /** - * @return mixed + * Gets payToMethod + * + * @return \request\model\PaymentMethod|null */ - public function getEnv() + public function getPayToMethod() { - return $this->env; + return $this->container['payToMethod']; } /** - * @param mixed $env + * Sets payToMethod + * + * @param \request\model\PaymentMethod|null $payToMethod payToMethod + * + * @return self */ - public function setEnv($env) + public function setPayToMethod($payToMethod) + { + $this->container['payToMethod'] = $payToMethod; + + return $this; + } + + /** + * Gets isAuthorization + * + * @return bool|null + */ + public function getIsAuthorization() + { + return $this->container['isAuthorization']; + } + + /** + * Sets isAuthorization + * + * @param bool|null $isAuthorization isAuthorization + * + * @return self + */ + public function setIsAuthorization($isAuthorization) { - $this->env = $env; + $this->container['isAuthorization'] = $isAuthorization; + + return $this; } /** - * @return mixed + * Gets merchant + * + * @return \request\model\Merchant|null + */ + public function getMerchant() + { + return $this->container['merchant']; + } + + /** + * Sets merchant + * + * @param \request\model\Merchant|null $merchant merchant + * + * @return self + */ + public function setMerchant($merchant) + { + $this->container['merchant'] = $merchant; + + return $this; + } + + /** + * Gets paymentVerificationData + * + * @return \request\model\PaymentVerificationData|null + */ + public function getPaymentVerificationData() + { + return $this->container['paymentVerificationData']; + } + + /** + * Sets paymentVerificationData + * + * @param \request\model\PaymentVerificationData|null $paymentVerificationData paymentVerificationData + * + * @return self + */ + public function setPaymentVerificationData($paymentVerificationData) + { + $this->container['paymentVerificationData'] = $paymentVerificationData; + + return $this; + } + + /** + * Gets extendInfo + * + * @return string|null + */ + public function getExtendInfo() + { + return $this->container['extendInfo']; + } + + /** + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self + */ + public function setExtendInfo($extendInfo) + { + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets merchantAccountId + * + * @return string|null */ public function getMerchantAccountId() { - return $this->merchantAccountId; + return $this->container['merchantAccountId']; } /** - * @param mixed $merchantAccountId + * Sets merchantAccountId + * + * @param string|null $merchantAccountId The unique ID to identify a merchant account. Note: Specify this parameter when you use a single client ID across multiple locations. More information: Maximum length: 32 characters + * + * @return self */ public function setMerchantAccountId($merchantAccountId) { - $this->merchantAccountId = $merchantAccountId; + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; } /** - * @return mixed + * Gets dualOfflinePayment + * + * @return bool|null */ - public function getUserRegion() + public function getDualOfflinePayment() { - return $this->userRegion; + return $this->container['dualOfflinePayment']; } /** - * @param mixed $userRegion + * Sets dualOfflinePayment + * + * @param bool|null $dualOfflinePayment dualOfflinePayment + * + * @return self */ - public function setUserRegion($userRegion) + public function setDualOfflinePayment($dualOfflinePayment) { - $this->userRegion = $userRegion; + $this->container['dualOfflinePayment'] = $dualOfflinePayment; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } /** - * @return mixed + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null */ - public function getSubscriptionInfo() + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - return $this->subscriptionInfo; + return $this->container[$offset] ?? null; } /** - * @param mixed $subscriptionInfo + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void */ - public function setSubscriptionInfo($subscriptionInfo) + public function offsetSet($offset, $value): void { - $this->subscriptionInfo = $subscriptionInfo; + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayPaymentSessionRequest.php b/request/pay/AlipayPaymentSessionRequest.php index f3049ab..689b489 100644 --- a/request/pay/AlipayPaymentSessionRequest.php +++ b/request/pay/AlipayPaymentSessionRequest.php @@ -1,465 +1,1055 @@ + */ +class AlipayPaymentSessionRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { - /** - * Represents the payment product that is being used. The fixed value is CASHIER_PAYMENT - */ - public $productCode; + public const DISCRIMINATOR = null; /** - * The unique ID assigned by a merchant to identify a payment request - */ - public $paymentRequestId; + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPaymentSessionRequest'; /** - * The order information - */ - public $order; + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productCode' => '\request\model\ProductCodeType', + 'paymentRequestId' => 'string', + 'order' => '\request\model\Order', + 'paymentAmount' => '\request\model\Amount', + 'paymentMethod' => '\request\model\PaymentMethod', + 'paymentSessionExpiryTime' => 'string', + 'paymentRedirectUrl' => 'string', + 'paymentNotifyUrl' => 'string', + 'paymentFactor' => '\request\model\PaymentFactor', + 'settlementStrategy' => '\request\model\SettlementStrategy', + 'enableInstallmentCollection' => 'bool', + 'creditPayPlan' => '\request\model\CreditPayPlan', + 'merchantRegion' => 'string', + 'env' => '\request\model\Env', + 'agreementInfo' => '\request\model\AgreementInfo', + 'riskData' => '\request\model\RiskData', + 'productScene' => 'string', + 'savedPaymentMethods' => '\request\model\PaymentMethod[]', + 'locale' => 'string', + 'availablePaymentMethod' => '\request\model\AvailablePaymentMethod', + 'testFile' => 'string' + ]; /** - * The payment amount that the merchant requests to receive in the order currency - */ - public $paymentAmount; + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productCode' => null, + 'paymentRequestId' => null, + 'order' => null, + 'paymentAmount' => null, + 'paymentMethod' => null, + 'paymentSessionExpiryTime' => null, + 'paymentRedirectUrl' => null, + 'paymentNotifyUrl' => null, + 'paymentFactor' => null, + 'settlementStrategy' => null, + 'enableInstallmentCollection' => null, + 'creditPayPlan' => null, + 'merchantRegion' => null, + 'env' => null, + 'agreementInfo' => null, + 'riskData' => null, + 'productScene' => null, + 'savedPaymentMethods' => null, + 'locale' => null, + 'availablePaymentMethod' => null, + 'testFile' => null + ]; /** - * The payment method that is used to collect the payment by the merchant or acquirer - */ - public $paymentMethod; + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'productCode' => false, + 'paymentRequestId' => false, + 'order' => false, + 'paymentAmount' => false, + 'paymentMethod' => false, + 'paymentSessionExpiryTime' => false, + 'paymentRedirectUrl' => false, + 'paymentNotifyUrl' => false, + 'paymentFactor' => false, + 'settlementStrategy' => false, + 'enableInstallmentCollection' => false, + 'creditPayPlan' => false, + 'merchantRegion' => false, + 'env' => false, + 'agreementInfo' => false, + 'riskData' => false, + 'productScene' => false, + 'savedPaymentMethods' => false, + 'locale' => false, + 'availablePaymentMethod' => false, + 'testFile' => false + ]; /** - * The expiry time of paymentSession - */ - public $paymentSessionExpiryTime; + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; /** - * The merchant page URL that the user is redirected to after the payment is completed + * Array of property to type mappings. Used for (de)serialization + * + * @return array */ - public $paymentRedirectUrl; + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * The URL that is used to receive the payment result notification + * Array of property to format mappings. Used for (de)serialization + * + * @return array */ - public $paymentNotifyUrl; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** - * Factors that impact the payment. This field is used to indicate the payment scenario + * Array of nullable properties + * + * @return array */ - public $paymentFactor; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * The settlement strategy for the payment request + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public $settlementStrategy; + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } /** - * Indicates whether Antom collects the installment information for the payment. + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull */ - public $enableInstallmentCollection; + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } /** - * The credit payment plan information for this payment + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public $creditPayPlan; + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } /** - * The country or region where the merchant operates the business + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public $merchantRegion; + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } /** - * Information about the environment where the order is placed + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public $env; + protected static $attributeMap = [ + 'productCode' => 'productCode', + 'paymentRequestId' => 'paymentRequestId', + 'order' => 'order', + 'paymentAmount' => 'paymentAmount', + 'paymentMethod' => 'paymentMethod', + 'paymentSessionExpiryTime' => 'paymentSessionExpiryTime', + 'paymentRedirectUrl' => 'paymentRedirectUrl', + 'paymentNotifyUrl' => 'paymentNotifyUrl', + 'paymentFactor' => 'paymentFactor', + 'settlementStrategy' => 'settlementStrategy', + 'enableInstallmentCollection' => 'enableInstallmentCollection', + 'creditPayPlan' => 'creditPayPlan', + 'merchantRegion' => 'merchantRegion', + 'env' => 'env', + 'agreementInfo' => 'agreementInfo', + 'riskData' => 'riskData', + 'productScene' => 'productScene', + 'savedPaymentMethods' => 'savedPaymentMethods', + 'locale' => 'locale', + 'availablePaymentMethod' => 'availablePaymentMethod', + 'testFile' => 'testFile' + ]; /** - * Authorization information about Easy Pay payments + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] */ - public $agreementInfo; + protected static $setters = [ + 'productCode' => 'setProductCode', + 'paymentRequestId' => 'setPaymentRequestId', + 'order' => 'setOrder', + 'paymentAmount' => 'setPaymentAmount', + 'paymentMethod' => 'setPaymentMethod', + 'paymentSessionExpiryTime' => 'setPaymentSessionExpiryTime', + 'paymentRedirectUrl' => 'setPaymentRedirectUrl', + 'paymentNotifyUrl' => 'setPaymentNotifyUrl', + 'paymentFactor' => 'setPaymentFactor', + 'settlementStrategy' => 'setSettlementStrategy', + 'enableInstallmentCollection' => 'setEnableInstallmentCollection', + 'creditPayPlan' => 'setCreditPayPlan', + 'merchantRegion' => 'setMerchantRegion', + 'env' => 'setEnv', + 'agreementInfo' => 'setAgreementInfo', + 'riskData' => 'setRiskData', + 'productScene' => 'setProductScene', + 'savedPaymentMethods' => 'setSavedPaymentMethods', + 'locale' => 'setLocale', + 'availablePaymentMethod' => 'setAvailablePaymentMethod', + 'testFile' => 'setTestFile' + ]; /** - * The data used by Ant Group for risk control purposes. + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] */ - public $riskData; + protected static $getters = [ + 'productCode' => 'getProductCode', + 'paymentRequestId' => 'getPaymentRequestId', + 'order' => 'getOrder', + 'paymentAmount' => 'getPaymentAmount', + 'paymentMethod' => 'getPaymentMethod', + 'paymentSessionExpiryTime' => 'getPaymentSessionExpiryTime', + 'paymentRedirectUrl' => 'getPaymentRedirectUrl', + 'paymentNotifyUrl' => 'getPaymentNotifyUrl', + 'paymentFactor' => 'getPaymentFactor', + 'settlementStrategy' => 'getSettlementStrategy', + 'enableInstallmentCollection' => 'getEnableInstallmentCollection', + 'creditPayPlan' => 'getCreditPayPlan', + 'merchantRegion' => 'getMerchantRegion', + 'env' => 'getEnv', + 'agreementInfo' => 'getAgreementInfo', + 'riskData' => 'getRiskData', + 'productScene' => 'getProductScene', + 'savedPaymentMethods' => 'getSavedPaymentMethods', + 'locale' => 'getLocale', + 'availablePaymentMethod' => 'getAvailablePaymentMethod', + 'testFile' => 'getTestFile' + ]; /** - * This param is used for Easy pay payments,set its value to EASY_PAY + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array */ - public $productScene; - - public $savedPaymentMethods; - - public $locale; - - public $availablePaymentMethod; - private $allowedPaymentMethodRegions; - public $subscriptionInfo; + public static function attributeMap() + { + return self::$attributeMap; + } /** - * @return mixed + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public function getSubscriptionInfo() + public static function setters() { - return $this->subscriptionInfo; + return self::$setters; } /** - * @param mixed $subscriptionInfo + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public function setSubscriptionInfo($subscriptionInfo) + public static function getters() { - $this->subscriptionInfo = $subscriptionInfo; + return self::$getters; } - - function __construct() + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() { - $this->setPath(AntomPathConstants::CREATE_SESSION_PATH); + return self::$openAPIModelName; } + /** - * @return mixed + * Associative array for storing property values + * + * @var mixed[] */ - public function getAllowedPaymentMethodRegions() - { - return $this->allowedPaymentMethodRegions; - } + protected $container = []; /** - * @param mixed $allowedPaymentMethodRegions + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public function setAllowedPaymentMethodRegions($allowedPaymentMethodRegions) + public function __construct(?array $data = null) { - $this->allowedPaymentMethodRegions = $allowedPaymentMethodRegions; + $this->setIfExists('productCode', $data ?? [], null); + $this->setIfExists('paymentRequestId', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('paymentSessionExpiryTime', $data ?? [], null); + $this->setIfExists('paymentRedirectUrl', $data ?? [], null); + $this->setIfExists('paymentNotifyUrl', $data ?? [], null); + $this->setIfExists('paymentFactor', $data ?? [], null); + $this->setIfExists('settlementStrategy', $data ?? [], null); + $this->setIfExists('enableInstallmentCollection', $data ?? [], null); + $this->setIfExists('creditPayPlan', $data ?? [], null); + $this->setIfExists('merchantRegion', $data ?? [], null); + $this->setIfExists('env', $data ?? [], null); + $this->setIfExists('agreementInfo', $data ?? [], null); + $this->setIfExists('riskData', $data ?? [], null); + $this->setIfExists('productScene', $data ?? [], null); + $this->setIfExists('savedPaymentMethods', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], null); + $this->setIfExists('availablePaymentMethod', $data ?? [], null); + $this->setIfExists('testFile', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/createPaymentSession"); } + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } /** - * @return mixed + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public function getAvailablePaymentMethod() + public function listInvalidProperties() { - return $this->availablePaymentMethod; + $invalidProperties = []; + + if ($this->container['productCode'] === null) { + $invalidProperties[] = "'productCode' can't be null"; + } + if ($this->container['paymentRequestId'] === null) { + $invalidProperties[] = "'paymentRequestId' can't be null"; + } + if ($this->container['order'] === null) { + $invalidProperties[] = "'order' can't be null"; + } + if ($this->container['paymentAmount'] === null) { + $invalidProperties[] = "'paymentAmount' can't be null"; + } + if ($this->container['paymentMethod'] === null) { + $invalidProperties[] = "'paymentMethod' can't be null"; + } + if ($this->container['paymentRedirectUrl'] === null) { + $invalidProperties[] = "'paymentRedirectUrl' can't be null"; + } + if ($this->container['settlementStrategy'] === null) { + $invalidProperties[] = "'settlementStrategy' can't be null"; + } + if ($this->container['testFile'] === null) { + $invalidProperties[] = "'testFile' can't be null"; + } + return $invalidProperties; } /** - * @param mixed $availablePaymentMethod + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid */ - public function setAvailablePaymentMethod($availablePaymentMethod) + public function valid() { - $this->availablePaymentMethod = $availablePaymentMethod; + return count($this->listInvalidProperties()) === 0; } + /** - * @return mixed + * Gets productCode + * + * @return \request\model\ProductCodeType */ public function getProductCode() { - return $this->productCode; + return $this->container['productCode']; } /** - * @param mixed $productCode + * Sets productCode + * + * @param \request\model\ProductCodeType $productCode productCode + * + * @return self */ public function setProductCode($productCode) { - $this->productCode = $productCode; + $this->container['productCode'] = $productCode; + + return $this; } /** - * @return mixed + * Gets paymentRequestId + * + * @return string */ public function getPaymentRequestId() { - return $this->paymentRequestId; + return $this->container['paymentRequestId']; } /** - * @param mixed $paymentRequestId + * Sets paymentRequestId + * + * @param string $paymentRequestId The unique ID assigned by a merchant to identify a payment request. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentRequestId($paymentRequestId) { - $this->paymentRequestId = $paymentRequestId; + $this->container['paymentRequestId'] = $paymentRequestId; + + return $this; } /** - * @return mixed + * Gets order + * + * @return \request\model\Order */ public function getOrder() { - return $this->order; + return $this->container['order']; } /** - * @param mixed $order + * Sets order + * + * @param \request\model\Order $order order + * + * @return self */ public function setOrder($order) { - $this->order = $order; + $this->container['order'] = $order; + + return $this; } /** - * @return mixed + * Gets paymentAmount + * + * @return \request\model\Amount */ public function getPaymentAmount() { - return $this->paymentAmount; + return $this->container['paymentAmount']; } /** - * @param mixed $paymentAmount + * Sets paymentAmount + * + * @param \request\model\Amount $paymentAmount paymentAmount + * + * @return self */ public function setPaymentAmount($paymentAmount) { - $this->paymentAmount = $paymentAmount; + $this->container['paymentAmount'] = $paymentAmount; + + return $this; } /** - * @return mixed + * Gets paymentMethod + * + * @return \request\model\PaymentMethod */ public function getPaymentMethod() { - return $this->paymentMethod; + return $this->container['paymentMethod']; } /** - * @param mixed $paymentMethod + * Sets paymentMethod + * + * @param \request\model\PaymentMethod $paymentMethod paymentMethod + * + * @return self */ public function setPaymentMethod($paymentMethod) { - $this->paymentMethod = $paymentMethod; + $this->container['paymentMethod'] = $paymentMethod; + + return $this; } /** - * @return mixed + * Gets paymentSessionExpiryTime + * + * @return string|null */ public function getPaymentSessionExpiryTime() { - return $this->paymentSessionExpiryTime; + return $this->container['paymentSessionExpiryTime']; } /** - * @param mixed $paymentSessionExpiryTime + * Sets paymentSessionExpiryTime + * + * @param string|null $paymentSessionExpiryTime The specific date and time after which the payment session will expire. The default expiration time is 1 hour after the session creation. For example, if the session is created at 2023-7-27T12:00:01+08:30, the session expiration time is 2023-7-27T13:00:01+08:30. Specify this parameter if you want to use a payment session expiration time that differs from the default time. The specified expiration time must be 0 to 1 hour after session creation. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setPaymentSessionExpiryTime($paymentSessionExpiryTime) { - $this->paymentSessionExpiryTime = $paymentSessionExpiryTime; + $this->container['paymentSessionExpiryTime'] = $paymentSessionExpiryTime; + + return $this; } /** - * @return mixed + * Gets paymentRedirectUrl + * + * @return string */ public function getPaymentRedirectUrl() { - return $this->paymentRedirectUrl; + return $this->container['paymentRedirectUrl']; } /** - * @param mixed $paymentRedirectUrl + * Sets paymentRedirectUrl + * + * @param string $paymentRedirectUrl The merchant page URL that the user is redirected to after the payment is completed. More information: Maximum length: 2048 characters + * + * @return self */ public function setPaymentRedirectUrl($paymentRedirectUrl) { - $this->paymentRedirectUrl = $paymentRedirectUrl; + $this->container['paymentRedirectUrl'] = $paymentRedirectUrl; + + return $this; } /** - * @return mixed + * Gets paymentNotifyUrl + * + * @return string|null */ public function getPaymentNotifyUrl() { - return $this->paymentNotifyUrl; + return $this->container['paymentNotifyUrl']; } /** - * @param mixed $paymentNotifyUrl + * Sets paymentNotifyUrl + * + * @param string|null $paymentNotifyUrl The URL that is used to receive the payment result notification. Specify this parameter if you want to receive an asynchronous notification of the payment result. You can also set the URL to receive the result notification in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 2048 characters + * + * @return self */ public function setPaymentNotifyUrl($paymentNotifyUrl) { - $this->paymentNotifyUrl = $paymentNotifyUrl; + $this->container['paymentNotifyUrl'] = $paymentNotifyUrl; + + return $this; } /** - * @return mixed + * Gets paymentFactor + * + * @return \request\model\PaymentFactor|null */ public function getPaymentFactor() { - return $this->paymentFactor; + return $this->container['paymentFactor']; } /** - * @param mixed $paymentFactor + * Sets paymentFactor + * + * @param \request\model\PaymentFactor|null $paymentFactor paymentFactor + * + * @return self */ public function setPaymentFactor($paymentFactor) { - $this->paymentFactor = $paymentFactor; + $this->container['paymentFactor'] = $paymentFactor; + + return $this; } /** - * @return mixed + * Gets settlementStrategy + * + * @return \request\model\SettlementStrategy */ public function getSettlementStrategy() { - return $this->settlementStrategy; + return $this->container['settlementStrategy']; } /** - * @param mixed $settlementStrategy + * Sets settlementStrategy + * + * @param \request\model\SettlementStrategy $settlementStrategy settlementStrategy + * + * @return self */ public function setSettlementStrategy($settlementStrategy) { - $this->settlementStrategy = $settlementStrategy; + $this->container['settlementStrategy'] = $settlementStrategy; + + return $this; } /** - * @return mixed + * Gets enableInstallmentCollection + * + * @return bool|null */ public function getEnableInstallmentCollection() { - return $this->enableInstallmentCollection; + return $this->container['enableInstallmentCollection']; } /** - * @param mixed $enableInstallmentCollection + * Sets enableInstallmentCollection + * + * @param bool|null $enableInstallmentCollection Indicates whether Antom collects the installment information for the payment. Specify this parameter if you need Antom to collect the installment information. Valid values are: true: indicates Antom collects installment information when the user's card supports installments. Installments are not available when the user's card does not support installments. false: indicates you do not need Antom to collect the installment information. The same applies when the value is empty or you do not specify this parameter. + * + * @return self */ public function setEnableInstallmentCollection($enableInstallmentCollection) { - $this->enableInstallmentCollection = $enableInstallmentCollection; + $this->container['enableInstallmentCollection'] = $enableInstallmentCollection; + + return $this; } /** - * @return mixed + * Gets creditPayPlan + * + * @return \request\model\CreditPayPlan|null */ public function getCreditPayPlan() { - return $this->creditPayPlan; + return $this->container['creditPayPlan']; } /** - * @param mixed $creditPayPlan + * Sets creditPayPlan + * + * @param \request\model\CreditPayPlan|null $creditPayPlan creditPayPlan + * + * @return self */ public function setCreditPayPlan($creditPayPlan) { - $this->creditPayPlan = $creditPayPlan; + $this->container['creditPayPlan'] = $creditPayPlan; + + return $this; } /** - * @return mixed + * Gets merchantRegion + * + * @return string|null */ public function getMerchantRegion() { - return $this->merchantRegion; + return $this->container['merchantRegion']; } /** - * @param mixed $merchantRegion + * Sets merchantRegion + * + * @param string|null $merchantRegion The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: This parameter is required when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + * + * @return self */ public function setMerchantRegion($merchantRegion) { - $this->merchantRegion = $merchantRegion; + $this->container['merchantRegion'] = $merchantRegion; + + return $this; } /** - * @return mixed + * Gets env + * + * @return \request\model\Env|null */ public function getEnv() { - return $this->env; + return $this->container['env']; } /** - * @param mixed $env + * Sets env + * + * @param \request\model\Env|null $env env + * + * @return self */ public function setEnv($env) { - $this->env = $env; + $this->container['env'] = $env; + + return $this; } /** - * @return mixed + * Gets agreementInfo + * + * @return \request\model\AgreementInfo|null */ public function getAgreementInfo() { - return $this->agreementInfo; + return $this->container['agreementInfo']; } /** - * @param mixed $agreementInfo + * Sets agreementInfo + * + * @param \request\model\AgreementInfo|null $agreementInfo agreementInfo + * + * @return self */ public function setAgreementInfo($agreementInfo) { - $this->agreementInfo = $agreementInfo; + $this->container['agreementInfo'] = $agreementInfo; + + return $this; } /** - * @return mixed + * Gets riskData + * + * @return \request\model\RiskData|null */ public function getRiskData() { - return $this->riskData; + return $this->container['riskData']; } /** - * @param mixed $riskData + * Sets riskData + * + * @param \request\model\RiskData|null $riskData riskData + * + * @return self */ public function setRiskData($riskData) { - $this->riskData = $riskData; + $this->container['riskData'] = $riskData; + + return $this; } /** - * @return mixed + * Gets productScene + * + * @return string|null */ public function getProductScene() { - return $this->productScene; + return $this->container['productScene']; } /** - * @param mixed $productScene + * Sets productScene + * + * @param string|null $productScene Specified product scenarios include valid values: ​CHECKOUT_PAYMENT​: Indicates that the merchant integrates using the Checkout Page. ​ELEMENT_PAYMENT​: Indicates that the merchant integrates using the Element. More information: Maximum length: 32 characters + * + * @return self */ public function setProductScene($productScene) { - $this->productScene = $productScene; + $this->container['productScene'] = $productScene; + + return $this; } /** - * @return mixed + * Gets savedPaymentMethods + * + * @return \request\model\PaymentMethod[]|null */ public function getSavedPaymentMethods() { - return $this->savedPaymentMethods; + return $this->container['savedPaymentMethods']; } /** - * @param mixed $savedPaymentMethods + * Sets savedPaymentMethods + * + * @param \request\model\PaymentMethod[]|null $savedPaymentMethods Payment information stored by the user in the merchant system. + * + * @return self */ public function setSavedPaymentMethods($savedPaymentMethods) { - $this->savedPaymentMethods = $savedPaymentMethods; + $this->container['savedPaymentMethods'] = $savedPaymentMethods; + + return $this; } /** - * @return mixed + * Gets locale + * + * @return string|null */ public function getLocale() { - return $this->locale; + return $this->container['locale']; } /** - * @param mixed $locale + * Sets locale + * + * @param string|null $locale Language tag specified for the Checkout Page. If this field is empty or set to automatic, the default language setting of the browser will be used, which is usually English. More information: Maximum length: 8 characters + * + * @return self */ public function setLocale($locale) { - $this->locale = $locale; + $this->container['locale'] = $locale; + + return $this; + } + + /** + * Gets availablePaymentMethod + * + * @return \request\model\AvailablePaymentMethod|null + */ + public function getAvailablePaymentMethod() + { + return $this->container['availablePaymentMethod']; + } + + /** + * Sets availablePaymentMethod + * + * @param \request\model\AvailablePaymentMethod|null $availablePaymentMethod availablePaymentMethod + * + * @return self + */ + public function setAvailablePaymentMethod($availablePaymentMethod) + { + $this->container['availablePaymentMethod'] = $availablePaymentMethod; + + return $this; + } + + /** + * Gets testFile + * + * @return string + */ + public function getTestFile() + { + return $this->container['testFile']; + } + + /** + * Sets testFile + * + * @param string $testFile testFile + * + * @return self + */ + public function setTestFile($testFile) + { + $this->container['testFile'] = $testFile; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayRefundRequest.php b/request/pay/AlipayRefundRequest.php index af9dd60..c15c896 100644 --- a/request/pay/AlipayRefundRequest.php +++ b/request/pay/AlipayRefundRequest.php @@ -1,193 +1,699 @@ + */ +class AlipayRefundRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; - public $refundRequestId; - public $paymentId; - public $referenceRefundId; - public $refundAmount; - public $refundReason; - public $refundNotifyUrl; - public $isAsyncRefund; - public $extendInfo; + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayRefundRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'refundRequestId' => 'string', + 'paymentId' => 'string', + 'referenceRefundId' => 'string', + 'refundAmount' => '\request\model\Amount', + 'refundReason' => 'string', + 'refundNotifyUrl' => 'string', + 'isAsyncRefund' => 'bool', + 'extendInfo' => 'string', + 'refundDetails' => '\request\model\RefundDetail[]', + 'refundSourceAccountNo' => 'string' + ]; - public $refundDetails; + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'refundRequestId' => null, + 'paymentId' => null, + 'referenceRefundId' => null, + 'refundAmount' => null, + 'refundReason' => null, + 'refundNotifyUrl' => null, + 'isAsyncRefund' => null, + 'extendInfo' => null, + 'refundDetails' => null, + 'refundSourceAccountNo' => null + ]; - public $refundSourceAccountNo; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'refundRequestId' => false, + 'paymentId' => false, + 'referenceRefundId' => false, + 'refundAmount' => false, + 'refundReason' => false, + 'refundNotifyUrl' => false, + 'isAsyncRefund' => false, + 'extendInfo' => false, + 'refundDetails' => false, + 'refundSourceAccountNo' => false + ]; + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; - function __construct() + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() { - $this->setPath(AntomPathConstants::REFUND_PATH); + return self::$openAPITypes; } + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * @return mixed + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'refundRequestId' => 'refundRequestId', + 'paymentId' => 'paymentId', + 'referenceRefundId' => 'referenceRefundId', + 'refundAmount' => 'refundAmount', + 'refundReason' => 'refundReason', + 'refundNotifyUrl' => 'refundNotifyUrl', + 'isAsyncRefund' => 'isAsyncRefund', + 'extendInfo' => 'extendInfo', + 'refundDetails' => 'refundDetails', + 'refundSourceAccountNo' => 'refundSourceAccountNo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'refundRequestId' => 'setRefundRequestId', + 'paymentId' => 'setPaymentId', + 'referenceRefundId' => 'setReferenceRefundId', + 'refundAmount' => 'setRefundAmount', + 'refundReason' => 'setRefundReason', + 'refundNotifyUrl' => 'setRefundNotifyUrl', + 'isAsyncRefund' => 'setIsAsyncRefund', + 'extendInfo' => 'setExtendInfo', + 'refundDetails' => 'setRefundDetails', + 'refundSourceAccountNo' => 'setRefundSourceAccountNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'refundRequestId' => 'getRefundRequestId', + 'paymentId' => 'getPaymentId', + 'referenceRefundId' => 'getReferenceRefundId', + 'refundAmount' => 'getRefundAmount', + 'refundReason' => 'getRefundReason', + 'refundNotifyUrl' => 'getRefundNotifyUrl', + 'isAsyncRefund' => 'getIsAsyncRefund', + 'extendInfo' => 'getExtendInfo', + 'refundDetails' => 'getRefundDetails', + 'refundSourceAccountNo' => 'getRefundSourceAccountNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('refundRequestId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('referenceRefundId', $data ?? [], null); + $this->setIfExists('refundAmount', $data ?? [], null); + $this->setIfExists('refundReason', $data ?? [], null); + $this->setIfExists('refundNotifyUrl', $data ?? [], null); + $this->setIfExists('isAsyncRefund', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('refundDetails', $data ?? [], null); + $this->setIfExists('refundSourceAccountNo', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/refund"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['refundRequestId'] === null) { + $invalidProperties[] = "'refundRequestId' can't be null"; + } + if ($this->container['paymentId'] === null) { + $invalidProperties[] = "'paymentId' can't be null"; + } + if ($this->container['refundAmount'] === null) { + $invalidProperties[] = "'refundAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets refundRequestId + * + * @return string */ public function getRefundRequestId() { - return $this->refundRequestId; + return $this->container['refundRequestId']; } /** - * @param mixed $refundRequestId + * Sets refundRequestId + * + * @param string $refundRequestId The unique ID assigned by the merchant to identify a refund request. More information: This field is an API idempotency field.The merchant uses the refundRequestId field for idempotency control. For payment requests that are initiated with the same value of refundRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ public function setRefundRequestId($refundRequestId) { - $this->refundRequestId = $refundRequestId; + $this->container['refundRequestId'] = $refundRequestId; + + return $this; } /** - * @return mixed + * Gets paymentId + * + * @return string */ public function getPaymentId() { - return $this->paymentId; + return $this->container['paymentId']; } /** - * @param mixed $paymentId + * Sets paymentId + * + * @param string $paymentId The unique ID assigned by Antom for the original payment to be refunded. More information: Maximum length: 64 characters + * + * @return self */ public function setPaymentId($paymentId) { - $this->paymentId = $paymentId; + $this->container['paymentId'] = $paymentId; + + return $this; } /** - * @return mixed + * Gets referenceRefundId + * + * @return string|null */ public function getReferenceRefundId() { - return $this->referenceRefundId; + return $this->container['referenceRefundId']; } /** - * @param mixed $referenceRefundId + * Sets referenceRefundId + * + * @param string|null $referenceRefundId The unique ID to identify a refund, which is assigned by the merchant that directly provides services or goods to the customer. Note: Specify this field if this value is needed for internal use or reconciliation. More information: Maximum length: 64 characters + * + * @return self */ public function setReferenceRefundId($referenceRefundId) { - $this->referenceRefundId = $referenceRefundId; + $this->container['referenceRefundId'] = $referenceRefundId; + + return $this; } /** - * @return mixed + * Gets refundAmount + * + * @return \request\model\Amount */ public function getRefundAmount() { - return $this->refundAmount; + return $this->container['refundAmount']; } /** - * @param mixed $refundAmount + * Sets refundAmount + * + * @param \request\model\Amount $refundAmount refundAmount + * + * @return self */ public function setRefundAmount($refundAmount) { - $this->refundAmount = $refundAmount; + $this->container['refundAmount'] = $refundAmount; + + return $this; } /** - * @return mixed + * Gets refundReason + * + * @return string|null */ public function getRefundReason() { - return $this->refundReason; + return $this->container['refundReason']; } /** - * @param mixed $refundReason + * Sets refundReason + * + * @param string|null $refundReason The refund reason. Note: Specify this field if you want to provide the refund reason to the user and payment method. More information: Maximum length: 256 characters + * + * @return self */ public function setRefundReason($refundReason) { - $this->refundReason = $refundReason; + $this->container['refundReason'] = $refundReason; + + return $this; } /** - * @return mixed + * Gets refundNotifyUrl + * + * @return string|null */ - public function getIsAsyncRefund() + public function getRefundNotifyUrl() { - return $this->isAsyncRefund; + return $this->container['refundNotifyUrl']; } /** - * @param mixed $isAsyncRefund + * Sets refundNotifyUrl + * + * @param string|null $refundNotifyUrl The URL that is used to receive the refund result notification. The URL must be either specified in the request or set in Antom Dashboard. Note: Specify this field if you want to receive an asynchronous notification of the refund result. If the refund notification URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence. More information: Maximum length: 1024 characters + * + * @return self */ - public function setIsAsyncRefund($isAsyncRefund) + public function setRefundNotifyUrl($refundNotifyUrl) { - $this->isAsyncRefund = $isAsyncRefund; + $this->container['refundNotifyUrl'] = $refundNotifyUrl; + + return $this; } /** - * @return mixed + * Gets isAsyncRefund + * + * @return bool|null */ - public function getExtendInfo() + public function getIsAsyncRefund() { - return $this->extendInfo; + return $this->container['isAsyncRefund']; } /** - * @param mixed $extendInfo + * Sets isAsyncRefund + * + * @param bool|null $isAsyncRefund isAsyncRefund + * + * @return self */ - public function setExtendInfo($extendInfo) + public function setIsAsyncRefund($isAsyncRefund) { - $this->extendInfo = $extendInfo; + $this->container['isAsyncRefund'] = $isAsyncRefund; + + return $this; } /** - * @return mixed + * Gets extendInfo + * + * @return string|null */ - public function getRefundNotifyUrl() + public function getExtendInfo() { - return $this->refundNotifyUrl; + return $this->container['extendInfo']; } /** - * @param mixed $refundNotifyUrl + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self */ - public function setRefundNotifyUrl($refundNotifyUrl) + public function setExtendInfo($extendInfo) { - $this->refundNotifyUrl = $refundNotifyUrl; + $this->container['extendInfo'] = $extendInfo; + + return $this; } /** - * @return mixed + * Gets refundDetails + * + * @return \request\model\RefundDetail[]|null */ public function getRefundDetails() { - return $this->refundDetails; + return $this->container['refundDetails']; } /** - * @param mixed $refundDetails + * Sets refundDetails + * + * @param \request\model\RefundDetail[]|null $refundDetails refundDetails + * + * @return self */ public function setRefundDetails($refundDetails) { - $this->refundDetails = $refundDetails; + $this->container['refundDetails'] = $refundDetails; + + return $this; } /** - * @return mixed + * Gets refundSourceAccountNo + * + * @return string|null */ public function getRefundSourceAccountNo() { - return $this->refundSourceAccountNo; + return $this->container['refundSourceAccountNo']; } /** - * @param mixed $refundSourceAccountNo + * Sets refundSourceAccountNo + * + * @param string|null $refundSourceAccountNo refundSourceAccountNo + * + * @return self */ public function setRefundSourceAccountNo($refundSourceAccountNo) { - $this->refundSourceAccountNo = $refundSourceAccountNo; + $this->container['refundSourceAccountNo'] = $refundSourceAccountNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayVaultingPaymentMethodRequest.php b/request/pay/AlipayVaultingPaymentMethodRequest.php new file mode 100644 index 0000000..901dec0 --- /dev/null +++ b/request/pay/AlipayVaultingPaymentMethodRequest.php @@ -0,0 +1,674 @@ + + */ +class AlipayVaultingPaymentMethodRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayVaultingPaymentMethodRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vaultingRequestId' => 'string', + 'vaultingNotificationUrl' => 'string', + 'redirectUrl' => 'string', + 'merchantRegion' => 'string', + 'paymentMethodDetail' => '\request\model\PaymentMethodDetail', + 'env' => '\request\model\Env', + 'merchantAccountId' => 'string', + 'vaultingCurrency' => 'string', + 'customizedInfo' => '\request\model\CustomizedInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vaultingRequestId' => null, + 'vaultingNotificationUrl' => null, + 'redirectUrl' => null, + 'merchantRegion' => null, + 'paymentMethodDetail' => null, + 'env' => null, + 'merchantAccountId' => null, + 'vaultingCurrency' => null, + 'customizedInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'vaultingRequestId' => false, + 'vaultingNotificationUrl' => false, + 'redirectUrl' => false, + 'merchantRegion' => false, + 'paymentMethodDetail' => false, + 'env' => false, + 'merchantAccountId' => false, + 'vaultingCurrency' => false, + 'customizedInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'vaultingRequestId' => 'vaultingRequestId', + 'vaultingNotificationUrl' => 'vaultingNotificationUrl', + 'redirectUrl' => 'redirectUrl', + 'merchantRegion' => 'merchantRegion', + 'paymentMethodDetail' => 'paymentMethodDetail', + 'env' => 'env', + 'merchantAccountId' => 'merchantAccountId', + 'vaultingCurrency' => 'vaultingCurrency', + 'customizedInfo' => 'customizedInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vaultingRequestId' => 'setVaultingRequestId', + 'vaultingNotificationUrl' => 'setVaultingNotificationUrl', + 'redirectUrl' => 'setRedirectUrl', + 'merchantRegion' => 'setMerchantRegion', + 'paymentMethodDetail' => 'setPaymentMethodDetail', + 'env' => 'setEnv', + 'merchantAccountId' => 'setMerchantAccountId', + 'vaultingCurrency' => 'setVaultingCurrency', + 'customizedInfo' => 'setCustomizedInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vaultingRequestId' => 'getVaultingRequestId', + 'vaultingNotificationUrl' => 'getVaultingNotificationUrl', + 'redirectUrl' => 'getRedirectUrl', + 'merchantRegion' => 'getMerchantRegion', + 'paymentMethodDetail' => 'getPaymentMethodDetail', + 'env' => 'getEnv', + 'merchantAccountId' => 'getMerchantAccountId', + 'vaultingCurrency' => 'getVaultingCurrency', + 'customizedInfo' => 'getCustomizedInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('vaultingRequestId', $data ?? [], null); + $this->setIfExists('vaultingNotificationUrl', $data ?? [], null); + $this->setIfExists('redirectUrl', $data ?? [], null); + $this->setIfExists('merchantRegion', $data ?? [], null); + $this->setIfExists('paymentMethodDetail', $data ?? [], null); + $this->setIfExists('env', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + $this->setIfExists('vaultingCurrency', $data ?? [], null); + $this->setIfExists('customizedInfo', $data ?? [], null); + + $this->setPath("/ams/api/v1/vaults/vaultPaymentMethod"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['vaultingRequestId'] === null) { + $invalidProperties[] = "'vaultingRequestId' can't be null"; + } + if ($this->container['vaultingNotificationUrl'] === null) { + $invalidProperties[] = "'vaultingNotificationUrl' can't be null"; + } + if ($this->container['redirectUrl'] === null) { + $invalidProperties[] = "'redirectUrl' can't be null"; + } + if ($this->container['paymentMethodDetail'] === null) { + $invalidProperties[] = "'paymentMethodDetail' can't be null"; + } + if ($this->container['env'] === null) { + $invalidProperties[] = "'env' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets vaultingRequestId + * + * @return string + */ + public function getVaultingRequestId() + { + return $this->container['vaultingRequestId']; + } + + /** + * Sets vaultingRequestId + * + * @param string $vaultingRequestId The unique ID that is assigned by a merchant to identify a card vaulting request. More information: This field is an API idempotency field.For vaulting requests that are initiated with the same value of vaultingRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self + */ + public function setVaultingRequestId($vaultingRequestId) + { + $this->container['vaultingRequestId'] = $vaultingRequestId; + + return $this; + } + + /** + * Gets vaultingNotificationUrl + * + * @return string + */ + public function getVaultingNotificationUrl() + { + return $this->container['vaultingNotificationUrl']; + } + + /** + * Sets vaultingNotificationUrl + * + * @param string $vaultingNotificationUrl The URL that is used to receive the vaulting result notification. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setVaultingNotificationUrl($vaultingNotificationUrl) + { + $this->container['vaultingNotificationUrl'] = $vaultingNotificationUrl; + + return $this; + } + + /** + * Gets redirectUrl + * + * @return string + */ + public function getRedirectUrl() + { + return $this->container['redirectUrl']; + } + + /** + * Sets redirectUrl + * + * @param string $redirectUrl The merchant page URL that the buyer is redirected to after the vaulting process is completed. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setRedirectUrl($redirectUrl) + { + $this->container['redirectUrl'] = $redirectUrl; + + return $this; + } + + /** + * Gets merchantRegion + * + * @return string|null + */ + public function getMerchantRegion() + { + return $this->container['merchantRegion']; + } + + /** + * Sets merchantRegion + * + * @param string|null $merchantRegion The country or region where the merchant operates the business. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: Specify this parameter when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + * + * @return self + */ + public function setMerchantRegion($merchantRegion) + { + $this->container['merchantRegion'] = $merchantRegion; + + return $this; + } + + /** + * Gets paymentMethodDetail + * + * @return \request\model\PaymentMethodDetail + */ + public function getPaymentMethodDetail() + { + return $this->container['paymentMethodDetail']; + } + + /** + * Sets paymentMethodDetail + * + * @param \request\model\PaymentMethodDetail $paymentMethodDetail paymentMethodDetail + * + * @return self + */ + public function setPaymentMethodDetail($paymentMethodDetail) + { + $this->container['paymentMethodDetail'] = $paymentMethodDetail; + + return $this; + } + + /** + * Gets env + * + * @return \request\model\Env + */ + public function getEnv() + { + return $this->container['env']; + } + + /** + * Sets env + * + * @param \request\model\Env $env env + * + * @return self + */ + public function setEnv($env) + { + $this->container['env'] = $env; + + return $this; + } + + /** + * Gets merchantAccountId + * + * @return string|null + */ + public function getMerchantAccountId() + { + return $this->container['merchantAccountId']; + } + + /** + * Sets merchantAccountId + * + * @param string|null $merchantAccountId merchantAccountId + * + * @return self + */ + public function setMerchantAccountId($merchantAccountId) + { + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; + } + + /** + * Gets vaultingCurrency + * + * @return string|null + */ + public function getVaultingCurrency() + { + return $this->container['vaultingCurrency']; + } + + /** + * Sets vaultingCurrency + * + * @param string|null $vaultingCurrency vaultingCurrency + * + * @return self + */ + public function setVaultingCurrency($vaultingCurrency) + { + $this->container['vaultingCurrency'] = $vaultingCurrency; + + return $this; + } + + /** + * Gets customizedInfo + * + * @return \request\model\CustomizedInfo|null + */ + public function getCustomizedInfo() + { + return $this->container['customizedInfo']; + } + + /** + * Sets customizedInfo + * + * @param \request\model\CustomizedInfo|null $customizedInfo customizedInfo + * + * @return self + */ + public function setCustomizedInfo($customizedInfo) + { + $this->container['customizedInfo'] = $customizedInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayVaultingQueryRequest.php b/request/pay/AlipayVaultingQueryRequest.php new file mode 100644 index 0000000..b966461 --- /dev/null +++ b/request/pay/AlipayVaultingQueryRequest.php @@ -0,0 +1,414 @@ + + */ +class AlipayVaultingQueryRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayVaultingQueryRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vaultingRequestId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vaultingRequestId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'vaultingRequestId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'vaultingRequestId' => 'vaultingRequestId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vaultingRequestId' => 'setVaultingRequestId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vaultingRequestId' => 'getVaultingRequestId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('vaultingRequestId', $data ?? [], null); + + $this->setPath("/ams/api/v1/vaults/inquireVaulting"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['vaultingRequestId'] === null) { + $invalidProperties[] = "'vaultingRequestId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets vaultingRequestId + * + * @return string + */ + public function getVaultingRequestId() + { + return $this->container['vaultingRequestId']; + } + + /** + * Sets vaultingRequestId + * + * @param string $vaultingRequestId The unique ID that is assigned by a merchant to identify a card vaulting request. More information about this field This field is an API idempotency field. For vaulting requests that are initiated with the same value of vaultingRequestId and reach a final status of S or F, the same result is to be returned for the request. More information: Maximum length: 64 characters + * + * @return self + */ + public function setVaultingRequestId($vaultingRequestId) + { + $this->container['vaultingRequestId'] = $vaultingRequestId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AlipayVaultingSessionRequest.php b/request/pay/AlipayVaultingSessionRequest.php new file mode 100644 index 0000000..ac82fc9 --- /dev/null +++ b/request/pay/AlipayVaultingSessionRequest.php @@ -0,0 +1,575 @@ + + */ +class AlipayVaultingSessionRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayVaultingSessionRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethodType' => 'string', + 'vaultingRequestId' => 'string', + 'vaultingNotificationUrl' => 'string', + 'redirectUrl' => 'string', + 'merchantRegion' => 'string', + 'is3DSAuthentication' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethodType' => null, + 'vaultingRequestId' => null, + 'vaultingNotificationUrl' => null, + 'redirectUrl' => null, + 'merchantRegion' => null, + 'is3DSAuthentication' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'paymentMethodType' => false, + 'vaultingRequestId' => false, + 'vaultingNotificationUrl' => false, + 'redirectUrl' => false, + 'merchantRegion' => false, + 'is3DSAuthentication' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paymentMethodType' => 'paymentMethodType', + 'vaultingRequestId' => 'vaultingRequestId', + 'vaultingNotificationUrl' => 'vaultingNotificationUrl', + 'redirectUrl' => 'redirectUrl', + 'merchantRegion' => 'merchantRegion', + 'is3DSAuthentication' => 'is3DSAuthentication' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethodType' => 'setPaymentMethodType', + 'vaultingRequestId' => 'setVaultingRequestId', + 'vaultingNotificationUrl' => 'setVaultingNotificationUrl', + 'redirectUrl' => 'setRedirectUrl', + 'merchantRegion' => 'setMerchantRegion', + 'is3DSAuthentication' => 'setIs3DSAuthentication' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethodType' => 'getPaymentMethodType', + 'vaultingRequestId' => 'getVaultingRequestId', + 'vaultingNotificationUrl' => 'getVaultingNotificationUrl', + 'redirectUrl' => 'getRedirectUrl', + 'merchantRegion' => 'getMerchantRegion', + 'is3DSAuthentication' => 'getIs3DSAuthentication' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paymentMethodType', $data ?? [], null); + $this->setIfExists('vaultingRequestId', $data ?? [], null); + $this->setIfExists('vaultingNotificationUrl', $data ?? [], null); + $this->setIfExists('redirectUrl', $data ?? [], null); + $this->setIfExists('merchantRegion', $data ?? [], null); + $this->setIfExists('is3DSAuthentication', $data ?? [], null); + + $this->setPath("/ams/api/v1/vaults/createVaultingSession"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['paymentMethodType'] === null) { + $invalidProperties[] = "'paymentMethodType' can't be null"; + } + if ($this->container['vaultingRequestId'] === null) { + $invalidProperties[] = "'vaultingRequestId' can't be null"; + } + if ($this->container['vaultingNotificationUrl'] === null) { + $invalidProperties[] = "'vaultingNotificationUrl' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paymentMethodType + * + * @return string + */ + public function getPaymentMethodType() + { + return $this->container['paymentMethodType']; + } + + /** + * Sets paymentMethodType + * + * @param string $paymentMethodType The payment method type is included in payment method options. See Payment methods to check the valid values for card payments. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentMethodType($paymentMethodType) + { + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; + } + + /** + * Gets vaultingRequestId + * + * @return string + */ + public function getVaultingRequestId() + { + return $this->container['vaultingRequestId']; + } + + /** + * Sets vaultingRequestId + * + * @param string $vaultingRequestId The unique ID that is assigned by a merchant to identify a card vaulting request. More information: Maximum length: 64 characters + * + * @return self + */ + public function setVaultingRequestId($vaultingRequestId) + { + $this->container['vaultingRequestId'] = $vaultingRequestId; + + return $this; + } + + /** + * Gets vaultingNotificationUrl + * + * @return string + */ + public function getVaultingNotificationUrl() + { + return $this->container['vaultingNotificationUrl']; + } + + /** + * Sets vaultingNotificationUrl + * + * @param string $vaultingNotificationUrl The URL that is used to receive the vaulting result notification. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setVaultingNotificationUrl($vaultingNotificationUrl) + { + $this->container['vaultingNotificationUrl'] = $vaultingNotificationUrl; + + return $this; + } + + /** + * Gets redirectUrl + * + * @return string|null + */ + public function getRedirectUrl() + { + return $this->container['redirectUrl']; + } + + /** + * Sets redirectUrl + * + * @param string|null $redirectUrl The merchant page URL that the buyer is redirected to after the vaulting is completed. Note: Specify this parameter if you want to redirect the buyer to your page directly after the vaulting is completed. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setRedirectUrl($redirectUrl) + { + $this->container['redirectUrl'] = $redirectUrl; + + return $this; + } + + /** + * Gets merchantRegion + * + * @return string|null + */ + public function getMerchantRegion() + { + return $this->container['merchantRegion']; + } + + /** + * Sets merchantRegion + * + * @param string|null $merchantRegion The country or region where the merchant operates the business. The value of this parameter is a 2-letter country or region code based on the ISO 3166 Country Codes standard. Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY. Note: Specify this parameter when you use the Global Acquirer Gateway (GAGW) product. More information: Maximum length: 2 characters + * + * @return self + */ + public function setMerchantRegion($merchantRegion) + { + $this->container['merchantRegion'] = $merchantRegion; + + return $this; + } + + /** + * Gets is3DSAuthentication + * + * @return bool|null + */ + public function getIs3DSAuthentication() + { + return $this->container['is3DSAuthentication']; + } + + /** + * Sets is3DSAuthentication + * + * @param bool|null $is3DSAuthentication Indicates whether the transaction authentication type is 3D secure. Specify this parameter when the value of paymentMethodType is CARD. + * + * @return self + */ + public function setIs3DSAuthentication($is3DSAuthentication) + { + $this->container['is3DSAuthentication'] = $is3DSAuthentication; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AmsApiV1PaymentsCapturePostRequest.php b/request/pay/AmsApiV1PaymentsCapturePostRequest.php new file mode 100644 index 0000000..f595d0a --- /dev/null +++ b/request/pay/AmsApiV1PaymentsCapturePostRequest.php @@ -0,0 +1,513 @@ + + */ +class AmsApiV1PaymentsCapturePostRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_ams_api_v1_payments_capture_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'captureRequestId' => 'string', + 'paymentId' => 'string', + 'captureAmount' => '\request\model\Amount', + 'isLastCapture' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'captureRequestId' => null, + 'paymentId' => null, + 'captureAmount' => null, + 'isLastCapture' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'captureRequestId' => false, + 'paymentId' => false, + 'captureAmount' => false, + 'isLastCapture' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'captureRequestId' => 'captureRequestId', + 'paymentId' => 'paymentId', + 'captureAmount' => 'captureAmount', + 'isLastCapture' => 'isLastCapture' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'captureRequestId' => 'setCaptureRequestId', + 'paymentId' => 'setPaymentId', + 'captureAmount' => 'setCaptureAmount', + 'isLastCapture' => 'setIsLastCapture' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'captureRequestId' => 'getCaptureRequestId', + 'paymentId' => 'getPaymentId', + 'captureAmount' => 'getCaptureAmount', + 'isLastCapture' => 'getIsLastCapture' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('captureRequestId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('captureAmount', $data ?? [], null); + $this->setIfExists('isLastCapture', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/capture"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['captureRequestId'] === null) { + $invalidProperties[] = "'captureRequestId' can't be null"; + } + if ($this->container['paymentId'] === null) { + $invalidProperties[] = "'paymentId' can't be null"; + } + if ($this->container['captureAmount'] === null) { + $invalidProperties[] = "'captureAmount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets captureRequestId + * + * @return string + */ + public function getCaptureRequestId() + { + return $this->container['captureRequestId']; + } + + /** + * Sets captureRequestId + * + * @param string $captureRequestId The unique ID that is assigned by the merchant to identify a capture request. Antom uses this field for idempotence control. More information: This field is an API idempotency field.For capture requests that are initiated with the same value of captureRequestId and reach a final status (S or F), the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self + */ + public function setCaptureRequestId($captureRequestId) + { + $this->container['captureRequestId'] = $captureRequestId; + + return $this; + } + + /** + * Gets paymentId + * + * @return string + */ + public function getPaymentId() + { + return $this->container['paymentId']; + } + + /** + * Sets paymentId + * + * @param string $paymentId The unique ID that is assigned by Antom to identify a payment. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentId($paymentId) + { + $this->container['paymentId'] = $paymentId; + + return $this; + } + + /** + * Gets captureAmount + * + * @return \request\model\Amount + */ + public function getCaptureAmount() + { + return $this->container['captureAmount']; + } + + /** + * Sets captureAmount + * + * @param \request\model\Amount $captureAmount captureAmount + * + * @return self + */ + public function setCaptureAmount($captureAmount) + { + $this->container['captureAmount'] = $captureAmount; + + return $this; + } + + /** + * Gets isLastCapture + * + * @return bool|null + */ + public function getIsLastCapture() + { + return $this->container['isLastCapture']; + } + + /** + * Sets isLastCapture + * + * @param bool|null $isLastCapture isLastCapture + * + * @return self + */ + public function setIsLastCapture($isLastCapture) + { + $this->container['isLastCapture'] = $isLastCapture; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/pay/AmsApiV1PaymentsInquiryRefundPostRequest.php b/request/pay/AmsApiV1PaymentsInquiryRefundPostRequest.php new file mode 100644 index 0000000..72d573e --- /dev/null +++ b/request/pay/AmsApiV1PaymentsInquiryRefundPostRequest.php @@ -0,0 +1,473 @@ + + */ +class AmsApiV1PaymentsInquiryRefundPostRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_ams_api_v1_payments_inquiryRefund_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'refundRequestId' => 'string', + 'refundId' => 'string', + 'merchantAccountId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'refundRequestId' => null, + 'refundId' => null, + 'merchantAccountId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'refundRequestId' => false, + 'refundId' => false, + 'merchantAccountId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'refundRequestId' => 'refundRequestId', + 'refundId' => 'refundId', + 'merchantAccountId' => 'merchantAccountId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'refundRequestId' => 'setRefundRequestId', + 'refundId' => 'setRefundId', + 'merchantAccountId' => 'setMerchantAccountId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'refundRequestId' => 'getRefundRequestId', + 'refundId' => 'getRefundId', + 'merchantAccountId' => 'getMerchantAccountId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('refundRequestId', $data ?? [], null); + $this->setIfExists('refundId', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + + $this->setPath("/ams/api/v1/payments/inquiryRefund"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets refundRequestId + * + * @return string|null + */ + public function getRefundRequestId() + { + return $this->container['refundRequestId']; + } + + /** + * Sets refundRequestId + * + * @param string|null $refundRequestId The unique ID assigned by a merchant to identify a refund request. refundRequestId and refundId cannot both be null. Special characters are not supported. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + * + * @return self + */ + public function setRefundRequestId($refundRequestId) + { + $this->container['refundRequestId'] = $refundRequestId; + + return $this; + } + + /** + * Gets refundId + * + * @return string|null + */ + public function getRefundId() + { + return $this->container['refundId']; + } + + /** + * Sets refundId + * + * @param string|null $refundId The unique ID assigned by Antom to identify a refund. refundRequestId and refundId cannot both be null. A one-to-one correspondence between refundId and refundRequestId exists. If both refundRequestId and refundId are specified, refundId takes precedence. More information: Maximum length: 64 characters + * + * @return self + */ + public function setRefundId($refundId) + { + $this->container['refundId'] = $refundId; + + return $this; + } + + /** + * Gets merchantAccountId + * + * @return string|null + */ + public function getMerchantAccountId() + { + return $this->container['merchantAccountId']; + } + + /** + * Sets merchantAccountId + * + * @param string|null $merchantAccountId merchantAccountId + * + * @return self + */ + public function setMerchantAccountId($merchantAccountId) + { + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/subscription/AlipaySubscriptionCancelRequest.php b/request/subscription/AlipaySubscriptionCancelRequest.php index 98deb1c..ef0c164 100644 --- a/request/subscription/AlipaySubscriptionCancelRequest.php +++ b/request/subscription/AlipaySubscriptionCancelRequest.php @@ -1,85 +1,476 @@ + */ +class AlipaySubscriptionCancelRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionCancelRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'subscriptionId' => 'string', + 'subscriptionRequestId' => 'string', + 'cancellationType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'subscriptionId' => null, + 'subscriptionRequestId' => null, + 'cancellationType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'subscriptionId' => false, + 'subscriptionRequestId' => false, + 'cancellationType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'subscriptionId' => 'subscriptionId', + 'subscriptionRequestId' => 'subscriptionRequestId', + 'cancellationType' => 'cancellationType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'subscriptionId' => 'setSubscriptionId', + 'subscriptionRequestId' => 'setSubscriptionRequestId', + 'cancellationType' => 'setCancellationType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'subscriptionId' => 'getSubscriptionId', + 'subscriptionRequestId' => 'getSubscriptionRequestId', + 'cancellationType' => 'getCancellationType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } /** - * The unique ID assigned by Alipay to identify a subscription. + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public $subscriptionId; + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } /** - * The unique ID assigned by a merchant to identify a subscription request. + * The original name of the model. + * + * @return string */ - public $subscriptionRequestId; + public function getModelName() + { + return self::$openAPIModelName; + } + /** - * The cancellation type for the subscription. Valid values are: - *

- * CANCEL: indicates canceling the subscription. The subscription service is not provided to the user after the current subscription period ends. - * TERMINATE: indicates terminating the subscription. The subscription service is ceased immediately. + * Associative array for storing property values + * + * @var mixed[] */ - public $cancellationType; + protected $container = []; - function __construct() + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) { - $this->setPath(AntomPathConstants::SUBSCRIPTION_CANCEL_PATH); + $this->setIfExists('subscriptionId', $data ?? [], null); + $this->setIfExists('subscriptionRequestId', $data ?? [], null); + $this->setIfExists('cancellationType', $data ?? [], null); + + $this->setPath("/ams/api/v1/subscriptions/cancel"); } + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['cancellationType'] === null) { + $invalidProperties[] = "'cancellationType' can't be null"; + } + return $invalidProperties; + } /** - * @return mixed + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets subscriptionId + * + * @return string|null */ public function getSubscriptionId() { - return $this->subscriptionId; + return $this->container['subscriptionId']; } /** - * @param mixed $subscriptionId + * Sets subscriptionId + * + * @param string|null $subscriptionId The unique ID assigned by Antom to identify a subscription. The value of this parameter is the value of the same parameter that is returned by notifyPayment and notifySubscription for the original subscription. Note: Specify at least one of subscriptionId and subscriptionRequestId. A one-to-one correspondence between paymentId and paymentRequestId exists. More information: Maximum length: 64 characters + * + * @return self */ - public function setSubscriptionId($subscriptionId) + public function setSubscriptionId($subscriptionId) { - $this->subscriptionId = $subscriptionId; + $this->container['subscriptionId'] = $subscriptionId; + + return $this; } /** - * @return mixed + * Gets subscriptionRequestId + * + * @return string|null */ public function getSubscriptionRequestId() { - return $this->subscriptionRequestId; + return $this->container['subscriptionRequestId']; } /** - * @param mixed $subscriptionRequestId + * Sets subscriptionRequestId + * + * @param string|null $subscriptionRequestId The unique ID assigned by a merchant to identify a subscription request. Note: Specify at least one of subscriptionId and subscriptionRequestId. A one-to-one correspondence between paymentId and paymentRequestId exists. More information: Maximum length: 64 characters + * + * @return self */ - public function setSubscriptionRequestId($subscriptionRequestId) + public function setSubscriptionRequestId($subscriptionRequestId) { - $this->subscriptionRequestId = $subscriptionRequestId; + $this->container['subscriptionRequestId'] = $subscriptionRequestId; + + return $this; } /** - * @return mixed + * Gets cancellationType + * + * @return string */ public function getCancellationType() { - return $this->cancellationType; + return $this->container['cancellationType']; } /** - * @param mixed $cancellationType + * Sets cancellationType + * + * @param string $cancellationType The cancellation type for the subscription. Valid values are: CANCEL: indicates canceling the subscription. The subscription service is not provided to the user after the current subscription period ends. TERMINATE: indicates terminating the subscription. The subscription service is ceased immediately. More information: Maximum length: 32 characters + * + * @return self */ - public function setCancellationType($cancellationType) + public function setCancellationType($cancellationType) { - $this->cancellationType = $cancellationType; + $this->container['cancellationType'] = $cancellationType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/subscription/AlipaySubscriptionChangeRequest.php b/request/subscription/AlipaySubscriptionChangeRequest.php index 6a7c7db..eafe626 100644 --- a/request/subscription/AlipaySubscriptionChangeRequest.php +++ b/request/subscription/AlipaySubscriptionChangeRequest.php @@ -1,228 +1,696 @@ + */ +class AlipaySubscriptionChangeRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionChangeRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'subscriptionChangeRequestId' => 'string', + 'subscriptionId' => 'string', + 'subscriptionDescription' => 'string', + 'subscriptionStartTime' => 'string', + 'subscriptionEndTime' => 'string', + 'periodRule' => '\request\model\PeriodRule', + 'subscriptionExpiryTime' => 'string', + 'orderInfo' => '\request\model\OrderInfo', + 'paymentAmount' => '\request\model\Amount', + 'paymentAmountDifference' => '\request\model\Amount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'subscriptionChangeRequestId' => null, + 'subscriptionId' => null, + 'subscriptionDescription' => null, + 'subscriptionStartTime' => null, + 'subscriptionEndTime' => null, + 'periodRule' => null, + 'subscriptionExpiryTime' => null, + 'orderInfo' => null, + 'paymentAmount' => null, + 'paymentAmountDifference' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'subscriptionChangeRequestId' => false, + 'subscriptionId' => false, + 'subscriptionDescription' => false, + 'subscriptionStartTime' => false, + 'subscriptionEndTime' => false, + 'periodRule' => false, + 'subscriptionExpiryTime' => false, + 'orderInfo' => false, + 'paymentAmount' => false, + 'paymentAmountDifference' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + /** - * The unique ID assigned by a merchant to identify a subscription change request. Alipay uses this field for idempotency control. + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public $subscriptionChangeRequestId; + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } /** - * The unique ID assigned by Alipay to identify a subscription. + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull */ - public $subscriptionId; + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } /** - * The description of the subscription, used for displaying user consumption records and other actions. + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public $subscriptionDescription; + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } /** - * The date and time when the subscription becomes active. + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public $subscriptionStartTime; + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } /** - * The date and time when the subscription ends. + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] */ - public $subscriptionEndTime; + protected static $attributeMap = [ + 'subscriptionChangeRequestId' => 'subscriptionChangeRequestId', + 'subscriptionId' => 'subscriptionId', + 'subscriptionDescription' => 'subscriptionDescription', + 'subscriptionStartTime' => 'subscriptionStartTime', + 'subscriptionEndTime' => 'subscriptionEndTime', + 'periodRule' => 'periodRule', + 'subscriptionExpiryTime' => 'subscriptionExpiryTime', + 'orderInfo' => 'orderInfo', + 'paymentAmount' => 'paymentAmount', + 'paymentAmountDifference' => 'paymentAmountDifference' + ]; /** - * The subscription period rule, used to define a subscription's billing period. + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] */ - public $periodRule; + protected static $setters = [ + 'subscriptionChangeRequestId' => 'setSubscriptionChangeRequestId', + 'subscriptionId' => 'setSubscriptionId', + 'subscriptionDescription' => 'setSubscriptionDescription', + 'subscriptionStartTime' => 'setSubscriptionStartTime', + 'subscriptionEndTime' => 'setSubscriptionEndTime', + 'periodRule' => 'setPeriodRule', + 'subscriptionExpiryTime' => 'setSubscriptionExpiryTime', + 'orderInfo' => 'setOrderInfo', + 'paymentAmount' => 'setPaymentAmount', + 'paymentAmountDifference' => 'setPaymentAmountDifference' + ]; /** - * A specific date and time after which the created subscription expires. + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] */ - public $subscriptionExpiryTime; + protected static $getters = [ + 'subscriptionChangeRequestId' => 'getSubscriptionChangeRequestId', + 'subscriptionId' => 'getSubscriptionId', + 'subscriptionDescription' => 'getSubscriptionDescription', + 'subscriptionStartTime' => 'getSubscriptionStartTime', + 'subscriptionEndTime' => 'getSubscriptionEndTime', + 'periodRule' => 'getPeriodRule', + 'subscriptionExpiryTime' => 'getSubscriptionExpiryTime', + 'orderInfo' => 'getOrderInfo', + 'paymentAmount' => 'getPaymentAmount', + 'paymentAmountDifference' => 'getPaymentAmountDifference' + ]; /** - * The order information of the subscription. + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array */ - public $orderInfo; + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + /** - * The payment amount charged to the user per subscription period. + * Associative array for storing property values + * + * @var mixed[] */ - public $paymentAmount; + protected $container = []; /** - * The payment amount for the initial subscription period after changing the payment amount for subsequent subscription periods. + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public $paymentAmountDifference; + public function __construct(?array $data = null) + { + $this->setIfExists('subscriptionChangeRequestId', $data ?? [], null); + $this->setIfExists('subscriptionId', $data ?? [], null); + $this->setIfExists('subscriptionDescription', $data ?? [], null); + $this->setIfExists('subscriptionStartTime', $data ?? [], null); + $this->setIfExists('subscriptionEndTime', $data ?? [], null); + $this->setIfExists('periodRule', $data ?? [], null); + $this->setIfExists('subscriptionExpiryTime', $data ?? [], null); + $this->setIfExists('orderInfo', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('paymentAmountDifference', $data ?? [], null); + + $this->setPath("/ams/api/v1/subscriptions/change"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['subscriptionChangeRequestId'] === null) { + $invalidProperties[] = "'subscriptionChangeRequestId' can't be null"; + } + if ($this->container['subscriptionId'] === null) { + $invalidProperties[] = "'subscriptionId' can't be null"; + } + return $invalidProperties; + } - function __construct() + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() { - $this->setPath(AntomPathConstants::SUBSCRIPTION_CHANGE_PATH); + return count($this->listInvalidProperties()) === 0; } /** - * @return mixed + * Gets subscriptionChangeRequestId + * + * @return string */ public function getSubscriptionChangeRequestId() { - return $this->subscriptionChangeRequestId; + return $this->container['subscriptionChangeRequestId']; } /** - * @param mixed $subscriptionChangeRequestId + * Sets subscriptionChangeRequestId + * + * @param string $subscriptionChangeRequestId The unique ID assigned by a merchant to identify a subscription change request. Antom uses this field for idempotency control. Note: For subscription change requests that are initiated with the same value of subscriptionChangeRequestId and reach a final status of ​S​ or​F​, the same result is to be returned for the request. More information: This field is an API idempotency field. Maximum length: 64 characters + * + * @return self */ - public function setSubscriptionChangeRequestId($subscriptionChangeRequestId) + public function setSubscriptionChangeRequestId($subscriptionChangeRequestId) { - $this->subscriptionChangeRequestId = $subscriptionChangeRequestId; + $this->container['subscriptionChangeRequestId'] = $subscriptionChangeRequestId; + + return $this; } /** - * @return mixed + * Gets subscriptionId + * + * @return string */ public function getSubscriptionId() { - return $this->subscriptionId; + return $this->container['subscriptionId']; } /** - * @param mixed $subscriptionId + * Sets subscriptionId + * + * @param string $subscriptionId The unique ID assigned by Antom to identify a subscription. The value of this parameter is the value of the same parameter that is returned by notifyPayment and notifySubscription for the original subscription. More information: Maximum length: 64 characters + * + * @return self */ - public function setSubscriptionId($subscriptionId) + public function setSubscriptionId($subscriptionId) { - $this->subscriptionId = $subscriptionId; + $this->container['subscriptionId'] = $subscriptionId; + + return $this; } /** - * @return mixed + * Gets subscriptionDescription + * + * @return string|null */ public function getSubscriptionDescription() { - return $this->subscriptionDescription; + return $this->container['subscriptionDescription']; } /** - * @param mixed $subscriptionDescription + * Sets subscriptionDescription + * + * @param string|null $subscriptionDescription The description of the subscription, used for displaying user consumption records and other actions. Note: Specify this parameter if you want to change this information. More information: Maximum length: 256 characters + * + * @return self */ - public function setSubscriptionDescription($subscriptionDescription) + public function setSubscriptionDescription($subscriptionDescription) { - $this->subscriptionDescription = $subscriptionDescription; + $this->container['subscriptionDescription'] = $subscriptionDescription; + + return $this; } /** - * @return mixed + * Gets subscriptionStartTime + * + * @return string|null */ public function getSubscriptionStartTime() { - return $this->subscriptionStartTime; + return $this->container['subscriptionStartTime']; } /** - * @param mixed $subscriptionStartTime + * Sets subscriptionStartTime + * + * @param string|null $subscriptionStartTime The date and time when the subscription becomes active. Note: Specify this parameter when you want to designate the start time of the changed subscription. If you leave this parameter empty, the default value of this parameter is the time when Antom receives this request. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setSubscriptionStartTime($subscriptionStartTime) + public function setSubscriptionStartTime($subscriptionStartTime) { - $this->subscriptionStartTime = $subscriptionStartTime; + $this->container['subscriptionStartTime'] = $subscriptionStartTime; + + return $this; } /** - * @return mixed + * Gets subscriptionEndTime + * + * @return string|null */ public function getSubscriptionEndTime() { - return $this->subscriptionEndTime; + return $this->container['subscriptionEndTime']; } /** - * @param mixed $subscriptionEndTime + * Sets subscriptionEndTime + * + * @param string|null $subscriptionEndTime The date and time when the subscription ends. The default value of this parameter is 2099-12-31T23:59:59+08:00. Note: Specify this parameter when you want to change this information. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setSubscriptionEndTime($subscriptionEndTime) + public function setSubscriptionEndTime($subscriptionEndTime) { - $this->subscriptionEndTime = $subscriptionEndTime; + $this->container['subscriptionEndTime'] = $subscriptionEndTime; + + return $this; } /** - * @return mixed + * Gets periodRule + * + * @return \request\model\PeriodRule|null */ public function getPeriodRule() { - return $this->periodRule; + return $this->container['periodRule']; } /** - * @param mixed $periodRule + * Sets periodRule + * + * @param \request\model\PeriodRule|null $periodRule periodRule + * + * @return self */ - public function setPeriodRule($periodRule) + public function setPeriodRule($periodRule) { - $this->periodRule = $periodRule; + $this->container['periodRule'] = $periodRule; + + return $this; } /** - * @return mixed + * Gets subscriptionExpiryTime + * + * @return string|null */ public function getSubscriptionExpiryTime() { - return $this->subscriptionExpiryTime; + return $this->container['subscriptionExpiryTime']; } /** - * @param mixed $subscriptionExpiryTime + * Sets subscriptionExpiryTime + * + * @param string|null $subscriptionExpiryTime A specific date and time after which the created subscription expires. When the subscription expires, the order must be terminated. The default value of this parameter is 30 minutes after the subscription creation request is sent. Note: Specify this parameter if you want to change the subscription creation expiration time. The specified payment expiration time must be less than 48 hours after the subscription request is sent. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setSubscriptionExpiryTime($subscriptionExpiryTime) + public function setSubscriptionExpiryTime($subscriptionExpiryTime) { - $this->subscriptionExpiryTime = $subscriptionExpiryTime; + $this->container['subscriptionExpiryTime'] = $subscriptionExpiryTime; + + return $this; } /** - * @return mixed + * Gets orderInfo + * + * @return \request\model\OrderInfo|null */ public function getOrderInfo() { - return $this->orderInfo; + return $this->container['orderInfo']; } /** - * @param mixed $orderInfo + * Sets orderInfo + * + * @param \request\model\OrderInfo|null $orderInfo orderInfo + * + * @return self */ - public function setOrderInfo($orderInfo) + public function setOrderInfo($orderInfo) { - $this->orderInfo = $orderInfo; + $this->container['orderInfo'] = $orderInfo; + + return $this; } /** - * @return mixed + * Gets paymentAmount + * + * @return \request\model\Amount|null */ public function getPaymentAmount() { - return $this->paymentAmount; + return $this->container['paymentAmount']; } /** - * @param mixed $paymentAmount + * Sets paymentAmount + * + * @param \request\model\Amount|null $paymentAmount paymentAmount + * + * @return self */ - public function setPaymentAmount($paymentAmount) + public function setPaymentAmount($paymentAmount) { - $this->paymentAmount = $paymentAmount; + $this->container['paymentAmount'] = $paymentAmount; + + return $this; } /** - * @return mixed + * Gets paymentAmountDifference + * + * @return \request\model\Amount|null */ public function getPaymentAmountDifference() { - return $this->paymentAmountDifference; + return $this->container['paymentAmountDifference']; + } + + /** + * Sets paymentAmountDifference + * + * @param \request\model\Amount|null $paymentAmountDifference paymentAmountDifference + * + * @return self + */ + public function setPaymentAmountDifference($paymentAmountDifference) + { + $this->container['paymentAmountDifference'] = $paymentAmountDifference; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); } /** - * @param mixed $paymentAmountDifference + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null */ - public function setPaymentAmountDifference($paymentAmountDifference) + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - $this->paymentAmountDifference = $paymentAmountDifference; + return $this->container[$offset] ?? null; } + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } -} \ No newline at end of file + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/subscription/AlipaySubscriptionCreateRequest.php b/request/subscription/AlipaySubscriptionCreateRequest.php index 15c1071..c521f5c 100644 --- a/request/subscription/AlipaySubscriptionCreateRequest.php +++ b/request/subscription/AlipaySubscriptionCreateRequest.php @@ -1,333 +1,881 @@ + */ +class AlipaySubscriptionCreateRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionCreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'subscriptionRequestId' => 'string', + 'subscriptionDescription' => 'string', + 'subscriptionRedirectUrl' => 'string', + 'subscriptionStartTime' => 'string', + 'subscriptionEndTime' => 'string', + 'periodRule' => '\request\model\PeriodRule', + 'subscriptionExpiryTime' => 'string', + 'paymentMethod' => '\request\model\PaymentMethod', + 'subscriptionNotificationUrl' => 'string', + 'paymentNotificationUrl' => 'string', + 'orderInfo' => '\request\model\OrderInfo', + 'paymentAmount' => '\request\model\Amount', + 'settlementStrategy' => '\request\model\SettlementStrategy', + 'env' => '\request\model\Env', + 'trials' => '\request\model\Trial[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'subscriptionRequestId' => null, + 'subscriptionDescription' => null, + 'subscriptionRedirectUrl' => null, + 'subscriptionStartTime' => null, + 'subscriptionEndTime' => null, + 'periodRule' => null, + 'subscriptionExpiryTime' => null, + 'paymentMethod' => null, + 'subscriptionNotificationUrl' => null, + 'paymentNotificationUrl' => null, + 'orderInfo' => null, + 'paymentAmount' => null, + 'settlementStrategy' => null, + 'env' => null, + 'trials' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'subscriptionRequestId' => false, + 'subscriptionDescription' => false, + 'subscriptionRedirectUrl' => false, + 'subscriptionStartTime' => false, + 'subscriptionEndTime' => false, + 'periodRule' => false, + 'subscriptionExpiryTime' => false, + 'paymentMethod' => false, + 'subscriptionNotificationUrl' => false, + 'paymentNotificationUrl' => false, + 'orderInfo' => false, + 'paymentAmount' => false, + 'settlementStrategy' => false, + 'env' => false, + 'trials' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } /** - * The unique ID assigned by a merchant to identify a subscription request. Alipay uses this field for idempotency control. + * Array of property to format mappings. Used for (de)serialization + * + * @return array */ - public $subscriptionRequestId; + public static function openAPIFormats() + { + return self::$openAPIFormats; + } /** - * The description of the subscription, used for displaying user consumption records and other actions. + * Array of nullable properties + * + * @return array */ - public $subscriptionDescription; + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } /** - * The merchant page URL that the user is redirected to after authorizing the subscription. + * Array of nullable field names deliberately set to null + * + * @return boolean[] */ - public $subscriptionRedirectUrl; + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } /** - * The date and time when the subscription becomes active. + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull */ - public $subscriptionStartTime; + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } /** - * The date and time when the subscription ends. + * Checks if a property is nullable + * + * @param string $property + * @return bool */ - public $subscriptionEndTime; + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } /** - * The subscription period rule, used to define a subscription's billing period. + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool */ - public $periodRule; + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } /** - * A specific date and time after which the created subscription expires. - */ - public $subscriptionExpiryTime; + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'subscriptionRequestId' => 'subscriptionRequestId', + 'subscriptionDescription' => 'subscriptionDescription', + 'subscriptionRedirectUrl' => 'subscriptionRedirectUrl', + 'subscriptionStartTime' => 'subscriptionStartTime', + 'subscriptionEndTime' => 'subscriptionEndTime', + 'periodRule' => 'periodRule', + 'subscriptionExpiryTime' => 'subscriptionExpiryTime', + 'paymentMethod' => 'paymentMethod', + 'subscriptionNotificationUrl' => 'subscriptionNotificationUrl', + 'paymentNotificationUrl' => 'paymentNotificationUrl', + 'orderInfo' => 'orderInfo', + 'paymentAmount' => 'paymentAmount', + 'settlementStrategy' => 'settlementStrategy', + 'env' => 'env', + 'trials' => 'trials' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'subscriptionRequestId' => 'setSubscriptionRequestId', + 'subscriptionDescription' => 'setSubscriptionDescription', + 'subscriptionRedirectUrl' => 'setSubscriptionRedirectUrl', + 'subscriptionStartTime' => 'setSubscriptionStartTime', + 'subscriptionEndTime' => 'setSubscriptionEndTime', + 'periodRule' => 'setPeriodRule', + 'subscriptionExpiryTime' => 'setSubscriptionExpiryTime', + 'paymentMethod' => 'setPaymentMethod', + 'subscriptionNotificationUrl' => 'setSubscriptionNotificationUrl', + 'paymentNotificationUrl' => 'setPaymentNotificationUrl', + 'orderInfo' => 'setOrderInfo', + 'paymentAmount' => 'setPaymentAmount', + 'settlementStrategy' => 'setSettlementStrategy', + 'env' => 'setEnv', + 'trials' => 'setTrials' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'subscriptionRequestId' => 'getSubscriptionRequestId', + 'subscriptionDescription' => 'getSubscriptionDescription', + 'subscriptionRedirectUrl' => 'getSubscriptionRedirectUrl', + 'subscriptionStartTime' => 'getSubscriptionStartTime', + 'subscriptionEndTime' => 'getSubscriptionEndTime', + 'periodRule' => 'getPeriodRule', + 'subscriptionExpiryTime' => 'getSubscriptionExpiryTime', + 'paymentMethod' => 'getPaymentMethod', + 'subscriptionNotificationUrl' => 'getSubscriptionNotificationUrl', + 'paymentNotificationUrl' => 'getPaymentNotificationUrl', + 'orderInfo' => 'getOrderInfo', + 'paymentAmount' => 'getPaymentAmount', + 'settlementStrategy' => 'getSettlementStrategy', + 'env' => 'getEnv', + 'trials' => 'getTrials' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } /** - * The payment method that is used to collect the payment by the merchant or acquirer. + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array */ - public $paymentMethod; + public static function setters() + { + return self::$setters; + } /** - * The URL that is used to receive the subscription result notification. + * Array of attributes to getter functions (for serialization of requests) + * + * @return array */ - public $subscriptionNotificationUrl; + public static function getters() + { + return self::$getters; + } /** - * The URL that is used to receive the subscription result notification. + * The original name of the model. + * + * @return string */ - public $paymentNotificationUrl; + public function getModelName() + { + return self::$openAPIModelName; + } + /** - * The order information for the subscription. + * Associative array for storing property values + * + * @var mixed[] */ - public $orderInfo; + protected $container = []; /** - * The payment amount charged to the user per subscription period. + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model */ - public $paymentAmount; + public function __construct(?array $data = null) + { + $this->setIfExists('subscriptionRequestId', $data ?? [], null); + $this->setIfExists('subscriptionDescription', $data ?? [], null); + $this->setIfExists('subscriptionRedirectUrl', $data ?? [], null); + $this->setIfExists('subscriptionStartTime', $data ?? [], null); + $this->setIfExists('subscriptionEndTime', $data ?? [], null); + $this->setIfExists('periodRule', $data ?? [], null); + $this->setIfExists('subscriptionExpiryTime', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('subscriptionNotificationUrl', $data ?? [], null); + $this->setIfExists('paymentNotificationUrl', $data ?? [], null); + $this->setIfExists('orderInfo', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('settlementStrategy', $data ?? [], null); + $this->setIfExists('env', $data ?? [], null); + $this->setIfExists('trials', $data ?? [], null); + + $this->setPath("/ams/api/v1/subscriptions/create"); + } /** - * The settlement strategy for the payment request. - */ - public $settlementStrategy; + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } /** - * Information about the environment where the order is placed, such as the device information. + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons */ - public $env; + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['subscriptionRequestId'] === null) { + $invalidProperties[] = "'subscriptionRequestId' can't be null"; + } + if ($this->container['subscriptionDescription'] === null) { + $invalidProperties[] = "'subscriptionDescription' can't be null"; + } + if ($this->container['subscriptionRedirectUrl'] === null) { + $invalidProperties[] = "'subscriptionRedirectUrl' can't be null"; + } + if ($this->container['subscriptionStartTime'] === null) { + $invalidProperties[] = "'subscriptionStartTime' can't be null"; + } + if ($this->container['periodRule'] === null) { + $invalidProperties[] = "'periodRule' can't be null"; + } + if ($this->container['paymentMethod'] === null) { + $invalidProperties[] = "'paymentMethod' can't be null"; + } + if ($this->container['subscriptionNotificationUrl'] === null) { + $invalidProperties[] = "'subscriptionNotificationUrl' can't be null"; + } + if ($this->container['paymentNotificationUrl'] === null) { + $invalidProperties[] = "'paymentNotificationUrl' can't be null"; + } + if ($this->container['orderInfo'] === null) { + $invalidProperties[] = "'orderInfo' can't be null"; + } + if ($this->container['paymentAmount'] === null) { + $invalidProperties[] = "'paymentAmount' can't be null"; + } + if ($this->container['settlementStrategy'] === null) { + $invalidProperties[] = "'settlementStrategy' can't be null"; + } + if ($this->container['env'] === null) { + $invalidProperties[] = "'env' can't be null"; + } + return $invalidProperties; + } /** - * The list of trial information of a subscription. + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid */ - public $trials; - - function __construct() + public function valid() { - $this->setPath(AntomPathConstants::SUBSCRIPTION_CREATE_PATH); + return count($this->listInvalidProperties()) === 0; } /** - * @return mixed + * Gets subscriptionRequestId + * + * @return string */ public function getSubscriptionRequestId() { - return $this->subscriptionRequestId; + return $this->container['subscriptionRequestId']; } /** - * @param mixed $subscriptionRequestId + * Sets subscriptionRequestId + * + * @param string $subscriptionRequestId The unique ID assigned by a merchant to identify a subscription request. Antom uses this field for idempotency control. More information: This field is an API idempotency field.For subscription requests that are initiated with the same value of subscriptionRequestId and reach a final status of S or F, the same result is to be returned for the request. Maximum length: 64 characters + * + * @return self */ - public function setSubscriptionRequestId($subscriptionRequestId) + public function setSubscriptionRequestId($subscriptionRequestId) { - $this->subscriptionRequestId = $subscriptionRequestId; + $this->container['subscriptionRequestId'] = $subscriptionRequestId; + + return $this; } /** - * @return mixed + * Gets subscriptionDescription + * + * @return string */ public function getSubscriptionDescription() { - return $this->subscriptionDescription; + return $this->container['subscriptionDescription']; } /** - * @param mixed $subscriptionDescription + * Sets subscriptionDescription + * + * @param string $subscriptionDescription The description of the subscription, used for displaying user consumption records and other actions. More information: Maximum length: 256 characters + * + * @return self */ - public function setSubscriptionDescription($subscriptionDescription) + public function setSubscriptionDescription($subscriptionDescription) { - $this->subscriptionDescription = $subscriptionDescription; + $this->container['subscriptionDescription'] = $subscriptionDescription; + + return $this; } /** - * @return mixed + * Gets subscriptionRedirectUrl + * + * @return string */ public function getSubscriptionRedirectUrl() { - return $this->subscriptionRedirectUrl; + return $this->container['subscriptionRedirectUrl']; } /** - * @param mixed $subscriptionRedirectUrl + * Sets subscriptionRedirectUrl + * + * @param string $subscriptionRedirectUrl The merchant page URL that the user is redirected to after authorizing the subscription. More information: Maximum length: 2048 characters + * + * @return self */ - public function setSubscriptionRedirectUrl($subscriptionRedirectUrl) + public function setSubscriptionRedirectUrl($subscriptionRedirectUrl) { - $this->subscriptionRedirectUrl = $subscriptionRedirectUrl; + $this->container['subscriptionRedirectUrl'] = $subscriptionRedirectUrl; + + return $this; } /** - * @return mixed + * Gets subscriptionStartTime + * + * @return string */ public function getSubscriptionStartTime() { - return $this->subscriptionStartTime; + return $this->container['subscriptionStartTime']; } /** - * @param mixed $subscriptionStartTime + * Sets subscriptionStartTime + * + * @param string $subscriptionStartTime The date and time when the subscription becomes active. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setSubscriptionStartTime($subscriptionStartTime) + public function setSubscriptionStartTime($subscriptionStartTime) { - $this->subscriptionStartTime = $subscriptionStartTime; + $this->container['subscriptionStartTime'] = $subscriptionStartTime; + + return $this; } /** - * @return mixed + * Gets subscriptionEndTime + * + * @return string|null */ public function getSubscriptionEndTime() { - return $this->subscriptionEndTime; + return $this->container['subscriptionEndTime']; } /** - * @param mixed $subscriptionEndTime + * Sets subscriptionEndTime + * + * @param string|null $subscriptionEndTime The date and time when the subscription ends. Note: Specify this parameter when you want to designate the subscription end time. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setSubscriptionEndTime($subscriptionEndTime) + public function setSubscriptionEndTime($subscriptionEndTime) { - $this->subscriptionEndTime = $subscriptionEndTime; + $this->container['subscriptionEndTime'] = $subscriptionEndTime; + + return $this; } /** - * @return mixed + * Gets periodRule + * + * @return \request\model\PeriodRule */ public function getPeriodRule() { - return $this->periodRule; + return $this->container['periodRule']; } /** - * @param mixed $periodRule + * Sets periodRule + * + * @param \request\model\PeriodRule $periodRule periodRule + * + * @return self */ - public function setPeriodRule($periodRule) + public function setPeriodRule($periodRule) { - $this->periodRule = $periodRule; + $this->container['periodRule'] = $periodRule; + + return $this; } /** - * @return mixed + * Gets subscriptionExpiryTime + * + * @return string|null */ public function getSubscriptionExpiryTime() { - return $this->subscriptionExpiryTime; + return $this->container['subscriptionExpiryTime']; } /** - * @param mixed $subscriptionExpiryTime + * Sets subscriptionExpiryTime + * + * @param string|null $subscriptionExpiryTime A specific date and time after which the created subscription expires. When the subscription expires, the order must be terminated. The default value of this parameter is 30 minutes after the subscription creation request is sent. Note: Specify this parameter if you want to designate the subscription creation expiration time. The specified payment expiration time must be less than 48 hours after the subscription request is sent. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ - public function setSubscriptionExpiryTime($subscriptionExpiryTime) + public function setSubscriptionExpiryTime($subscriptionExpiryTime) { - $this->subscriptionExpiryTime = $subscriptionExpiryTime; + $this->container['subscriptionExpiryTime'] = $subscriptionExpiryTime; + + return $this; } /** - * @return mixed + * Gets paymentMethod + * + * @return \request\model\PaymentMethod */ public function getPaymentMethod() { - return $this->paymentMethod; + return $this->container['paymentMethod']; } /** - * @param mixed $paymentMethod + * Sets paymentMethod + * + * @param \request\model\PaymentMethod $paymentMethod paymentMethod + * + * @return self */ - public function setPaymentMethod($paymentMethod) + public function setPaymentMethod($paymentMethod) { - $this->paymentMethod = $paymentMethod; + $this->container['paymentMethod'] = $paymentMethod; + + return $this; } /** - * @return mixed + * Gets subscriptionNotificationUrl + * + * @return string */ public function getSubscriptionNotificationUrl() { - return $this->subscriptionNotificationUrl; + return $this->container['subscriptionNotificationUrl']; } /** - * @param mixed $subscriptionNotificationUrl + * Sets subscriptionNotificationUrl + * + * @param string $subscriptionNotificationUrl The URL that is used to receive the subscription result notification. You can also configure the subscription notification URL in Antom Dashboard. If you specify this URL in both this API and Antom Dashboard, the URL configured in the API takes precedence. Only one subscription notification URL can be configured in Antom Dashboard. More information: Maximum length: 2048 characters + * + * @return self */ - public function setSubscriptionNotificationUrl($subscriptionNotificationUrl) + public function setSubscriptionNotificationUrl($subscriptionNotificationUrl) { - $this->subscriptionNotificationUrl = $subscriptionNotificationUrl; + $this->container['subscriptionNotificationUrl'] = $subscriptionNotificationUrl; + + return $this; } /** - * @return mixed + * Gets paymentNotificationUrl + * + * @return string */ public function getPaymentNotificationUrl() { - return $this->paymentNotificationUrl; + return $this->container['paymentNotificationUrl']; } /** - * @param mixed $paymentNotificationUrl + * Sets paymentNotificationUrl + * + * @param string $paymentNotificationUrl The URL that is used to receive the payment result notification for each subscription period. You can also configure the subscription notification URL in Antom Dashboard. If you specify this URL in both this API and Antom Dashboard, the URL configured in the API takes precedence. You can only configure one subscription notification URL in Antom Dashboard. More information: Maximum length: 2048 characters + * + * @return self */ - public function setPaymentNotificationUrl($paymentNotificationUrl) + public function setPaymentNotificationUrl($paymentNotificationUrl) { - $this->paymentNotificationUrl = $paymentNotificationUrl; + $this->container['paymentNotificationUrl'] = $paymentNotificationUrl; + + return $this; } /** - * @return mixed + * Gets orderInfo + * + * @return \request\model\OrderInfo */ public function getOrderInfo() { - return $this->orderInfo; + return $this->container['orderInfo']; } /** - * @param mixed $orderInfo + * Sets orderInfo + * + * @param \request\model\OrderInfo $orderInfo orderInfo + * + * @return self */ - public function setOrderInfo($orderInfo) + public function setOrderInfo($orderInfo) { - $this->orderInfo = $orderInfo; + $this->container['orderInfo'] = $orderInfo; + + return $this; } /** - * @return mixed + * Gets paymentAmount + * + * @return \request\model\Amount */ public function getPaymentAmount() { - return $this->paymentAmount; + return $this->container['paymentAmount']; } /** - * @param mixed $paymentAmount + * Sets paymentAmount + * + * @param \request\model\Amount $paymentAmount paymentAmount + * + * @return self */ - public function setPaymentAmount($paymentAmount) + public function setPaymentAmount($paymentAmount) { - $this->paymentAmount = $paymentAmount; + $this->container['paymentAmount'] = $paymentAmount; + + return $this; } /** - * @return mixed + * Gets settlementStrategy + * + * @return \request\model\SettlementStrategy */ public function getSettlementStrategy() { - return $this->settlementStrategy; + return $this->container['settlementStrategy']; } /** - * @param mixed $settlementStrategy + * Sets settlementStrategy + * + * @param \request\model\SettlementStrategy $settlementStrategy settlementStrategy + * + * @return self */ - public function setSettlementStrategy($settlementStrategy) + public function setSettlementStrategy($settlementStrategy) { - $this->settlementStrategy = $settlementStrategy; + $this->container['settlementStrategy'] = $settlementStrategy; + + return $this; } /** - * @return mixed + * Gets env + * + * @return \request\model\Env */ public function getEnv() { - return $this->env; + return $this->container['env']; } /** - * @param mixed $env + * Sets env + * + * @param \request\model\Env $env env + * + * @return self */ - public function setEnv($env) + public function setEnv($env) { - $this->env = $env; + $this->container['env'] = $env; + + return $this; } /** - * @return mixed + * Gets trials + * + * @return \request\model\Trial[]|null */ public function getTrials() { - return $this->trials; + return $this->container['trials']; + } + + /** + * Sets trials + * + * @param \request\model\Trial[]|null $trials The list of trial information of a subscription. Note: Specify this parameter if the subscription includes any trial periods. + * + * @return self + */ + public function setTrials($trials) + { + $this->container['trials'] = $trials; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); } /** - * @param mixed $trials + * 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. */ - public function setTrials($trials) + #[\ReturnTypeWillChange] + public function jsonSerialize() { - $this->trials = $trials; + return ObjectSerializer::sanitizeForSerialization($this); } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/request/subscription/AlipaySubscriptionUpdateRequest.php b/request/subscription/AlipaySubscriptionUpdateRequest.php index 616ae83..e3dae3f 100644 --- a/request/subscription/AlipaySubscriptionUpdateRequest.php +++ b/request/subscription/AlipaySubscriptionUpdateRequest.php @@ -1,142 +1,606 @@ + */ +class AlipaySubscriptionUpdateRequest extends AlipayRequest implements ModelInterface, ArrayAccess, \JsonSerializable { + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'subscriptionUpdateRequestId' => 'string', + 'subscriptionId' => 'string', + 'subscriptionDescription' => 'string', + 'periodRule' => '\request\model\PeriodRule', + 'paymentAmount' => '\request\model\Amount', + 'subscriptionEndTime' => 'string', + 'orderInfo' => '\request\model\OrderInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'subscriptionUpdateRequestId' => null, + 'subscriptionId' => null, + 'subscriptionDescription' => null, + 'periodRule' => null, + 'paymentAmount' => null, + 'subscriptionEndTime' => null, + 'orderInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'subscriptionUpdateRequestId' => false, + 'subscriptionId' => false, + 'subscriptionDescription' => false, + 'periodRule' => false, + 'paymentAmount' => false, + 'subscriptionEndTime' => false, + 'orderInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } - public $subscriptionUpdateRequestId; - public $subscriptionId; - public $subscriptionDescription; - public $periodRule; + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } - public $paymentAmount; - public $subscriptionEndTime; - public $orderInfo; + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'subscriptionUpdateRequestId' => 'subscriptionUpdateRequestId', + 'subscriptionId' => 'subscriptionId', + 'subscriptionDescription' => 'subscriptionDescription', + 'periodRule' => 'periodRule', + 'paymentAmount' => 'paymentAmount', + 'subscriptionEndTime' => 'subscriptionEndTime', + 'orderInfo' => 'orderInfo' + ]; + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'subscriptionUpdateRequestId' => 'setSubscriptionUpdateRequestId', + 'subscriptionId' => 'setSubscriptionId', + 'subscriptionDescription' => 'setSubscriptionDescription', + 'periodRule' => 'setPeriodRule', + 'paymentAmount' => 'setPaymentAmount', + 'subscriptionEndTime' => 'setSubscriptionEndTime', + 'orderInfo' => 'setOrderInfo' + ]; - function __construct() + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'subscriptionUpdateRequestId' => 'getSubscriptionUpdateRequestId', + 'subscriptionId' => 'getSubscriptionId', + 'subscriptionDescription' => 'getSubscriptionDescription', + 'periodRule' => 'getPeriodRule', + 'paymentAmount' => 'getPaymentAmount', + 'subscriptionEndTime' => 'getSubscriptionEndTime', + 'orderInfo' => 'getOrderInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() { - $this->setPath(AntomPathConstants::SUBSCRIPTION_UPDATE_PATH); + return self::$setters; } + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } /** - * @return mixed + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('subscriptionUpdateRequestId', $data ?? [], null); + $this->setIfExists('subscriptionId', $data ?? [], null); + $this->setIfExists('subscriptionDescription', $data ?? [], null); + $this->setIfExists('periodRule', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('subscriptionEndTime', $data ?? [], null); + $this->setIfExists('orderInfo', $data ?? [], null); + + $this->setPath("/ams/api/v1/subscriptions/update"); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['subscriptionUpdateRequestId'] === null) { + $invalidProperties[] = "'subscriptionUpdateRequestId' can't be null"; + } + if ($this->container['subscriptionId'] === null) { + $invalidProperties[] = "'subscriptionId' can't be null"; + } + if ($this->container['orderInfo'] === null) { + $invalidProperties[] = "'orderInfo' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets subscriptionUpdateRequestId + * + * @return string */ public function getSubscriptionUpdateRequestId() { - return $this->subscriptionUpdateRequestId; + return $this->container['subscriptionUpdateRequestId']; } /** - * @param mixed $subscriptionUpdateRequestId + * Sets subscriptionUpdateRequestId + * + * @param string $subscriptionUpdateRequestId The unique ID assigned by a merchant to identify a subscription update request. More information: Maximum length: 64 characters + * + * @return self */ public function setSubscriptionUpdateRequestId($subscriptionUpdateRequestId) { - $this->subscriptionUpdateRequestId = $subscriptionUpdateRequestId; + $this->container['subscriptionUpdateRequestId'] = $subscriptionUpdateRequestId; + + return $this; } /** - * @return mixed + * Gets subscriptionId + * + * @return string */ public function getSubscriptionId() { - return $this->subscriptionId; + return $this->container['subscriptionId']; } /** - * @param mixed $subscriptionId + * Sets subscriptionId + * + * @param string $subscriptionId The unique ID assigned by Antom to identify a subscription. More information: Maximum length: 64 characters + * + * @return self */ public function setSubscriptionId($subscriptionId) { - $this->subscriptionId = $subscriptionId; + $this->container['subscriptionId'] = $subscriptionId; + + return $this; } /** - * @return mixed + * Gets subscriptionDescription + * + * @return string|null */ public function getSubscriptionDescription() { - return $this->subscriptionDescription; + return $this->container['subscriptionDescription']; } /** - * @param mixed $subscriptionDescription + * Sets subscriptionDescription + * + * @param string|null $subscriptionDescription The description of the subscription, used for displaying user consumption records and other actions. More information: Maximum length: 256 characters + * + * @return self */ public function setSubscriptionDescription($subscriptionDescription) { - $this->subscriptionDescription = $subscriptionDescription; + $this->container['subscriptionDescription'] = $subscriptionDescription; + + return $this; } /** - * @return mixed + * Gets periodRule + * + * @return \request\model\PeriodRule|null */ public function getPeriodRule() { - return $this->periodRule; + return $this->container['periodRule']; } /** - * @param mixed $periodRule + * Sets periodRule + * + * @param \request\model\PeriodRule|null $periodRule periodRule + * + * @return self */ public function setPeriodRule($periodRule) { - $this->periodRule = $periodRule; + $this->container['periodRule'] = $periodRule; + + return $this; } /** - * @return mixed + * Gets paymentAmount + * + * @return \request\model\Amount|null */ public function getPaymentAmount() { - return $this->paymentAmount; + return $this->container['paymentAmount']; } /** - * @param mixed $paymentAmount + * Sets paymentAmount + * + * @param \request\model\Amount|null $paymentAmount paymentAmount + * + * @return self */ public function setPaymentAmount($paymentAmount) { - $this->paymentAmount = $paymentAmount; + $this->container['paymentAmount'] = $paymentAmount; + + return $this; } /** - * @return mixed + * Gets subscriptionEndTime + * + * @return string|null */ public function getSubscriptionEndTime() { - return $this->subscriptionEndTime; + return $this->container['subscriptionEndTime']; } /** - * @param mixed $subscriptionEndTime + * Sets subscriptionEndTime + * + * @param string|null $subscriptionEndTime The date and time when the subscription ends. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self */ public function setSubscriptionEndTime($subscriptionEndTime) { - $this->subscriptionEndTime = $subscriptionEndTime; + $this->container['subscriptionEndTime'] = $subscriptionEndTime; + + return $this; } /** - * @return mixed + * Gets orderInfo + * + * @return \request\model\OrderInfo */ public function getOrderInfo() { - return $this->orderInfo; + return $this->container['orderInfo']; } /** - * @param mixed $orderInfo + * Sets orderInfo + * + * @param \request\model\OrderInfo $orderInfo orderInfo + * + * @return self */ public function setOrderInfo($orderInfo) { - $this->orderInfo = $orderInfo; + $this->container['orderInfo'] = $orderInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } } + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } -} \ No newline at end of file + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/auth/AlipayAuthApplyTokenResponse.php b/response/auth/AlipayAuthApplyTokenResponse.php new file mode 100644 index 0000000..1bf9032 --- /dev/null +++ b/response/auth/AlipayAuthApplyTokenResponse.php @@ -0,0 +1,630 @@ + + */ +class AlipayAuthApplyTokenResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAuthApplyTokenResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'accessToken' => 'string', + 'accessTokenExpiryTime' => 'string', + 'refreshToken' => 'string', + 'refreshTokenExpiryTime' => 'string', + 'extendInfo' => 'string', + 'userLoginId' => 'string', + 'pspCustomerInfo' => '\request\model\PspCustomerInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'accessToken' => null, + 'accessTokenExpiryTime' => null, + 'refreshToken' => null, + 'refreshTokenExpiryTime' => null, + 'extendInfo' => null, + 'userLoginId' => null, + 'pspCustomerInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'accessToken' => false, + 'accessTokenExpiryTime' => false, + 'refreshToken' => false, + 'refreshTokenExpiryTime' => false, + 'extendInfo' => false, + 'userLoginId' => false, + 'pspCustomerInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'accessToken' => 'accessToken', + 'accessTokenExpiryTime' => 'accessTokenExpiryTime', + 'refreshToken' => 'refreshToken', + 'refreshTokenExpiryTime' => 'refreshTokenExpiryTime', + 'extendInfo' => 'extendInfo', + 'userLoginId' => 'userLoginId', + 'pspCustomerInfo' => 'pspCustomerInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'accessToken' => 'setAccessToken', + 'accessTokenExpiryTime' => 'setAccessTokenExpiryTime', + 'refreshToken' => 'setRefreshToken', + 'refreshTokenExpiryTime' => 'setRefreshTokenExpiryTime', + 'extendInfo' => 'setExtendInfo', + 'userLoginId' => 'setUserLoginId', + 'pspCustomerInfo' => 'setPspCustomerInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'accessToken' => 'getAccessToken', + 'accessTokenExpiryTime' => 'getAccessTokenExpiryTime', + 'refreshToken' => 'getRefreshToken', + 'refreshTokenExpiryTime' => 'getRefreshTokenExpiryTime', + 'extendInfo' => 'getExtendInfo', + 'userLoginId' => 'getUserLoginId', + 'pspCustomerInfo' => 'getPspCustomerInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('accessToken', $data ?? [], null); + $this->setIfExists('accessTokenExpiryTime', $data ?? [], null); + $this->setIfExists('refreshToken', $data ?? [], null); + $this->setIfExists('refreshTokenExpiryTime', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('userLoginId', $data ?? [], null); + $this->setIfExists('pspCustomerInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets accessToken + * + * @return string|null + */ + public function getAccessToken() + { + return $this->container['accessToken']; + } + + /** + * Sets accessToken + * + * @param string|null $accessToken The access token that is used to access the corresponding scope of the user resource. Note: This field is returned when the API is called successfully. More information: Maximum length: 128 characters + * + * @return self + */ + public function setAccessToken($accessToken) + { + $this->container['accessToken'] = $accessToken; + + return $this; + } + + /** + * Gets accessTokenExpiryTime + * + * @return string|null + */ + public function getAccessTokenExpiryTime() + { + return $this->container['accessTokenExpiryTime']; + } + + /** + * Sets accessTokenExpiryTime + * + * @param string|null $accessTokenExpiryTime The time after which the access token expires. After the access token expires, the access token cannot be used to deduct money from the user's account. Note: This field is returned when accessToken is returned. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setAccessTokenExpiryTime($accessTokenExpiryTime) + { + $this->container['accessTokenExpiryTime'] = $accessTokenExpiryTime; + + return $this; + } + + /** + * Gets refreshToken + * + * @return string|null + */ + public function getRefreshToken() + { + return $this->container['refreshToken']; + } + + /** + * Sets refreshToken + * + * @param string|null $refreshToken The refresh token that is used to exchange for a new access token when the access token is about to expire. Note: This field is returned when the wallet supports refreshing the token. If this field is not returned, it indicates that the access token has a quite long valid period. More information: Maximum length: 128 characters + * + * @return self + */ + public function setRefreshToken($refreshToken) + { + $this->container['refreshToken'] = $refreshToken; + + return $this; + } + + /** + * Gets refreshTokenExpiryTime + * + * @return string|null + */ + public function getRefreshTokenExpiryTime() + { + return $this->container['refreshTokenExpiryTime']; + } + + /** + * Sets refreshTokenExpiryTime + * + * @param string|null $refreshTokenExpiryTime The time after which the refresh token expires. After the refresh token expires, the refresh token cannot be used to retrieve a new access token. Note: This field is returned when refreshToken is returned. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setRefreshTokenExpiryTime($refreshTokenExpiryTime) + { + $this->container['refreshTokenExpiryTime'] = $refreshTokenExpiryTime; + + return $this; + } + + /** + * Gets extendInfo + * + * @return string|null + */ + public function getExtendInfo() + { + return $this->container['extendInfo']; + } + + /** + * Sets extendInfo + * + * @param string|null $extendInfo Extended information. Note: This field is returned when extended information exists. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setExtendInfo($extendInfo) + { + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets userLoginId + * + * @return string|null + */ + public function getUserLoginId() + { + return $this->container['userLoginId']; + } + + /** + * Sets userLoginId + * + * @param string|null $userLoginId The login ID that the user used to register in the wallet. The login ID can be the user's email address or phone number, which is masked when returned to Alipay+ payment methods . This field can inform the merchant of the users who are registered. Note: This field is returned when result.resultCode is SUCCESS and the value of the scopes field in the consult API is AGREEMENT_PAY. More information: Maximum length: 64 characters + * + * @return self + */ + public function setUserLoginId($userLoginId) + { + $this->container['userLoginId'] = $userLoginId; + + return $this; + } + + /** + * Gets pspCustomerInfo + * + * @return \request\model\PspCustomerInfo|null + */ + public function getPspCustomerInfo() + { + return $this->container['pspCustomerInfo']; + } + + /** + * Sets pspCustomerInfo + * + * @param \request\model\PspCustomerInfo|null $pspCustomerInfo pspCustomerInfo + * + * @return self + */ + public function setPspCustomerInfo($pspCustomerInfo) + { + $this->container['pspCustomerInfo'] = $pspCustomerInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/auth/AlipayAuthConsultResponse.php b/response/auth/AlipayAuthConsultResponse.php new file mode 100644 index 0000000..8ab2a92 --- /dev/null +++ b/response/auth/AlipayAuthConsultResponse.php @@ -0,0 +1,630 @@ + + */ +class AlipayAuthConsultResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAuthConsultResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'authUrl' => 'string', + 'extendInfo' => 'string', + 'normalUrl' => 'string', + 'schemeUrl' => 'string', + 'applinkUrl' => 'string', + 'appIdentifier' => 'string', + 'authCodeForm' => '\request\model\AuthCodeForm' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'authUrl' => null, + 'extendInfo' => null, + 'normalUrl' => null, + 'schemeUrl' => null, + 'applinkUrl' => null, + 'appIdentifier' => null, + 'authCodeForm' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'authUrl' => false, + 'extendInfo' => false, + 'normalUrl' => false, + 'schemeUrl' => false, + 'applinkUrl' => false, + 'appIdentifier' => false, + 'authCodeForm' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'authUrl' => 'authUrl', + 'extendInfo' => 'extendInfo', + 'normalUrl' => 'normalUrl', + 'schemeUrl' => 'schemeUrl', + 'applinkUrl' => 'applinkUrl', + 'appIdentifier' => 'appIdentifier', + 'authCodeForm' => 'authCodeForm' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'authUrl' => 'setAuthUrl', + 'extendInfo' => 'setExtendInfo', + 'normalUrl' => 'setNormalUrl', + 'schemeUrl' => 'setSchemeUrl', + 'applinkUrl' => 'setApplinkUrl', + 'appIdentifier' => 'setAppIdentifier', + 'authCodeForm' => 'setAuthCodeForm' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'authUrl' => 'getAuthUrl', + 'extendInfo' => 'getExtendInfo', + 'normalUrl' => 'getNormalUrl', + 'schemeUrl' => 'getSchemeUrl', + 'applinkUrl' => 'getApplinkUrl', + 'appIdentifier' => 'getAppIdentifier', + 'authCodeForm' => 'getAuthCodeForm' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('authUrl', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('normalUrl', $data ?? [], null); + $this->setIfExists('schemeUrl', $data ?? [], null); + $this->setIfExists('applinkUrl', $data ?? [], null); + $this->setIfExists('appIdentifier', $data ?? [], null); + $this->setIfExists('authCodeForm', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets authUrl + * + * @return string|null + */ + public function getAuthUrl() + { + return $this->container['authUrl']; + } + + /** + * Sets authUrl + * + * @param string|null $authUrl authUrl + * + * @return self + */ + public function setAuthUrl($authUrl) + { + $this->container['authUrl'] = $authUrl; + + return $this; + } + + /** + * Gets extendInfo + * + * @return string|null + */ + public function getExtendInfo() + { + return $this->container['extendInfo']; + } + + /** + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self + */ + public function setExtendInfo($extendInfo) + { + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets normalUrl + * + * @return string|null + */ + public function getNormalUrl() + { + return $this->container['normalUrl']; + } + + /** + * Sets normalUrl + * + * @param string|null $normalUrl The URL that redirects users to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of result.resultCode is SUCCESS, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setNormalUrl($normalUrl) + { + $this->container['normalUrl'] = $normalUrl; + + return $this; + } + + /** + * Gets schemeUrl + * + * @return string|null + */ + public function getSchemeUrl() + { + return $this->container['schemeUrl']; + } + + /** + * Sets schemeUrl + * + * @param string|null $schemeUrl The URL scheme that redirects users to open an app in an Android or iOS system when the target app is installed. Note: When the value of result.resultCode is SUCCESS, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setSchemeUrl($schemeUrl) + { + $this->container['schemeUrl'] = $schemeUrl; + + return $this; + } + + /** + * Gets applinkUrl + * + * @return string|null + */ + public function getApplinkUrl() + { + return $this->container['applinkUrl']; + } + + /** + * Sets applinkUrl + * + * @param string|null $applinkUrl The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of result.resultCode is SUCCESS, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setApplinkUrl($applinkUrl) + { + $this->container['applinkUrl'] = $applinkUrl; + + return $this; + } + + /** + * Gets appIdentifier + * + * @return string|null + */ + public function getAppIdentifier() + { + return $this->container['appIdentifier']; + } + + /** + * Sets appIdentifier + * + * @param string|null $appIdentifier Android package name, which is used for Android app to open a cashier page. Note: This field is returned when result.resultCode is SUCCESS and terminalType is ​APP or ​WAP​. More information: Maximum length: 128 characters + * + * @return self + */ + public function setAppIdentifier($appIdentifier) + { + $this->container['appIdentifier'] = $appIdentifier; + + return $this; + } + + /** + * Gets authCodeForm + * + * @return \request\model\AuthCodeForm|null + */ + public function getAuthCodeForm() + { + return $this->container['authCodeForm']; + } + + /** + * Sets authCodeForm + * + * @param \request\model\AuthCodeForm|null $authCodeForm authCodeForm + * + * @return self + */ + public function setAuthCodeForm($authCodeForm) + { + $this->container['authCodeForm'] = $authCodeForm; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/auth/AlipayAuthRevokeTokenResponse.php b/response/auth/AlipayAuthRevokeTokenResponse.php new file mode 100644 index 0000000..e4461bd --- /dev/null +++ b/response/auth/AlipayAuthRevokeTokenResponse.php @@ -0,0 +1,444 @@ + + */ +class AlipayAuthRevokeTokenResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAuthRevokeTokenResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'extendInfo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'extendInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'extendInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'extendInfo' => 'extendInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'extendInfo' => 'setExtendInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'extendInfo' => 'getExtendInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets extendInfo + * + * @return string|null + */ + public function getExtendInfo() + { + return $this->container['extendInfo']; + } + + /** + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self + */ + public function setExtendInfo($extendInfo) + { + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/dispute/AlipayAcceptDisputeResponse.php b/response/dispute/AlipayAcceptDisputeResponse.php new file mode 100644 index 0000000..2ce1dfd --- /dev/null +++ b/response/dispute/AlipayAcceptDisputeResponse.php @@ -0,0 +1,475 @@ + + */ +class AlipayAcceptDisputeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayAcceptDisputeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'disputeId' => 'string', + 'disputeResolutionTime' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'disputeId' => null, + 'disputeResolutionTime' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'disputeId' => false, + 'disputeResolutionTime' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'disputeId' => 'disputeId', + 'disputeResolutionTime' => 'disputeResolutionTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'disputeId' => 'setDisputeId', + 'disputeResolutionTime' => 'setDisputeResolutionTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'disputeId' => 'getDisputeId', + 'disputeResolutionTime' => 'getDisputeResolutionTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('disputeId', $data ?? [], null); + $this->setIfExists('disputeResolutionTime', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets disputeId + * + * @return string|null + */ + public function getDisputeId() + { + return $this->container['disputeId']; + } + + /** + * Sets disputeId + * + * @param string|null $disputeId The unique ID assigned by Antom to identify a dispute. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + * + * @return self + */ + public function setDisputeId($disputeId) + { + $this->container['disputeId'] = $disputeId; + + return $this; + } + + /** + * Gets disputeResolutionTime + * + * @return string|null + */ + public function getDisputeResolutionTime() + { + return $this->container['disputeResolutionTime']; + } + + /** + * Sets disputeResolutionTime + * + * @param string|null $disputeResolutionTime The time when you accept the dispute. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + * + * @return self + */ + public function setDisputeResolutionTime($disputeResolutionTime) + { + $this->container['disputeResolutionTime'] = $disputeResolutionTime; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/dispute/AlipayDownloadDisputeEvidenceResponse.php b/response/dispute/AlipayDownloadDisputeEvidenceResponse.php new file mode 100644 index 0000000..1e613de --- /dev/null +++ b/response/dispute/AlipayDownloadDisputeEvidenceResponse.php @@ -0,0 +1,475 @@ + + */ +class AlipayDownloadDisputeEvidenceResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayDownloadDisputeEvidenceResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'disputeEvidence' => 'string', + 'disputeEvidenceFormat' => '\request\model\DisputeEvidenceFormatType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'disputeEvidence' => null, + 'disputeEvidenceFormat' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'disputeEvidence' => false, + 'disputeEvidenceFormat' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'disputeEvidence' => 'disputeEvidence', + 'disputeEvidenceFormat' => 'disputeEvidenceFormat' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'disputeEvidence' => 'setDisputeEvidence', + 'disputeEvidenceFormat' => 'setDisputeEvidenceFormat' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'disputeEvidence' => 'getDisputeEvidence', + 'disputeEvidenceFormat' => 'getDisputeEvidenceFormat' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('disputeEvidence', $data ?? [], null); + $this->setIfExists('disputeEvidenceFormat', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets disputeEvidence + * + * @return string|null + */ + public function getDisputeEvidence() + { + return $this->container['disputeEvidence']; + } + + /** + * Sets disputeEvidence + * + * @param string|null $disputeEvidence The dispute evidence that is encoded in the Based64 format. Decode the Base64 document to get the Word or PDF file. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 1000000 characters + * + * @return self + */ + public function setDisputeEvidence($disputeEvidence) + { + $this->container['disputeEvidence'] = $disputeEvidence; + + return $this; + } + + /** + * Gets disputeEvidenceFormat + * + * @return \request\model\DisputeEvidenceFormatType|null + */ + public function getDisputeEvidenceFormat() + { + return $this->container['disputeEvidenceFormat']; + } + + /** + * Sets disputeEvidenceFormat + * + * @param \request\model\DisputeEvidenceFormatType|null $disputeEvidenceFormat disputeEvidenceFormat + * + * @return self + */ + public function setDisputeEvidenceFormat($disputeEvidenceFormat) + { + $this->container['disputeEvidenceFormat'] = $disputeEvidenceFormat; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/dispute/AlipaySupplyDefenseDocumentResponse.php b/response/dispute/AlipaySupplyDefenseDocumentResponse.php new file mode 100644 index 0000000..1c0cc2c --- /dev/null +++ b/response/dispute/AlipaySupplyDefenseDocumentResponse.php @@ -0,0 +1,475 @@ + + */ +class AlipaySupplyDefenseDocumentResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySupplyDefenseDocumentResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'disputeId' => 'string', + 'disputeResolutionTime' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'disputeId' => null, + 'disputeResolutionTime' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'disputeId' => false, + 'disputeResolutionTime' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'disputeId' => 'disputeId', + 'disputeResolutionTime' => 'disputeResolutionTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'disputeId' => 'setDisputeId', + 'disputeResolutionTime' => 'setDisputeResolutionTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'disputeId' => 'getDisputeId', + 'disputeResolutionTime' => 'getDisputeResolutionTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('disputeId', $data ?? [], null); + $this->setIfExists('disputeResolutionTime', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets disputeId + * + * @return string|null + */ + public function getDisputeId() + { + return $this->container['disputeId']; + } + + /** + * Sets disputeId + * + * @param string|null $disputeId The unique ID assigned by Antom to identify a dispute. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + * + * @return self + */ + public function setDisputeId($disputeId) + { + $this->container['disputeId'] = $disputeId; + + return $this; + } + + /** + * Gets disputeResolutionTime + * + * @return string|null + */ + public function getDisputeResolutionTime() + { + return $this->container['disputeResolutionTime']; + } + + /** + * Sets disputeResolutionTime + * + * @param string|null $disputeResolutionTime The time when you upload the dispute defense document. Note: This prameter is returned when the value of resultCode is SUCCESS. More information: Maximum length: 64 characters + * + * @return self + */ + public function setDisputeResolutionTime($disputeResolutionTime) + { + $this->container['disputeResolutionTime'] = $disputeResolutionTime; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/marketplace/AlipayCreatePayoutResponse.php b/response/marketplace/AlipayCreatePayoutResponse.php new file mode 100644 index 0000000..bd2a8d3 --- /dev/null +++ b/response/marketplace/AlipayCreatePayoutResponse.php @@ -0,0 +1,537 @@ + + */ +class AlipayCreatePayoutResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayCreatePayoutResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'transferId' => 'string', + 'transferRequestId' => 'string', + 'transferFromDetail' => '\request\model\TransferFromDetail', + 'transferToDetail' => '\request\model\TransferToDetail' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'transferId' => null, + 'transferRequestId' => null, + 'transferFromDetail' => null, + 'transferToDetail' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'transferId' => false, + 'transferRequestId' => false, + 'transferFromDetail' => false, + 'transferToDetail' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'transferId' => 'transferId', + 'transferRequestId' => 'transferRequestId', + 'transferFromDetail' => 'transferFromDetail', + 'transferToDetail' => 'transferToDetail' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'transferId' => 'setTransferId', + 'transferRequestId' => 'setTransferRequestId', + 'transferFromDetail' => 'setTransferFromDetail', + 'transferToDetail' => 'setTransferToDetail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'transferId' => 'getTransferId', + 'transferRequestId' => 'getTransferRequestId', + 'transferFromDetail' => 'getTransferFromDetail', + 'transferToDetail' => 'getTransferToDetail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('transferId', $data ?? [], null); + $this->setIfExists('transferRequestId', $data ?? [], null); + $this->setIfExists('transferFromDetail', $data ?? [], null); + $this->setIfExists('transferToDetail', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets transferId + * + * @return string|null + */ + public function getTransferId() + { + return $this->container['transferId']; + } + + /** + * Sets transferId + * + * @param string|null $transferId The unique ID assigned by Antom to identify a payout. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + * + * @return self + */ + public function setTransferId($transferId) + { + $this->container['transferId'] = $transferId; + + return $this; + } + + /** + * Gets transferRequestId + * + * @return string|null + */ + public function getTransferRequestId() + { + return $this->container['transferRequestId']; + } + + /** + * Sets transferRequestId + * + * @param string|null $transferRequestId The unique ID assigned by the marketplace to identify a payout request. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + * + * @return self + */ + public function setTransferRequestId($transferRequestId) + { + $this->container['transferRequestId'] = $transferRequestId; + + return $this; + } + + /** + * Gets transferFromDetail + * + * @return \request\model\TransferFromDetail|null + */ + public function getTransferFromDetail() + { + return $this->container['transferFromDetail']; + } + + /** + * Sets transferFromDetail + * + * @param \request\model\TransferFromDetail|null $transferFromDetail transferFromDetail + * + * @return self + */ + public function setTransferFromDetail($transferFromDetail) + { + $this->container['transferFromDetail'] = $transferFromDetail; + + return $this; + } + + /** + * Gets transferToDetail + * + * @return \request\model\TransferToDetail|null + */ + public function getTransferToDetail() + { + return $this->container['transferToDetail']; + } + + /** + * Sets transferToDetail + * + * @param \request\model\TransferToDetail|null $transferToDetail transferToDetail + * + * @return self + */ + public function setTransferToDetail($transferToDetail) + { + $this->container['transferToDetail'] = $transferToDetail; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/marketplace/AlipayCreateTransferResponse.php b/response/marketplace/AlipayCreateTransferResponse.php new file mode 100644 index 0000000..cd5868d --- /dev/null +++ b/response/marketplace/AlipayCreateTransferResponse.php @@ -0,0 +1,540 @@ + + */ +class AlipayCreateTransferResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayCreateTransferResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'transferId' => 'string', + 'transferRequestId' => 'string', + 'transferFromDetail' => '\request\model\TransferFromDetail', + 'transferToDetail' => '\request\model\TransferToDetail' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'transferId' => null, + 'transferRequestId' => null, + 'transferFromDetail' => null, + 'transferToDetail' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'transferId' => false, + 'transferRequestId' => false, + 'transferFromDetail' => false, + 'transferToDetail' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'transferId' => 'transferId', + 'transferRequestId' => 'transferRequestId', + 'transferFromDetail' => 'transferFromDetail', + 'transferToDetail' => 'transferToDetail' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'transferId' => 'setTransferId', + 'transferRequestId' => 'setTransferRequestId', + 'transferFromDetail' => 'setTransferFromDetail', + 'transferToDetail' => 'setTransferToDetail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'transferId' => 'getTransferId', + 'transferRequestId' => 'getTransferRequestId', + 'transferFromDetail' => 'getTransferFromDetail', + 'transferToDetail' => 'getTransferToDetail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('transferId', $data ?? [], null); + $this->setIfExists('transferRequestId', $data ?? [], null); + $this->setIfExists('transferFromDetail', $data ?? [], null); + $this->setIfExists('transferToDetail', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + if ($this->container['transferToDetail'] === null) { + $invalidProperties[] = "'transferToDetail' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets transferId + * + * @return string|null + */ + public function getTransferId() + { + return $this->container['transferId']; + } + + /** + * Sets transferId + * + * @param string|null $transferId The unique ID assigned by Antom to identify a transfer. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + * + * @return self + */ + public function setTransferId($transferId) + { + $this->container['transferId'] = $transferId; + + return $this; + } + + /** + * Gets transferRequestId + * + * @return string|null + */ + public function getTransferRequestId() + { + return $this->container['transferRequestId']; + } + + /** + * Sets transferRequestId + * + * @param string|null $transferRequestId The unique ID assigned by the marketplace to identify a transfer request. This parameter is returned when the value of result.resultStatus is U. More information: Maximum length: 64 characters + * + * @return self + */ + public function setTransferRequestId($transferRequestId) + { + $this->container['transferRequestId'] = $transferRequestId; + + return $this; + } + + /** + * Gets transferFromDetail + * + * @return \request\model\TransferFromDetail|null + */ + public function getTransferFromDetail() + { + return $this->container['transferFromDetail']; + } + + /** + * Sets transferFromDetail + * + * @param \request\model\TransferFromDetail|null $transferFromDetail transferFromDetail + * + * @return self + */ + public function setTransferFromDetail($transferFromDetail) + { + $this->container['transferFromDetail'] = $transferFromDetail; + + return $this; + } + + /** + * Gets transferToDetail + * + * @return \request\model\TransferToDetail + */ + public function getTransferToDetail() + { + return $this->container['transferToDetail']; + } + + /** + * Sets transferToDetail + * + * @param \request\model\TransferToDetail $transferToDetail transferToDetail + * + * @return self + */ + public function setTransferToDetail($transferToDetail) + { + $this->container['transferToDetail'] = $transferToDetail; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/marketplace/AlipayInquireBalanceResponse.php b/response/marketplace/AlipayInquireBalanceResponse.php new file mode 100644 index 0000000..5917ef7 --- /dev/null +++ b/response/marketplace/AlipayInquireBalanceResponse.php @@ -0,0 +1,447 @@ + + */ +class AlipayInquireBalanceResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayInquireBalanceResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'accountBalances' => '\request\model\AccountBalance[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'accountBalances' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'accountBalances' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'accountBalances' => 'accountBalances' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'accountBalances' => 'setAccountBalances' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'accountBalances' => 'getAccountBalances' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('accountBalances', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + if ($this->container['accountBalances'] === null) { + $invalidProperties[] = "'accountBalances' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets accountBalances + * + * @return \request\model\AccountBalance[] + */ + public function getAccountBalances() + { + return $this->container['accountBalances']; + } + + /** + * Sets accountBalances + * + * @param \request\model\AccountBalance[] $accountBalances The list of balance accounts assigned by Alipay. More information:Maximum length: 64 characters + * + * @return self + */ + public function setAccountBalances($accountBalances) + { + $this->container['accountBalances'] = $accountBalances; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/marketplace/AlipayRegisterResponse.php b/response/marketplace/AlipayRegisterResponse.php new file mode 100644 index 0000000..a0aba73 --- /dev/null +++ b/response/marketplace/AlipayRegisterResponse.php @@ -0,0 +1,441 @@ + + */ +class AlipayRegisterResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayRegisterResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'registrationStatus' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'registrationStatus' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'registrationStatus' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'registrationStatus' => 'registrationStatus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'registrationStatus' => 'setRegistrationStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'registrationStatus' => 'getRegistrationStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('registrationStatus', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result|null $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets registrationStatus + * + * @return string|null + */ + public function getRegistrationStatus() + { + return $this->container['registrationStatus']; + } + + /** + * Sets registrationStatus + * + * @param string|null $registrationStatus The registration status of the merchant. The value of this parameter is fixed to PROCESSING. Get the sub-merchant's registration result from the notifyRegistration interface. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 64 characters + * + * @return self + */ + public function setRegistrationStatus($registrationStatus) + { + $this->container['registrationStatus'] = $registrationStatus; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/marketplace/AlipaySettleResponse.php b/response/marketplace/AlipaySettleResponse.php new file mode 100644 index 0000000..cc9c324 --- /dev/null +++ b/response/marketplace/AlipaySettleResponse.php @@ -0,0 +1,478 @@ + + */ +class AlipaySettleResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySettleResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'settlementRequestId' => 'string', + 'settlementId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'settlementRequestId' => null, + 'settlementId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'settlementRequestId' => false, + 'settlementId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'settlementRequestId' => 'settlementRequestId', + 'settlementId' => 'settlementId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'settlementRequestId' => 'setSettlementRequestId', + 'settlementId' => 'setSettlementId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'settlementRequestId' => 'getSettlementRequestId', + 'settlementId' => 'getSettlementId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('settlementRequestId', $data ?? [], null); + $this->setIfExists('settlementId', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['settlementRequestId'] === null) { + $invalidProperties[] = "'settlementRequestId' can't be null"; + } + if ($this->container['settlementId'] === null) { + $invalidProperties[] = "'settlementId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result|null $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets settlementRequestId + * + * @return string + */ + public function getSettlementRequestId() + { + return $this->container['settlementRequestId']; + } + + /** + * Sets settlementRequestId + * + * @param string $settlementRequestId The unique ID that is assigned by the marketplace to identify a settlement request. More information: Maximum length: 64 characters + * + * @return self + */ + public function setSettlementRequestId($settlementRequestId) + { + $this->container['settlementRequestId'] = $settlementRequestId; + + return $this; + } + + /** + * Gets settlementId + * + * @return string + */ + public function getSettlementId() + { + return $this->container['settlementId']; + } + + /** + * Sets settlementId + * + * @param string $settlementId The unique ID that is assigned by Antom to identify a settlement. More information: Maximum length: 64 characters + * + * @return self + */ + public function setSettlementId($settlementId) + { + $this->container['settlementId'] = $settlementId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/marketplace/AlipaySettlementInfoUpdateResponse.php b/response/marketplace/AlipaySettlementInfoUpdateResponse.php new file mode 100644 index 0000000..c538fd8 --- /dev/null +++ b/response/marketplace/AlipaySettlementInfoUpdateResponse.php @@ -0,0 +1,441 @@ + + */ +class AlipaySettlementInfoUpdateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySettlementInfoUpdateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'updateStatus' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'updateStatus' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'updateStatus' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'updateStatus' => 'updateStatus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'updateStatus' => 'setUpdateStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'updateStatus' => 'getUpdateStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('updateStatus', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result|null $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets updateStatus + * + * @return string|null + */ + public function getUpdateStatus() + { + return $this->container['updateStatus']; + } + + /** + * Sets updateStatus + * + * @param string|null $updateStatus The update status of the settlement information. The value of this parameter is fixed to PROCESSING. Get the settlement information update result from the notifyUpdate and inquireUpdate interfaces. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 64 characters + * + * @return self + */ + public function setUpdateStatus($updateStatus) + { + $this->container['updateStatus'] = $updateStatus; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/marketplace/AlipaySubmitAttachmentResponse.php b/response/marketplace/AlipaySubmitAttachmentResponse.php new file mode 100644 index 0000000..ae88f3a --- /dev/null +++ b/response/marketplace/AlipaySubmitAttachmentResponse.php @@ -0,0 +1,506 @@ + + */ +class AlipaySubmitAttachmentResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubmitAttachmentResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'submitAttachmentRequestId' => 'string', + 'attachmentType' => '\request\model\AttachmentType', + 'attachmentKey' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'submitAttachmentRequestId' => null, + 'attachmentType' => null, + 'attachmentKey' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'submitAttachmentRequestId' => false, + 'attachmentType' => false, + 'attachmentKey' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'submitAttachmentRequestId' => 'submitAttachmentRequestId', + 'attachmentType' => 'attachmentType', + 'attachmentKey' => 'attachmentKey' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'submitAttachmentRequestId' => 'setSubmitAttachmentRequestId', + 'attachmentType' => 'setAttachmentType', + 'attachmentKey' => 'setAttachmentKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'submitAttachmentRequestId' => 'getSubmitAttachmentRequestId', + 'attachmentType' => 'getAttachmentType', + 'attachmentKey' => 'getAttachmentKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('submitAttachmentRequestId', $data ?? [], null); + $this->setIfExists('attachmentType', $data ?? [], null); + $this->setIfExists('attachmentKey', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets submitAttachmentRequestId + * + * @return string|null + */ + public function getSubmitAttachmentRequestId() + { + return $this->container['submitAttachmentRequestId']; + } + + /** + * Sets submitAttachmentRequestId + * + * @param string|null $submitAttachmentRequestId The unique ID assigned by the marketplace to identify an attachment submission request. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 32 characters + * + * @return self + */ + public function setSubmitAttachmentRequestId($submitAttachmentRequestId) + { + $this->container['submitAttachmentRequestId'] = $submitAttachmentRequestId; + + return $this; + } + + /** + * Gets attachmentType + * + * @return \request\model\AttachmentType|null + */ + public function getAttachmentType() + { + return $this->container['attachmentType']; + } + + /** + * Sets attachmentType + * + * @param \request\model\AttachmentType|null $attachmentType attachmentType + * + * @return self + */ + public function setAttachmentType($attachmentType) + { + $this->container['attachmentType'] = $attachmentType; + + return $this; + } + + /** + * Gets attachmentKey + * + * @return string|null + */ + public function getAttachmentKey() + { + return $this->container['attachmentKey']; + } + + /** + * Sets attachmentKey + * + * @param string|null $attachmentKey The unique key value of the attachment that you submit. The value of this parameter is used by the fileKeys or fileKey parameters in the register API. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 256 characters + * + * @return self + */ + public function setAttachmentKey($attachmentKey) + { + $this->container['attachmentKey'] = $attachmentKey; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayCaptureResponse.php b/response/pay/AlipayCaptureResponse.php new file mode 100644 index 0000000..939c515 --- /dev/null +++ b/response/pay/AlipayCaptureResponse.php @@ -0,0 +1,599 @@ + + */ +class AlipayCaptureResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayCaptureResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'captureRequestId' => 'string', + 'captureId' => 'string', + 'paymentId' => 'string', + 'captureAmount' => '\request\model\Amount', + 'captureTime' => 'string', + 'acquirerReferenceNo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'captureRequestId' => null, + 'captureId' => null, + 'paymentId' => null, + 'captureAmount' => null, + 'captureTime' => null, + 'acquirerReferenceNo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'captureRequestId' => false, + 'captureId' => false, + 'paymentId' => false, + 'captureAmount' => false, + 'captureTime' => false, + 'acquirerReferenceNo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'captureRequestId' => 'captureRequestId', + 'captureId' => 'captureId', + 'paymentId' => 'paymentId', + 'captureAmount' => 'captureAmount', + 'captureTime' => 'captureTime', + 'acquirerReferenceNo' => 'acquirerReferenceNo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'captureRequestId' => 'setCaptureRequestId', + 'captureId' => 'setCaptureId', + 'paymentId' => 'setPaymentId', + 'captureAmount' => 'setCaptureAmount', + 'captureTime' => 'setCaptureTime', + 'acquirerReferenceNo' => 'setAcquirerReferenceNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'captureRequestId' => 'getCaptureRequestId', + 'captureId' => 'getCaptureId', + 'paymentId' => 'getPaymentId', + 'captureAmount' => 'getCaptureAmount', + 'captureTime' => 'getCaptureTime', + 'acquirerReferenceNo' => 'getAcquirerReferenceNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('captureRequestId', $data ?? [], null); + $this->setIfExists('captureId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('captureAmount', $data ?? [], null); + $this->setIfExists('captureTime', $data ?? [], null); + $this->setIfExists('acquirerReferenceNo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets captureRequestId + * + * @return string|null + */ + public function getCaptureRequestId() + { + return $this->container['captureRequestId']; + } + + /** + * Sets captureRequestId + * + * @param string|null $captureRequestId The unique ID that is assigned by a merchant to identify a capture request. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + * + * @return self + */ + public function setCaptureRequestId($captureRequestId) + { + $this->container['captureRequestId'] = $captureRequestId; + + return $this; + } + + /** + * Gets captureId + * + * @return string|null + */ + public function getCaptureId() + { + return $this->container['captureId']; + } + + /** + * Sets captureId + * + * @param string|null $captureId The unique ID that is assigned by Antom to identify a capture. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + * + * @return self + */ + public function setCaptureId($captureId) + { + $this->container['captureId'] = $captureId; + + return $this; + } + + /** + * Gets paymentId + * + * @return string|null + */ + public function getPaymentId() + { + return $this->container['paymentId']; + } + + /** + * Sets paymentId + * + * @param string|null $paymentId The unique ID that is assigned by Antom to identify a payment. Note: This parameter is returned when the capture status is successful. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentId($paymentId) + { + $this->container['paymentId'] = $paymentId; + + return $this; + } + + /** + * Gets captureAmount + * + * @return \request\model\Amount|null + */ + public function getCaptureAmount() + { + return $this->container['captureAmount']; + } + + /** + * Sets captureAmount + * + * @param \request\model\Amount|null $captureAmount captureAmount + * + * @return self + */ + public function setCaptureAmount($captureAmount) + { + $this->container['captureAmount'] = $captureAmount; + + return $this; + } + + /** + * Gets captureTime + * + * @return string|null + */ + public function getCaptureTime() + { + return $this->container['captureTime']; + } + + /** + * Sets captureTime + * + * @param string|null $captureTime The time when Antom captures the payment. Note: This parameter is returned when the capture status is successful. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setCaptureTime($captureTime) + { + $this->container['captureTime'] = $captureTime; + + return $this; + } + + /** + * Gets acquirerReferenceNo + * + * @return string|null + */ + public function getAcquirerReferenceNo() + { + return $this->container['acquirerReferenceNo']; + } + + /** + * Sets acquirerReferenceNo + * + * @param string|null $acquirerReferenceNo The unique ID assigned by the non-Antom acquirer for the transaction. More information: Maximum length: 64 characters + * + * @return self + */ + public function setAcquirerReferenceNo($acquirerReferenceNo) + { + $this->container['acquirerReferenceNo'] = $acquirerReferenceNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayInquiryRefundResponse.php b/response/pay/AlipayInquiryRefundResponse.php new file mode 100644 index 0000000..692c91e --- /dev/null +++ b/response/pay/AlipayInquiryRefundResponse.php @@ -0,0 +1,661 @@ + + */ +class AlipayInquiryRefundResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayInquiryRefundResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'refundId' => 'string', + 'refundRequestId' => 'string', + 'refundAmount' => '\request\model\Amount', + 'refundStatus' => '\request\model\TransactionStatusType', + 'refundTime' => 'string', + 'grossSettlementAmount' => '\request\model\Amount', + 'settlementQuote' => '\request\model\Quote', + 'acquirerInfo' => '\request\model\AcquirerInfo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'refundId' => null, + 'refundRequestId' => null, + 'refundAmount' => null, + 'refundStatus' => null, + 'refundTime' => null, + 'grossSettlementAmount' => null, + 'settlementQuote' => null, + 'acquirerInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'refundId' => false, + 'refundRequestId' => false, + 'refundAmount' => false, + 'refundStatus' => false, + 'refundTime' => false, + 'grossSettlementAmount' => false, + 'settlementQuote' => false, + 'acquirerInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'refundId' => 'refundId', + 'refundRequestId' => 'refundRequestId', + 'refundAmount' => 'refundAmount', + 'refundStatus' => 'refundStatus', + 'refundTime' => 'refundTime', + 'grossSettlementAmount' => 'grossSettlementAmount', + 'settlementQuote' => 'settlementQuote', + 'acquirerInfo' => 'acquirerInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'refundId' => 'setRefundId', + 'refundRequestId' => 'setRefundRequestId', + 'refundAmount' => 'setRefundAmount', + 'refundStatus' => 'setRefundStatus', + 'refundTime' => 'setRefundTime', + 'grossSettlementAmount' => 'setGrossSettlementAmount', + 'settlementQuote' => 'setSettlementQuote', + 'acquirerInfo' => 'setAcquirerInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'refundId' => 'getRefundId', + 'refundRequestId' => 'getRefundRequestId', + 'refundAmount' => 'getRefundAmount', + 'refundStatus' => 'getRefundStatus', + 'refundTime' => 'getRefundTime', + 'grossSettlementAmount' => 'getGrossSettlementAmount', + 'settlementQuote' => 'getSettlementQuote', + 'acquirerInfo' => 'getAcquirerInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('refundId', $data ?? [], null); + $this->setIfExists('refundRequestId', $data ?? [], null); + $this->setIfExists('refundAmount', $data ?? [], null); + $this->setIfExists('refundStatus', $data ?? [], null); + $this->setIfExists('refundTime', $data ?? [], null); + $this->setIfExists('grossSettlementAmount', $data ?? [], null); + $this->setIfExists('settlementQuote', $data ?? [], null); + $this->setIfExists('acquirerInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets refundId + * + * @return string|null + */ + public function getRefundId() + { + return $this->container['refundId']; + } + + /** + * Sets refundId + * + * @param string|null $refundId The unique ID assigned by Antom to identify a refund. A one-to-one correspondence between refundId and refundRequestId exists. Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U. + * + * @return self + */ + public function setRefundId($refundId) + { + $this->container['refundId'] = $refundId; + + return $this; + } + + /** + * Gets refundRequestId + * + * @return string|null + */ + public function getRefundRequestId() + { + return $this->container['refundRequestId']; + } + + /** + * Sets refundRequestId + * + * @param string|null $refundRequestId The unique ID assigned by the merchant to identify a refund request. Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U. More information: Maximum length: 64 characters + * + * @return self + */ + public function setRefundRequestId($refundRequestId) + { + $this->container['refundRequestId'] = $refundRequestId; + + return $this; + } + + /** + * Gets refundAmount + * + * @return \request\model\Amount|null + */ + public function getRefundAmount() + { + return $this->container['refundAmount']; + } + + /** + * Sets refundAmount + * + * @param \request\model\Amount|null $refundAmount refundAmount + * + * @return self + */ + public function setRefundAmount($refundAmount) + { + $this->container['refundAmount'] = $refundAmount; + + return $this; + } + + /** + * Gets refundStatus + * + * @return \request\model\TransactionStatusType|null + */ + public function getRefundStatus() + { + return $this->container['refundStatus']; + } + + /** + * Sets refundStatus + * + * @param \request\model\TransactionStatusType|null $refundStatus refundStatus + * + * @return self + */ + public function setRefundStatus($refundStatus) + { + $this->container['refundStatus'] = $refundStatus; + + return $this; + } + + /** + * Gets refundTime + * + * @return string|null + */ + public function getRefundTime() + { + return $this->container['refundTime']; + } + + /** + * Sets refundTime + * + * @param string|null $refundTime The date and time when the refund reaches a final state of success on the Antom side, not the Alipay+ Mobile Payment Provider (Alipay+ payment methods) side. Note: This field is returned when the value of refundStatus is SUCCESS. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setRefundTime($refundTime) + { + $this->container['refundTime'] = $refundTime; + + return $this; + } + + /** + * Gets grossSettlementAmount + * + * @return \request\model\Amount|null + */ + public function getGrossSettlementAmount() + { + return $this->container['grossSettlementAmount']; + } + + /** + * Sets grossSettlementAmount + * + * @param \request\model\Amount|null $grossSettlementAmount grossSettlementAmount + * + * @return self + */ + public function setGrossSettlementAmount($grossSettlementAmount) + { + $this->container['grossSettlementAmount'] = $grossSettlementAmount; + + return $this; + } + + /** + * Gets settlementQuote + * + * @return \request\model\Quote|null + */ + public function getSettlementQuote() + { + return $this->container['settlementQuote']; + } + + /** + * Sets settlementQuote + * + * @param \request\model\Quote|null $settlementQuote settlementQuote + * + * @return self + */ + public function setSettlementQuote($settlementQuote) + { + $this->container['settlementQuote'] = $settlementQuote; + + return $this; + } + + /** + * Gets acquirerInfo + * + * @return \request\model\AcquirerInfo|null + */ + public function getAcquirerInfo() + { + return $this->container['acquirerInfo']; + } + + /** + * Sets acquirerInfo + * + * @param \request\model\AcquirerInfo|null $acquirerInfo acquirerInfo + * + * @return self + */ + public function setAcquirerInfo($acquirerInfo) + { + $this->container['acquirerInfo'] = $acquirerInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayPayCancelResponse.php b/response/pay/AlipayPayCancelResponse.php new file mode 100644 index 0000000..40437b9 --- /dev/null +++ b/response/pay/AlipayPayCancelResponse.php @@ -0,0 +1,506 @@ + + */ +class AlipayPayCancelResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayCancelResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'paymentId' => 'string', + 'paymentRequestId' => 'string', + 'cancelTime' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'paymentId' => null, + 'paymentRequestId' => null, + 'cancelTime' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'paymentId' => false, + 'paymentRequestId' => false, + 'cancelTime' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'paymentId' => 'paymentId', + 'paymentRequestId' => 'paymentRequestId', + 'cancelTime' => 'cancelTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'paymentId' => 'setPaymentId', + 'paymentRequestId' => 'setPaymentRequestId', + 'cancelTime' => 'setCancelTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'paymentId' => 'getPaymentId', + 'paymentRequestId' => 'getPaymentRequestId', + 'cancelTime' => 'getCancelTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('paymentRequestId', $data ?? [], null); + $this->setIfExists('cancelTime', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets paymentId + * + * @return string|null + */ + public function getPaymentId() + { + return $this->container['paymentId']; + } + + /** + * Sets paymentId + * + * @param string|null $paymentId The unique ID that is assigned by Antom to identify a payment. Note: This field is returned when the cancellation succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentId($paymentId) + { + $this->container['paymentId'] = $paymentId; + + return $this; + } + + /** + * Gets paymentRequestId + * + * @return string|null + */ + public function getPaymentRequestId() + { + return $this->container['paymentRequestId']; + } + + /** + * Sets paymentRequestId + * + * @param string|null $paymentRequestId The unique ID that is assigned by a merchant to identify a payment request. Note: This field is returned when the cancellation succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentRequestId($paymentRequestId) + { + $this->container['paymentRequestId'] = $paymentRequestId; + + return $this; + } + + /** + * Gets cancelTime + * + * @return string|null + */ + public function getCancelTime() + { + return $this->container['cancelTime']; + } + + /** + * Sets cancelTime + * + * @param string|null $cancelTime The actual execution completion time of the payment cancellation process, which is the date and time when the payment cancellation succeeds. Note: This field is returned when the cancellation succeeds (the value of result.resultStatus is S). More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setCancelTime($cancelTime) + { + $this->container['cancelTime'] = $cancelTime; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayPayConsultResponse.php b/response/pay/AlipayPayConsultResponse.php new file mode 100644 index 0000000..b06a3e2 --- /dev/null +++ b/response/pay/AlipayPayConsultResponse.php @@ -0,0 +1,506 @@ + + */ +class AlipayPayConsultResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayConsultResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'paymentOptions' => '\request\model\PaymentOption[]', + 'paymentMethodInfos' => '\request\model\PaymentMethodInfo[]', + 'extendInfo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'paymentOptions' => null, + 'paymentMethodInfos' => null, + 'extendInfo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'paymentOptions' => false, + 'paymentMethodInfos' => false, + 'extendInfo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'paymentOptions' => 'paymentOptions', + 'paymentMethodInfos' => 'paymentMethodInfos', + 'extendInfo' => 'extendInfo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'paymentOptions' => 'setPaymentOptions', + 'paymentMethodInfos' => 'setPaymentMethodInfos', + 'extendInfo' => 'setExtendInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'paymentOptions' => 'getPaymentOptions', + 'paymentMethodInfos' => 'getPaymentMethodInfos', + 'extendInfo' => 'getExtendInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('paymentOptions', $data ?? [], null); + $this->setIfExists('paymentMethodInfos', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets paymentOptions + * + * @return \request\model\PaymentOption[]|null + */ + public function getPaymentOptions() + { + return $this->container['paymentOptions']; + } + + /** + * Sets paymentOptions + * + * @param \request\model\PaymentOption[]|null $paymentOptions The payment option list. + * + * @return self + */ + public function setPaymentOptions($paymentOptions) + { + $this->container['paymentOptions'] = $paymentOptions; + + return $this; + } + + /** + * Gets paymentMethodInfos + * + * @return \request\model\PaymentMethodInfo[]|null + */ + public function getPaymentMethodInfos() + { + return $this->container['paymentMethodInfos']; + } + + /** + * Sets paymentMethodInfos + * + * @param \request\model\PaymentMethodInfo[]|null $paymentMethodInfos paymentMethodInfos + * + * @return self + */ + public function setPaymentMethodInfos($paymentMethodInfos) + { + $this->container['paymentMethodInfos'] = $paymentMethodInfos; + + return $this; + } + + /** + * Gets extendInfo + * + * @return string|null + */ + public function getExtendInfo() + { + return $this->container['extendInfo']; + } + + /** + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self + */ + public function setExtendInfo($extendInfo) + { + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayPayQueryResponse.php b/response/pay/AlipayPayQueryResponse.php new file mode 100644 index 0000000..4cada95 --- /dev/null +++ b/response/pay/AlipayPayQueryResponse.php @@ -0,0 +1,1281 @@ + + */ +class AlipayPayQueryResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayQueryResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'paymentStatus' => '\request\model\TransactionStatusType', + 'paymentResultCode' => 'string', + 'paymentResultMessage' => 'string', + 'paymentRequestId' => 'string', + 'paymentId' => 'string', + 'authPaymentId' => 'string', + 'paymentAmount' => '\request\model\Amount', + 'actualPaymentAmount' => '\request\model\Amount', + 'paymentQuote' => '\request\model\Quote', + 'authExpiryTime' => 'string', + 'paymentCreateTime' => 'string', + 'paymentTime' => 'string', + 'nonGuaranteeCouponAmount' => '\request\model\Amount', + 'pspCustomerInfo' => '\request\model\PspCustomerInfo', + 'redirectActionForm' => '\request\model\RedirectActionForm', + 'cardInfo' => '\request\model\CardInfo', + 'acquirerReferenceNo' => 'string', + 'extendInfo' => 'string', + 'transactions' => '\request\model\Transaction[]', + 'customsDeclarationAmount' => '\request\model\Amount', + 'grossSettlementAmount' => '\request\model\Amount', + 'settlementQuote' => '\request\model\Quote', + 'paymentResultInfo' => '\request\model\PaymentResultInfo', + 'acquirerInfo' => '\request\model\AcquirerInfo', + 'merchantAccountId' => 'string', + 'promotionResults' => '\request\model\PromotionResult[]', + 'earliestSettlementTime' => 'string', + 'paymentMethodType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'paymentStatus' => null, + 'paymentResultCode' => null, + 'paymentResultMessage' => null, + 'paymentRequestId' => null, + 'paymentId' => null, + 'authPaymentId' => null, + 'paymentAmount' => null, + 'actualPaymentAmount' => null, + 'paymentQuote' => null, + 'authExpiryTime' => null, + 'paymentCreateTime' => null, + 'paymentTime' => null, + 'nonGuaranteeCouponAmount' => null, + 'pspCustomerInfo' => null, + 'redirectActionForm' => null, + 'cardInfo' => null, + 'acquirerReferenceNo' => null, + 'extendInfo' => null, + 'transactions' => null, + 'customsDeclarationAmount' => null, + 'grossSettlementAmount' => null, + 'settlementQuote' => null, + 'paymentResultInfo' => null, + 'acquirerInfo' => null, + 'merchantAccountId' => null, + 'promotionResults' => null, + 'earliestSettlementTime' => null, + 'paymentMethodType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'paymentStatus' => false, + 'paymentResultCode' => false, + 'paymentResultMessage' => false, + 'paymentRequestId' => false, + 'paymentId' => false, + 'authPaymentId' => false, + 'paymentAmount' => false, + 'actualPaymentAmount' => false, + 'paymentQuote' => false, + 'authExpiryTime' => false, + 'paymentCreateTime' => false, + 'paymentTime' => false, + 'nonGuaranteeCouponAmount' => false, + 'pspCustomerInfo' => false, + 'redirectActionForm' => false, + 'cardInfo' => false, + 'acquirerReferenceNo' => false, + 'extendInfo' => false, + 'transactions' => false, + 'customsDeclarationAmount' => false, + 'grossSettlementAmount' => false, + 'settlementQuote' => false, + 'paymentResultInfo' => false, + 'acquirerInfo' => false, + 'merchantAccountId' => false, + 'promotionResults' => false, + 'earliestSettlementTime' => false, + 'paymentMethodType' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'paymentStatus' => 'paymentStatus', + 'paymentResultCode' => 'paymentResultCode', + 'paymentResultMessage' => 'paymentResultMessage', + 'paymentRequestId' => 'paymentRequestId', + 'paymentId' => 'paymentId', + 'authPaymentId' => 'authPaymentId', + 'paymentAmount' => 'paymentAmount', + 'actualPaymentAmount' => 'actualPaymentAmount', + 'paymentQuote' => 'paymentQuote', + 'authExpiryTime' => 'authExpiryTime', + 'paymentCreateTime' => 'paymentCreateTime', + 'paymentTime' => 'paymentTime', + 'nonGuaranteeCouponAmount' => 'nonGuaranteeCouponAmount', + 'pspCustomerInfo' => 'pspCustomerInfo', + 'redirectActionForm' => 'redirectActionForm', + 'cardInfo' => 'cardInfo', + 'acquirerReferenceNo' => 'acquirerReferenceNo', + 'extendInfo' => 'extendInfo', + 'transactions' => 'transactions', + 'customsDeclarationAmount' => 'customsDeclarationAmount', + 'grossSettlementAmount' => 'grossSettlementAmount', + 'settlementQuote' => 'settlementQuote', + 'paymentResultInfo' => 'paymentResultInfo', + 'acquirerInfo' => 'acquirerInfo', + 'merchantAccountId' => 'merchantAccountId', + 'promotionResults' => 'promotionResults', + 'earliestSettlementTime' => 'earliestSettlementTime', + 'paymentMethodType' => 'paymentMethodType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'paymentStatus' => 'setPaymentStatus', + 'paymentResultCode' => 'setPaymentResultCode', + 'paymentResultMessage' => 'setPaymentResultMessage', + 'paymentRequestId' => 'setPaymentRequestId', + 'paymentId' => 'setPaymentId', + 'authPaymentId' => 'setAuthPaymentId', + 'paymentAmount' => 'setPaymentAmount', + 'actualPaymentAmount' => 'setActualPaymentAmount', + 'paymentQuote' => 'setPaymentQuote', + 'authExpiryTime' => 'setAuthExpiryTime', + 'paymentCreateTime' => 'setPaymentCreateTime', + 'paymentTime' => 'setPaymentTime', + 'nonGuaranteeCouponAmount' => 'setNonGuaranteeCouponAmount', + 'pspCustomerInfo' => 'setPspCustomerInfo', + 'redirectActionForm' => 'setRedirectActionForm', + 'cardInfo' => 'setCardInfo', + 'acquirerReferenceNo' => 'setAcquirerReferenceNo', + 'extendInfo' => 'setExtendInfo', + 'transactions' => 'setTransactions', + 'customsDeclarationAmount' => 'setCustomsDeclarationAmount', + 'grossSettlementAmount' => 'setGrossSettlementAmount', + 'settlementQuote' => 'setSettlementQuote', + 'paymentResultInfo' => 'setPaymentResultInfo', + 'acquirerInfo' => 'setAcquirerInfo', + 'merchantAccountId' => 'setMerchantAccountId', + 'promotionResults' => 'setPromotionResults', + 'earliestSettlementTime' => 'setEarliestSettlementTime', + 'paymentMethodType' => 'setPaymentMethodType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'paymentStatus' => 'getPaymentStatus', + 'paymentResultCode' => 'getPaymentResultCode', + 'paymentResultMessage' => 'getPaymentResultMessage', + 'paymentRequestId' => 'getPaymentRequestId', + 'paymentId' => 'getPaymentId', + 'authPaymentId' => 'getAuthPaymentId', + 'paymentAmount' => 'getPaymentAmount', + 'actualPaymentAmount' => 'getActualPaymentAmount', + 'paymentQuote' => 'getPaymentQuote', + 'authExpiryTime' => 'getAuthExpiryTime', + 'paymentCreateTime' => 'getPaymentCreateTime', + 'paymentTime' => 'getPaymentTime', + 'nonGuaranteeCouponAmount' => 'getNonGuaranteeCouponAmount', + 'pspCustomerInfo' => 'getPspCustomerInfo', + 'redirectActionForm' => 'getRedirectActionForm', + 'cardInfo' => 'getCardInfo', + 'acquirerReferenceNo' => 'getAcquirerReferenceNo', + 'extendInfo' => 'getExtendInfo', + 'transactions' => 'getTransactions', + 'customsDeclarationAmount' => 'getCustomsDeclarationAmount', + 'grossSettlementAmount' => 'getGrossSettlementAmount', + 'settlementQuote' => 'getSettlementQuote', + 'paymentResultInfo' => 'getPaymentResultInfo', + 'acquirerInfo' => 'getAcquirerInfo', + 'merchantAccountId' => 'getMerchantAccountId', + 'promotionResults' => 'getPromotionResults', + 'earliestSettlementTime' => 'getEarliestSettlementTime', + 'paymentMethodType' => 'getPaymentMethodType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('paymentStatus', $data ?? [], null); + $this->setIfExists('paymentResultCode', $data ?? [], null); + $this->setIfExists('paymentResultMessage', $data ?? [], null); + $this->setIfExists('paymentRequestId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('authPaymentId', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('actualPaymentAmount', $data ?? [], null); + $this->setIfExists('paymentQuote', $data ?? [], null); + $this->setIfExists('authExpiryTime', $data ?? [], null); + $this->setIfExists('paymentCreateTime', $data ?? [], null); + $this->setIfExists('paymentTime', $data ?? [], null); + $this->setIfExists('nonGuaranteeCouponAmount', $data ?? [], null); + $this->setIfExists('pspCustomerInfo', $data ?? [], null); + $this->setIfExists('redirectActionForm', $data ?? [], null); + $this->setIfExists('cardInfo', $data ?? [], null); + $this->setIfExists('acquirerReferenceNo', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('transactions', $data ?? [], null); + $this->setIfExists('customsDeclarationAmount', $data ?? [], null); + $this->setIfExists('grossSettlementAmount', $data ?? [], null); + $this->setIfExists('settlementQuote', $data ?? [], null); + $this->setIfExists('paymentResultInfo', $data ?? [], null); + $this->setIfExists('acquirerInfo', $data ?? [], null); + $this->setIfExists('merchantAccountId', $data ?? [], null); + $this->setIfExists('promotionResults', $data ?? [], null); + $this->setIfExists('earliestSettlementTime', $data ?? [], null); + $this->setIfExists('paymentMethodType', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets paymentStatus + * + * @return \request\model\TransactionStatusType|null + */ + public function getPaymentStatus() + { + return $this->container['paymentStatus']; + } + + /** + * Sets paymentStatus + * + * @param \request\model\TransactionStatusType|null $paymentStatus paymentStatus + * + * @return self + */ + public function setPaymentStatus($paymentStatus) + { + $this->container['paymentStatus'] = $paymentStatus; + + return $this; + } + + /** + * Gets paymentResultCode + * + * @return string|null + */ + public function getPaymentResultCode() + { + return $this->container['paymentResultCode']; + } + + /** + * Sets paymentResultCode + * + * @param string|null $paymentResultCode The result code for different payment statuses. Possible payment result codes are listed in the Payment result codes table on this page. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentResultCode($paymentResultCode) + { + $this->container['paymentResultCode'] = $paymentResultCode; + + return $this; + } + + /** + * Gets paymentResultMessage + * + * @return string|null + */ + public function getPaymentResultMessage() + { + return $this->container['paymentResultMessage']; + } + + /** + * Sets paymentResultMessage + * + * @param string|null $paymentResultMessage The result message that explains the payment result code. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 256 characters + * + * @return self + */ + public function setPaymentResultMessage($paymentResultMessage) + { + $this->container['paymentResultMessage'] = $paymentResultMessage; + + return $this; + } + + /** + * Gets paymentRequestId + * + * @return string|null + */ + public function getPaymentRequestId() + { + return $this->container['paymentRequestId']; + } + + /** + * Sets paymentRequestId + * + * @param string|null $paymentRequestId The unique ID that is assigned by a merchant to identify a payment request. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentRequestId($paymentRequestId) + { + $this->container['paymentRequestId'] = $paymentRequestId; + + return $this; + } + + /** + * Gets paymentId + * + * @return string|null + */ + public function getPaymentId() + { + return $this->container['paymentId']; + } + + /** + * Sets paymentId + * + * @param string|null $paymentId The unique ID that is assigned by Antom to identify a payment. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentId($paymentId) + { + $this->container['paymentId'] = $paymentId; + + return $this; + } + + /** + * Gets authPaymentId + * + * @return string|null + */ + public function getAuthPaymentId() + { + return $this->container['authPaymentId']; + } + + /** + * Sets authPaymentId + * + * @param string|null $authPaymentId authPaymentId + * + * @return self + */ + public function setAuthPaymentId($authPaymentId) + { + $this->container['authPaymentId'] = $authPaymentId; + + return $this; + } + + /** + * Gets paymentAmount + * + * @return \request\model\Amount|null + */ + public function getPaymentAmount() + { + return $this->container['paymentAmount']; + } + + /** + * Sets paymentAmount + * + * @param \request\model\Amount|null $paymentAmount paymentAmount + * + * @return self + */ + public function setPaymentAmount($paymentAmount) + { + $this->container['paymentAmount'] = $paymentAmount; + + return $this; + } + + /** + * Gets actualPaymentAmount + * + * @return \request\model\Amount|null + */ + public function getActualPaymentAmount() + { + return $this->container['actualPaymentAmount']; + } + + /** + * Sets actualPaymentAmount + * + * @param \request\model\Amount|null $actualPaymentAmount actualPaymentAmount + * + * @return self + */ + public function setActualPaymentAmount($actualPaymentAmount) + { + $this->container['actualPaymentAmount'] = $actualPaymentAmount; + + return $this; + } + + /** + * Gets paymentQuote + * + * @return \request\model\Quote|null + */ + public function getPaymentQuote() + { + return $this->container['paymentQuote']; + } + + /** + * Sets paymentQuote + * + * @param \request\model\Quote|null $paymentQuote paymentQuote + * + * @return self + */ + public function setPaymentQuote($paymentQuote) + { + $this->container['paymentQuote'] = $paymentQuote; + + return $this; + } + + /** + * Gets authExpiryTime + * + * @return string|null + */ + public function getAuthExpiryTime() + { + return $this->container['authExpiryTime']; + } + + /** + * Sets authExpiryTime + * + * @param string|null $authExpiryTime The expiration date and time of the authorization payment. You cannot capture the payment after this time. This parameter is returned when the value of paymentMethodType in the pay (Checkout Payment) API is CARD. More information about this field: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setAuthExpiryTime($authExpiryTime) + { + $this->container['authExpiryTime'] = $authExpiryTime; + + return $this; + } + + /** + * Gets paymentCreateTime + * + * @return string|null + */ + public function getPaymentCreateTime() + { + return $this->container['paymentCreateTime']; + } + + /** + * Sets paymentCreateTime + * + * @param string|null $paymentCreateTime The date and time when the payment is created. Note: This field is returned when the API is called successfully (the value of result.resultStatus is S). More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setPaymentCreateTime($paymentCreateTime) + { + $this->container['paymentCreateTime'] = $paymentCreateTime; + + return $this; + } + + /** + * Gets paymentTime + * + * @return string|null + */ + public function getPaymentTime() + { + return $this->container['paymentTime']; + } + + /** + * Sets paymentTime + * + * @param string|null $paymentTime The date and time when the payment reaches a final state of success. Note: This field is returned only when the payment reaches a final state of success (the value of paymentStatus is SUCCESS). More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setPaymentTime($paymentTime) + { + $this->container['paymentTime'] = $paymentTime; + + return $this; + } + + /** + * Gets nonGuaranteeCouponAmount + * + * @return \request\model\Amount|null + */ + public function getNonGuaranteeCouponAmount() + { + return $this->container['nonGuaranteeCouponAmount']; + } + + /** + * Sets nonGuaranteeCouponAmount + * + * @param \request\model\Amount|null $nonGuaranteeCouponAmount nonGuaranteeCouponAmount + * + * @return self + */ + public function setNonGuaranteeCouponAmount($nonGuaranteeCouponAmount) + { + $this->container['nonGuaranteeCouponAmount'] = $nonGuaranteeCouponAmount; + + return $this; + } + + /** + * Gets pspCustomerInfo + * + * @return \request\model\PspCustomerInfo|null + */ + public function getPspCustomerInfo() + { + return $this->container['pspCustomerInfo']; + } + + /** + * Sets pspCustomerInfo + * + * @param \request\model\PspCustomerInfo|null $pspCustomerInfo pspCustomerInfo + * + * @return self + */ + public function setPspCustomerInfo($pspCustomerInfo) + { + $this->container['pspCustomerInfo'] = $pspCustomerInfo; + + return $this; + } + + /** + * Gets redirectActionForm + * + * @return \request\model\RedirectActionForm|null + */ + public function getRedirectActionForm() + { + return $this->container['redirectActionForm']; + } + + /** + * Sets redirectActionForm + * + * @param \request\model\RedirectActionForm|null $redirectActionForm redirectActionForm + * + * @return self + */ + public function setRedirectActionForm($redirectActionForm) + { + $this->container['redirectActionForm'] = $redirectActionForm; + + return $this; + } + + /** + * Gets cardInfo + * + * @return \request\model\CardInfo|null + */ + public function getCardInfo() + { + return $this->container['cardInfo']; + } + + /** + * Sets cardInfo + * + * @param \request\model\CardInfo|null $cardInfo cardInfo + * + * @return self + */ + public function setCardInfo($cardInfo) + { + $this->container['cardInfo'] = $cardInfo; + + return $this; + } + + /** + * Gets acquirerReferenceNo + * + * @return string|null + */ + public function getAcquirerReferenceNo() + { + return $this->container['acquirerReferenceNo']; + } + + /** + * Sets acquirerReferenceNo + * + * @param string|null $acquirerReferenceNo The unique ID assigned by the non-Antom acquirer for the transaction. More information: Maximum length: 64 characters + * + * @return self + */ + public function setAcquirerReferenceNo($acquirerReferenceNo) + { + $this->container['acquirerReferenceNo'] = $acquirerReferenceNo; + + return $this; + } + + /** + * Gets extendInfo + * + * @return string|null + */ + public function getExtendInfo() + { + return $this->container['extendInfo']; + } + + /** + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self + */ + public function setExtendInfo($extendInfo) + { + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets transactions + * + * @return \request\model\Transaction[]|null + */ + public function getTransactions() + { + return $this->container['transactions']; + } + + /** + * Sets transactions + * + * @param \request\model\Transaction[]|null $transactions Information about the subsequent action against a transaction. Note: This parameter is returned when a refund or a capture against the transaction exists. + * + * @return self + */ + public function setTransactions($transactions) + { + $this->container['transactions'] = $transactions; + + return $this; + } + + /** + * Gets customsDeclarationAmount + * + * @return \request\model\Amount|null + */ + public function getCustomsDeclarationAmount() + { + return $this->container['customsDeclarationAmount']; + } + + /** + * Sets customsDeclarationAmount + * + * @param \request\model\Amount|null $customsDeclarationAmount customsDeclarationAmount + * + * @return self + */ + public function setCustomsDeclarationAmount($customsDeclarationAmount) + { + $this->container['customsDeclarationAmount'] = $customsDeclarationAmount; + + return $this; + } + + /** + * Gets grossSettlementAmount + * + * @return \request\model\Amount|null + */ + public function getGrossSettlementAmount() + { + return $this->container['grossSettlementAmount']; + } + + /** + * Sets grossSettlementAmount + * + * @param \request\model\Amount|null $grossSettlementAmount grossSettlementAmount + * + * @return self + */ + public function setGrossSettlementAmount($grossSettlementAmount) + { + $this->container['grossSettlementAmount'] = $grossSettlementAmount; + + return $this; + } + + /** + * Gets settlementQuote + * + * @return \request\model\Quote|null + */ + public function getSettlementQuote() + { + return $this->container['settlementQuote']; + } + + /** + * Sets settlementQuote + * + * @param \request\model\Quote|null $settlementQuote settlementQuote + * + * @return self + */ + public function setSettlementQuote($settlementQuote) + { + $this->container['settlementQuote'] = $settlementQuote; + + return $this; + } + + /** + * Gets paymentResultInfo + * + * @return \request\model\PaymentResultInfo|null + */ + public function getPaymentResultInfo() + { + return $this->container['paymentResultInfo']; + } + + /** + * Sets paymentResultInfo + * + * @param \request\model\PaymentResultInfo|null $paymentResultInfo paymentResultInfo + * + * @return self + */ + public function setPaymentResultInfo($paymentResultInfo) + { + $this->container['paymentResultInfo'] = $paymentResultInfo; + + return $this; + } + + /** + * Gets acquirerInfo + * + * @return \request\model\AcquirerInfo|null + */ + public function getAcquirerInfo() + { + return $this->container['acquirerInfo']; + } + + /** + * Sets acquirerInfo + * + * @param \request\model\AcquirerInfo|null $acquirerInfo acquirerInfo + * + * @return self + */ + public function setAcquirerInfo($acquirerInfo) + { + $this->container['acquirerInfo'] = $acquirerInfo; + + return $this; + } + + /** + * Gets merchantAccountId + * + * @return string|null + */ + public function getMerchantAccountId() + { + return $this->container['merchantAccountId']; + } + + /** + * Sets merchantAccountId + * + * @param string|null $merchantAccountId merchantAccountId + * + * @return self + */ + public function setMerchantAccountId($merchantAccountId) + { + $this->container['merchantAccountId'] = $merchantAccountId; + + return $this; + } + + /** + * Gets promotionResults + * + * @return \request\model\PromotionResult[]|null + */ + public function getPromotionResults() + { + return $this->container['promotionResults']; + } + + /** + * Sets promotionResults + * + * @param \request\model\PromotionResult[]|null $promotionResults Promotion result. Note: This parameter is returned when the buyer applied a promotion while placing an order. + * + * @return self + */ + public function setPromotionResults($promotionResults) + { + $this->container['promotionResults'] = $promotionResults; + + return $this; + } + + /** + * Gets earliestSettlementTime + * + * @return string|null + */ + public function getEarliestSettlementTime() + { + return $this->container['earliestSettlementTime']; + } + + /** + * Sets earliestSettlementTime + * + * @param string|null $earliestSettlementTime earliestSettlementTime + * + * @return self + */ + public function setEarliestSettlementTime($earliestSettlementTime) + { + $this->container['earliestSettlementTime'] = $earliestSettlementTime; + + return $this; + } + + /** + * Gets paymentMethodType + * + * @return string|null + */ + public function getPaymentMethodType() + { + return $this->container['paymentMethodType']; + } + + /** + * Sets paymentMethodType + * + * @param string|null $paymentMethodType The payment method type that is included in payment method options. See Payment methods to check the valid values. Note: This field will be returned when selecting the Antom Chechkout Page integration. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentMethodType($paymentMethodType) + { + $this->container['paymentMethodType'] = $paymentMethodType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayPayResponse.php b/response/pay/AlipayPayResponse.php new file mode 100644 index 0000000..c89660b --- /dev/null +++ b/response/pay/AlipayPayResponse.php @@ -0,0 +1,1188 @@ + + */ +class AlipayPayResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPayResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'paymentRequestId' => 'string', + 'paymentId' => 'string', + 'paymentAmount' => '\request\model\Amount', + 'paymentData' => 'string', + 'actualPaymentAmount' => '\request\model\Amount', + 'paymentQuote' => '\request\model\Quote', + 'paymentTime' => 'string', + 'paymentCreateTime' => 'string', + 'authExpiryTime' => 'string', + 'nonGuaranteeCouponValue' => '\request\model\Amount', + 'paymentActionForm' => 'string', + 'pspCustomerInfo' => '\request\model\PspCustomerInfo', + 'challengeActionForm' => '\request\model\ChallengeActionForm', + 'redirectActionForm' => '\request\model\RedirectActionForm', + 'orderCodeForm' => '\request\model\OrderCodeForm', + 'grossSettlementAmount' => '\request\model\Amount', + 'settlementQuote' => '\request\model\Quote', + 'extendInfo' => 'string', + 'normalUrl' => 'string', + 'schemeUrl' => 'string', + 'applinkUrl' => 'string', + 'appIdentifier' => 'string', + 'paymentResultInfo' => '\request\model\PaymentResultInfo', + 'acquirerInfo' => '\request\model\AcquirerInfo', + 'promotionResult' => '\request\model\PromotionResult[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'paymentRequestId' => null, + 'paymentId' => null, + 'paymentAmount' => null, + 'paymentData' => null, + 'actualPaymentAmount' => null, + 'paymentQuote' => null, + 'paymentTime' => null, + 'paymentCreateTime' => null, + 'authExpiryTime' => null, + 'nonGuaranteeCouponValue' => null, + 'paymentActionForm' => null, + 'pspCustomerInfo' => null, + 'challengeActionForm' => null, + 'redirectActionForm' => null, + 'orderCodeForm' => null, + 'grossSettlementAmount' => null, + 'settlementQuote' => null, + 'extendInfo' => null, + 'normalUrl' => null, + 'schemeUrl' => null, + 'applinkUrl' => null, + 'appIdentifier' => null, + 'paymentResultInfo' => null, + 'acquirerInfo' => null, + 'promotionResult' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'paymentRequestId' => false, + 'paymentId' => false, + 'paymentAmount' => false, + 'paymentData' => false, + 'actualPaymentAmount' => false, + 'paymentQuote' => false, + 'paymentTime' => false, + 'paymentCreateTime' => false, + 'authExpiryTime' => false, + 'nonGuaranteeCouponValue' => false, + 'paymentActionForm' => false, + 'pspCustomerInfo' => false, + 'challengeActionForm' => false, + 'redirectActionForm' => false, + 'orderCodeForm' => false, + 'grossSettlementAmount' => false, + 'settlementQuote' => false, + 'extendInfo' => false, + 'normalUrl' => false, + 'schemeUrl' => false, + 'applinkUrl' => false, + 'appIdentifier' => false, + 'paymentResultInfo' => false, + 'acquirerInfo' => false, + 'promotionResult' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'paymentRequestId' => 'paymentRequestId', + 'paymentId' => 'paymentId', + 'paymentAmount' => 'paymentAmount', + 'paymentData' => 'paymentData', + 'actualPaymentAmount' => 'actualPaymentAmount', + 'paymentQuote' => 'paymentQuote', + 'paymentTime' => 'paymentTime', + 'paymentCreateTime' => 'paymentCreateTime', + 'authExpiryTime' => 'authExpiryTime', + 'nonGuaranteeCouponValue' => 'nonGuaranteeCouponValue', + 'paymentActionForm' => 'paymentActionForm', + 'pspCustomerInfo' => 'pspCustomerInfo', + 'challengeActionForm' => 'challengeActionForm', + 'redirectActionForm' => 'redirectActionForm', + 'orderCodeForm' => 'orderCodeForm', + 'grossSettlementAmount' => 'grossSettlementAmount', + 'settlementQuote' => 'settlementQuote', + 'extendInfo' => 'extendInfo', + 'normalUrl' => 'normalUrl', + 'schemeUrl' => 'schemeUrl', + 'applinkUrl' => 'applinkUrl', + 'appIdentifier' => 'appIdentifier', + 'paymentResultInfo' => 'paymentResultInfo', + 'acquirerInfo' => 'acquirerInfo', + 'promotionResult' => 'promotionResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'paymentRequestId' => 'setPaymentRequestId', + 'paymentId' => 'setPaymentId', + 'paymentAmount' => 'setPaymentAmount', + 'paymentData' => 'setPaymentData', + 'actualPaymentAmount' => 'setActualPaymentAmount', + 'paymentQuote' => 'setPaymentQuote', + 'paymentTime' => 'setPaymentTime', + 'paymentCreateTime' => 'setPaymentCreateTime', + 'authExpiryTime' => 'setAuthExpiryTime', + 'nonGuaranteeCouponValue' => 'setNonGuaranteeCouponValue', + 'paymentActionForm' => 'setPaymentActionForm', + 'pspCustomerInfo' => 'setPspCustomerInfo', + 'challengeActionForm' => 'setChallengeActionForm', + 'redirectActionForm' => 'setRedirectActionForm', + 'orderCodeForm' => 'setOrderCodeForm', + 'grossSettlementAmount' => 'setGrossSettlementAmount', + 'settlementQuote' => 'setSettlementQuote', + 'extendInfo' => 'setExtendInfo', + 'normalUrl' => 'setNormalUrl', + 'schemeUrl' => 'setSchemeUrl', + 'applinkUrl' => 'setApplinkUrl', + 'appIdentifier' => 'setAppIdentifier', + 'paymentResultInfo' => 'setPaymentResultInfo', + 'acquirerInfo' => 'setAcquirerInfo', + 'promotionResult' => 'setPromotionResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'paymentRequestId' => 'getPaymentRequestId', + 'paymentId' => 'getPaymentId', + 'paymentAmount' => 'getPaymentAmount', + 'paymentData' => 'getPaymentData', + 'actualPaymentAmount' => 'getActualPaymentAmount', + 'paymentQuote' => 'getPaymentQuote', + 'paymentTime' => 'getPaymentTime', + 'paymentCreateTime' => 'getPaymentCreateTime', + 'authExpiryTime' => 'getAuthExpiryTime', + 'nonGuaranteeCouponValue' => 'getNonGuaranteeCouponValue', + 'paymentActionForm' => 'getPaymentActionForm', + 'pspCustomerInfo' => 'getPspCustomerInfo', + 'challengeActionForm' => 'getChallengeActionForm', + 'redirectActionForm' => 'getRedirectActionForm', + 'orderCodeForm' => 'getOrderCodeForm', + 'grossSettlementAmount' => 'getGrossSettlementAmount', + 'settlementQuote' => 'getSettlementQuote', + 'extendInfo' => 'getExtendInfo', + 'normalUrl' => 'getNormalUrl', + 'schemeUrl' => 'getSchemeUrl', + 'applinkUrl' => 'getApplinkUrl', + 'appIdentifier' => 'getAppIdentifier', + 'paymentResultInfo' => 'getPaymentResultInfo', + 'acquirerInfo' => 'getAcquirerInfo', + 'promotionResult' => 'getPromotionResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('paymentRequestId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('paymentAmount', $data ?? [], null); + $this->setIfExists('paymentData', $data ?? [], null); + $this->setIfExists('actualPaymentAmount', $data ?? [], null); + $this->setIfExists('paymentQuote', $data ?? [], null); + $this->setIfExists('paymentTime', $data ?? [], null); + $this->setIfExists('paymentCreateTime', $data ?? [], null); + $this->setIfExists('authExpiryTime', $data ?? [], null); + $this->setIfExists('nonGuaranteeCouponValue', $data ?? [], null); + $this->setIfExists('paymentActionForm', $data ?? [], null); + $this->setIfExists('pspCustomerInfo', $data ?? [], null); + $this->setIfExists('challengeActionForm', $data ?? [], null); + $this->setIfExists('redirectActionForm', $data ?? [], null); + $this->setIfExists('orderCodeForm', $data ?? [], null); + $this->setIfExists('grossSettlementAmount', $data ?? [], null); + $this->setIfExists('settlementQuote', $data ?? [], null); + $this->setIfExists('extendInfo', $data ?? [], null); + $this->setIfExists('normalUrl', $data ?? [], null); + $this->setIfExists('schemeUrl', $data ?? [], null); + $this->setIfExists('applinkUrl', $data ?? [], null); + $this->setIfExists('appIdentifier', $data ?? [], null); + $this->setIfExists('paymentResultInfo', $data ?? [], null); + $this->setIfExists('acquirerInfo', $data ?? [], null); + $this->setIfExists('promotionResult', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets paymentRequestId + * + * @return string|null + */ + public function getPaymentRequestId() + { + return $this->container['paymentRequestId']; + } + + /** + * Sets paymentRequestId + * + * @param string|null $paymentRequestId The unique ID that is assigned by a merchant to identify a payment request. Note: This field is returned when resultCode is PAYMENT_IN_PROCESS. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentRequestId($paymentRequestId) + { + $this->container['paymentRequestId'] = $paymentRequestId; + + return $this; + } + + /** + * Gets paymentId + * + * @return string|null + */ + public function getPaymentId() + { + return $this->container['paymentId']; + } + + /** + * Sets paymentId + * + * @param string|null $paymentId The unique ID that is assigned by Antom to identify a payment. Note: This field is returned when resultCode is PAYMENT_IN_PROCESS. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentId($paymentId) + { + $this->container['paymentId'] = $paymentId; + + return $this; + } + + /** + * Gets paymentAmount + * + * @return \request\model\Amount|null + */ + public function getPaymentAmount() + { + return $this->container['paymentAmount']; + } + + /** + * Sets paymentAmount + * + * @param \request\model\Amount|null $paymentAmount paymentAmount + * + * @return self + */ + public function setPaymentAmount($paymentAmount) + { + $this->container['paymentAmount'] = $paymentAmount; + + return $this; + } + + /** + * Gets paymentData + * + * @return string|null + */ + public function getPaymentData() + { + return $this->container['paymentData']; + } + + /** + * Sets paymentData + * + * @param string|null $paymentData Used by the Antom client SDK to render the checkout page. This parameter is returned if the merchant app has integrated Antom client SDK. After receiving the parameter, you can call the showPaymentSheet API of the Antom client SDK. More information: Maximum length: 20000 characters + * + * @return self + */ + public function setPaymentData($paymentData) + { + $this->container['paymentData'] = $paymentData; + + return $this; + } + + /** + * Gets actualPaymentAmount + * + * @return \request\model\Amount|null + */ + public function getActualPaymentAmount() + { + return $this->container['actualPaymentAmount']; + } + + /** + * Sets actualPaymentAmount + * + * @param \request\model\Amount|null $actualPaymentAmount actualPaymentAmount + * + * @return self + */ + public function setActualPaymentAmount($actualPaymentAmount) + { + $this->container['actualPaymentAmount'] = $actualPaymentAmount; + + return $this; + } + + /** + * Gets paymentQuote + * + * @return \request\model\Quote|null + */ + public function getPaymentQuote() + { + return $this->container['paymentQuote']; + } + + /** + * Sets paymentQuote + * + * @param \request\model\Quote|null $paymentQuote paymentQuote + * + * @return self + */ + public function setPaymentQuote($paymentQuote) + { + $this->container['paymentQuote'] = $paymentQuote; + + return $this; + } + + /** + * Gets paymentTime + * + * @return string|null + */ + public function getPaymentTime() + { + return $this->container['paymentTime']; + } + + /** + * Sets paymentTime + * + * @param string|null $paymentTime paymentTime + * + * @return self + */ + public function setPaymentTime($paymentTime) + { + $this->container['paymentTime'] = $paymentTime; + + return $this; + } + + /** + * Gets paymentCreateTime + * + * @return string|null + */ + public function getPaymentCreateTime() + { + return $this->container['paymentCreateTime']; + } + + /** + * Sets paymentCreateTime + * + * @param string|null $paymentCreateTime The date and time when the payment is created. Note: This field is returned when resultCode is PAYMENT_IN_PROCESS. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setPaymentCreateTime($paymentCreateTime) + { + $this->container['paymentCreateTime'] = $paymentCreateTime; + + return $this; + } + + /** + * Gets authExpiryTime + * + * @return string|null + */ + public function getAuthExpiryTime() + { + return $this->container['authExpiryTime']; + } + + /** + * Sets authExpiryTime + * + * @param string|null $authExpiryTime authExpiryTime + * + * @return self + */ + public function setAuthExpiryTime($authExpiryTime) + { + $this->container['authExpiryTime'] = $authExpiryTime; + + return $this; + } + + /** + * Gets nonGuaranteeCouponValue + * + * @return \request\model\Amount|null + */ + public function getNonGuaranteeCouponValue() + { + return $this->container['nonGuaranteeCouponValue']; + } + + /** + * Sets nonGuaranteeCouponValue + * + * @param \request\model\Amount|null $nonGuaranteeCouponValue nonGuaranteeCouponValue + * + * @return self + */ + public function setNonGuaranteeCouponValue($nonGuaranteeCouponValue) + { + $this->container['nonGuaranteeCouponValue'] = $nonGuaranteeCouponValue; + + return $this; + } + + /** + * Gets paymentActionForm + * + * @return string|null + */ + public function getPaymentActionForm() + { + return $this->container['paymentActionForm']; + } + + /** + * Sets paymentActionForm + * + * @param string|null $paymentActionForm paymentActionForm + * + * @return self + */ + public function setPaymentActionForm($paymentActionForm) + { + $this->container['paymentActionForm'] = $paymentActionForm; + + return $this; + } + + /** + * Gets pspCustomerInfo + * + * @return \request\model\PspCustomerInfo|null + */ + public function getPspCustomerInfo() + { + return $this->container['pspCustomerInfo']; + } + + /** + * Sets pspCustomerInfo + * + * @param \request\model\PspCustomerInfo|null $pspCustomerInfo pspCustomerInfo + * + * @return self + */ + public function setPspCustomerInfo($pspCustomerInfo) + { + $this->container['pspCustomerInfo'] = $pspCustomerInfo; + + return $this; + } + + /** + * Gets challengeActionForm + * + * @return \request\model\ChallengeActionForm|null + */ + public function getChallengeActionForm() + { + return $this->container['challengeActionForm']; + } + + /** + * Sets challengeActionForm + * + * @param \request\model\ChallengeActionForm|null $challengeActionForm challengeActionForm + * + * @return self + */ + public function setChallengeActionForm($challengeActionForm) + { + $this->container['challengeActionForm'] = $challengeActionForm; + + return $this; + } + + /** + * Gets redirectActionForm + * + * @return \request\model\RedirectActionForm|null + */ + public function getRedirectActionForm() + { + return $this->container['redirectActionForm']; + } + + /** + * Sets redirectActionForm + * + * @param \request\model\RedirectActionForm|null $redirectActionForm redirectActionForm + * + * @return self + */ + public function setRedirectActionForm($redirectActionForm) + { + $this->container['redirectActionForm'] = $redirectActionForm; + + return $this; + } + + /** + * Gets orderCodeForm + * + * @return \request\model\OrderCodeForm|null + */ + public function getOrderCodeForm() + { + return $this->container['orderCodeForm']; + } + + /** + * Sets orderCodeForm + * + * @param \request\model\OrderCodeForm|null $orderCodeForm orderCodeForm + * + * @return self + */ + public function setOrderCodeForm($orderCodeForm) + { + $this->container['orderCodeForm'] = $orderCodeForm; + + return $this; + } + + /** + * Gets grossSettlementAmount + * + * @return \request\model\Amount|null + */ + public function getGrossSettlementAmount() + { + return $this->container['grossSettlementAmount']; + } + + /** + * Sets grossSettlementAmount + * + * @param \request\model\Amount|null $grossSettlementAmount grossSettlementAmount + * + * @return self + */ + public function setGrossSettlementAmount($grossSettlementAmount) + { + $this->container['grossSettlementAmount'] = $grossSettlementAmount; + + return $this; + } + + /** + * Gets settlementQuote + * + * @return \request\model\Quote|null + */ + public function getSettlementQuote() + { + return $this->container['settlementQuote']; + } + + /** + * Sets settlementQuote + * + * @param \request\model\Quote|null $settlementQuote settlementQuote + * + * @return self + */ + public function setSettlementQuote($settlementQuote) + { + $this->container['settlementQuote'] = $settlementQuote; + + return $this; + } + + /** + * Gets extendInfo + * + * @return string|null + */ + public function getExtendInfo() + { + return $this->container['extendInfo']; + } + + /** + * Sets extendInfo + * + * @param string|null $extendInfo extendInfo + * + * @return self + */ + public function setExtendInfo($extendInfo) + { + $this->container['extendInfo'] = $extendInfo; + + return $this; + } + + /** + * Gets normalUrl + * + * @return string|null + */ + public function getNormalUrl() + { + return $this->container['normalUrl']; + } + + /** + * Sets normalUrl + * + * @param string|null $normalUrl The URL that redirects users to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of resultCode is ​PAYMENT_IN_PROCESS​, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setNormalUrl($normalUrl) + { + $this->container['normalUrl'] = $normalUrl; + + return $this; + } + + /** + * Gets schemeUrl + * + * @return string|null + */ + public function getSchemeUrl() + { + return $this->container['schemeUrl']; + } + + /** + * Sets schemeUrl + * + * @param string|null $schemeUrl The URL scheme that redirects users to open an app in an Android or iOS system when the target app is installed. Note: When the value of resultCode is ​PAYMENT_IN_PROCESS​, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setSchemeUrl($schemeUrl) + { + $this->container['schemeUrl'] = $schemeUrl; + + return $this; + } + + /** + * Gets applinkUrl + * + * @return string|null + */ + public function getApplinkUrl() + { + return $this->container['applinkUrl']; + } + + /** + * Sets applinkUrl + * + * @param string|null $applinkUrl The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of resultCode is ​PAYMENT_IN_PROCESS​, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setApplinkUrl($applinkUrl) + { + $this->container['applinkUrl'] = $applinkUrl; + + return $this; + } + + /** + * Gets appIdentifier + * + * @return string|null + */ + public function getAppIdentifier() + { + return $this->container['appIdentifier']; + } + + /** + * Sets appIdentifier + * + * @param string|null $appIdentifier Android package name, which is used by Android apps to open a cashier page. Note: This field is returned when resultCode is ​PAYMENT_IN_PROCESS​ and terminalType is APP or WAP. + * + * @return self + */ + public function setAppIdentifier($appIdentifier) + { + $this->container['appIdentifier'] = $appIdentifier; + + return $this; + } + + /** + * Gets paymentResultInfo + * + * @return \request\model\PaymentResultInfo|null + */ + public function getPaymentResultInfo() + { + return $this->container['paymentResultInfo']; + } + + /** + * Sets paymentResultInfo + * + * @param \request\model\PaymentResultInfo|null $paymentResultInfo paymentResultInfo + * + * @return self + */ + public function setPaymentResultInfo($paymentResultInfo) + { + $this->container['paymentResultInfo'] = $paymentResultInfo; + + return $this; + } + + /** + * Gets acquirerInfo + * + * @return \request\model\AcquirerInfo|null + */ + public function getAcquirerInfo() + { + return $this->container['acquirerInfo']; + } + + /** + * Sets acquirerInfo + * + * @param \request\model\AcquirerInfo|null $acquirerInfo acquirerInfo + * + * @return self + */ + public function setAcquirerInfo($acquirerInfo) + { + $this->container['acquirerInfo'] = $acquirerInfo; + + return $this; + } + + /** + * Gets promotionResult + * + * @return \request\model\PromotionResult[]|null + */ + public function getPromotionResult() + { + return $this->container['promotionResult']; + } + + /** + * Sets promotionResult + * + * @param \request\model\PromotionResult[]|null $promotionResult Promotion result. + * + * @return self + */ + public function setPromotionResult($promotionResult) + { + $this->container['promotionResult'] = $promotionResult; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayPaymentSessionResponse.php b/response/pay/AlipayPaymentSessionResponse.php new file mode 100644 index 0000000..aa46b1e --- /dev/null +++ b/response/pay/AlipayPaymentSessionResponse.php @@ -0,0 +1,546 @@ + + */ +class AlipayPaymentSessionResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayPaymentSessionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'paymentSessionData' => 'string', + 'paymentSessionExpiryTime' => 'string', + 'paymentSessionId' => 'string', + 'normalUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'paymentSessionData' => null, + 'paymentSessionExpiryTime' => null, + 'paymentSessionId' => null, + 'normalUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'paymentSessionData' => false, + 'paymentSessionExpiryTime' => false, + 'paymentSessionId' => false, + 'normalUrl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'paymentSessionData' => 'paymentSessionData', + 'paymentSessionExpiryTime' => 'paymentSessionExpiryTime', + 'paymentSessionId' => 'paymentSessionId', + 'normalUrl' => 'normalUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'paymentSessionData' => 'setPaymentSessionData', + 'paymentSessionExpiryTime' => 'setPaymentSessionExpiryTime', + 'paymentSessionId' => 'setPaymentSessionId', + 'normalUrl' => 'setNormalUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'paymentSessionData' => 'getPaymentSessionData', + 'paymentSessionExpiryTime' => 'getPaymentSessionExpiryTime', + 'paymentSessionId' => 'getPaymentSessionId', + 'normalUrl' => 'getNormalUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('paymentSessionData', $data ?? [], null); + $this->setIfExists('paymentSessionExpiryTime', $data ?? [], null); + $this->setIfExists('paymentSessionId', $data ?? [], null); + $this->setIfExists('normalUrl', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + if ($this->container['paymentSessionData'] === null) { + $invalidProperties[] = "'paymentSessionData' can't be null"; + } + if ($this->container['paymentSessionExpiryTime'] === null) { + $invalidProperties[] = "'paymentSessionExpiryTime' can't be null"; + } + if ($this->container['paymentSessionId'] === null) { + $invalidProperties[] = "'paymentSessionId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets paymentSessionData + * + * @return string + */ + public function getPaymentSessionData() + { + return $this->container['paymentSessionData']; + } + + /** + * Sets paymentSessionData + * + * @param string $paymentSessionData The encrypted payment session data. Pass the data to your front end to initiate the client-side SDK. More information: Maximum length: 4096 characters + * + * @return self + */ + public function setPaymentSessionData($paymentSessionData) + { + $this->container['paymentSessionData'] = $paymentSessionData; + + return $this; + } + + /** + * Gets paymentSessionExpiryTime + * + * @return string + */ + public function getPaymentSessionExpiryTime() + { + return $this->container['paymentSessionExpiryTime']; + } + + /** + * Sets paymentSessionExpiryTime + * + * @param string $paymentSessionExpiryTime The specific date and time after which the payment session will expire. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setPaymentSessionExpiryTime($paymentSessionExpiryTime) + { + $this->container['paymentSessionExpiryTime'] = $paymentSessionExpiryTime; + + return $this; + } + + /** + * Gets paymentSessionId + * + * @return string + */ + public function getPaymentSessionId() + { + return $this->container['paymentSessionId']; + } + + /** + * Sets paymentSessionId + * + * @param string $paymentSessionId The encrypted ID that is assigned by Antom to identify a payment session. More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentSessionId($paymentSessionId) + { + $this->container['paymentSessionId'] = $paymentSessionId; + + return $this; + } + + /** + * Gets normalUrl + * + * @return string|null + */ + public function getNormalUrl() + { + return $this->container['normalUrl']; + } + + /** + * Sets normalUrl + * + * @param string|null $normalUrl The URL used to redirect to the Checkout Page. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setNormalUrl($normalUrl) + { + $this->container['normalUrl'] = $normalUrl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayRefundResponse.php b/response/pay/AlipayRefundResponse.php new file mode 100644 index 0000000..64a800e --- /dev/null +++ b/response/pay/AlipayRefundResponse.php @@ -0,0 +1,723 @@ + + */ +class AlipayRefundResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayRefundResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'refundRequestId' => 'string', + 'refundId' => 'string', + 'paymentId' => 'string', + 'refundAmount' => '\request\model\Amount', + 'refundTime' => 'string', + 'refundNonGuaranteeCouponAmount' => '\request\model\Amount', + 'grossSettlementAmount' => '\request\model\Amount', + 'settlementQuote' => '\request\model\Quote', + 'acquirerInfo' => '\request\model\AcquirerInfo', + 'acquirerReferenceNo' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'refundRequestId' => null, + 'refundId' => null, + 'paymentId' => null, + 'refundAmount' => null, + 'refundTime' => null, + 'refundNonGuaranteeCouponAmount' => null, + 'grossSettlementAmount' => null, + 'settlementQuote' => null, + 'acquirerInfo' => null, + 'acquirerReferenceNo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'refundRequestId' => false, + 'refundId' => false, + 'paymentId' => false, + 'refundAmount' => false, + 'refundTime' => false, + 'refundNonGuaranteeCouponAmount' => false, + 'grossSettlementAmount' => false, + 'settlementQuote' => false, + 'acquirerInfo' => false, + 'acquirerReferenceNo' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'refundRequestId' => 'refundRequestId', + 'refundId' => 'refundId', + 'paymentId' => 'paymentId', + 'refundAmount' => 'refundAmount', + 'refundTime' => 'refundTime', + 'refundNonGuaranteeCouponAmount' => 'refundNonGuaranteeCouponAmount', + 'grossSettlementAmount' => 'grossSettlementAmount', + 'settlementQuote' => 'settlementQuote', + 'acquirerInfo' => 'acquirerInfo', + 'acquirerReferenceNo' => 'acquirerReferenceNo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'refundRequestId' => 'setRefundRequestId', + 'refundId' => 'setRefundId', + 'paymentId' => 'setPaymentId', + 'refundAmount' => 'setRefundAmount', + 'refundTime' => 'setRefundTime', + 'refundNonGuaranteeCouponAmount' => 'setRefundNonGuaranteeCouponAmount', + 'grossSettlementAmount' => 'setGrossSettlementAmount', + 'settlementQuote' => 'setSettlementQuote', + 'acquirerInfo' => 'setAcquirerInfo', + 'acquirerReferenceNo' => 'setAcquirerReferenceNo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'refundRequestId' => 'getRefundRequestId', + 'refundId' => 'getRefundId', + 'paymentId' => 'getPaymentId', + 'refundAmount' => 'getRefundAmount', + 'refundTime' => 'getRefundTime', + 'refundNonGuaranteeCouponAmount' => 'getRefundNonGuaranteeCouponAmount', + 'grossSettlementAmount' => 'getGrossSettlementAmount', + 'settlementQuote' => 'getSettlementQuote', + 'acquirerInfo' => 'getAcquirerInfo', + 'acquirerReferenceNo' => 'getAcquirerReferenceNo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('refundRequestId', $data ?? [], null); + $this->setIfExists('refundId', $data ?? [], null); + $this->setIfExists('paymentId', $data ?? [], null); + $this->setIfExists('refundAmount', $data ?? [], null); + $this->setIfExists('refundTime', $data ?? [], null); + $this->setIfExists('refundNonGuaranteeCouponAmount', $data ?? [], null); + $this->setIfExists('grossSettlementAmount', $data ?? [], null); + $this->setIfExists('settlementQuote', $data ?? [], null); + $this->setIfExists('acquirerInfo', $data ?? [], null); + $this->setIfExists('acquirerReferenceNo', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets refundRequestId + * + * @return string|null + */ + public function getRefundRequestId() + { + return $this->container['refundRequestId']; + } + + /** + * Sets refundRequestId + * + * @param string|null $refundRequestId The unique ID that is assigned by the merchant to identify a refund request. Note: This field is returned when the refund succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setRefundRequestId($refundRequestId) + { + $this->container['refundRequestId'] = $refundRequestId; + + return $this; + } + + /** + * Gets refundId + * + * @return string|null + */ + public function getRefundId() + { + return $this->container['refundId']; + } + + /** + * Sets refundId + * + * @param string|null $refundId The unique ID that is assigned by Antom to identify a refund. A one-to-one correspondence between refundId and refundRequestId exists. Note: This field is returned when the refund succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setRefundId($refundId) + { + $this->container['refundId'] = $refundId; + + return $this; + } + + /** + * Gets paymentId + * + * @return string|null + */ + public function getPaymentId() + { + return $this->container['paymentId']; + } + + /** + * Sets paymentId + * + * @param string|null $paymentId The unique ID assigned by Antom for the original payment to be refunded. Note: This field is returned when the refund succeeds (the value of result.resultStatus is S). More information: Maximum length: 64 characters + * + * @return self + */ + public function setPaymentId($paymentId) + { + $this->container['paymentId'] = $paymentId; + + return $this; + } + + /** + * Gets refundAmount + * + * @return \request\model\Amount|null + */ + public function getRefundAmount() + { + return $this->container['refundAmount']; + } + + /** + * Sets refundAmount + * + * @param \request\model\Amount|null $refundAmount refundAmount + * + * @return self + */ + public function setRefundAmount($refundAmount) + { + $this->container['refundAmount'] = $refundAmount; + + return $this; + } + + /** + * Gets refundTime + * + * @return string|null + */ + public function getRefundTime() + { + return $this->container['refundTime']; + } + + /** + * Sets refundTime + * + * @param string|null $refundTime The date and time when the refund reaches the state of success, failure, or unknown. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setRefundTime($refundTime) + { + $this->container['refundTime'] = $refundTime; + + return $this; + } + + /** + * Gets refundNonGuaranteeCouponAmount + * + * @return \request\model\Amount|null + */ + public function getRefundNonGuaranteeCouponAmount() + { + return $this->container['refundNonGuaranteeCouponAmount']; + } + + /** + * Sets refundNonGuaranteeCouponAmount + * + * @param \request\model\Amount|null $refundNonGuaranteeCouponAmount refundNonGuaranteeCouponAmount + * + * @return self + */ + public function setRefundNonGuaranteeCouponAmount($refundNonGuaranteeCouponAmount) + { + $this->container['refundNonGuaranteeCouponAmount'] = $refundNonGuaranteeCouponAmount; + + return $this; + } + + /** + * Gets grossSettlementAmount + * + * @return \request\model\Amount|null + */ + public function getGrossSettlementAmount() + { + return $this->container['grossSettlementAmount']; + } + + /** + * Sets grossSettlementAmount + * + * @param \request\model\Amount|null $grossSettlementAmount grossSettlementAmount + * + * @return self + */ + public function setGrossSettlementAmount($grossSettlementAmount) + { + $this->container['grossSettlementAmount'] = $grossSettlementAmount; + + return $this; + } + + /** + * Gets settlementQuote + * + * @return \request\model\Quote|null + */ + public function getSettlementQuote() + { + return $this->container['settlementQuote']; + } + + /** + * Sets settlementQuote + * + * @param \request\model\Quote|null $settlementQuote settlementQuote + * + * @return self + */ + public function setSettlementQuote($settlementQuote) + { + $this->container['settlementQuote'] = $settlementQuote; + + return $this; + } + + /** + * Gets acquirerInfo + * + * @return \request\model\AcquirerInfo|null + */ + public function getAcquirerInfo() + { + return $this->container['acquirerInfo']; + } + + /** + * Sets acquirerInfo + * + * @param \request\model\AcquirerInfo|null $acquirerInfo acquirerInfo + * + * @return self + */ + public function setAcquirerInfo($acquirerInfo) + { + $this->container['acquirerInfo'] = $acquirerInfo; + + return $this; + } + + /** + * Gets acquirerReferenceNo + * + * @return string|null + */ + public function getAcquirerReferenceNo() + { + return $this->container['acquirerReferenceNo']; + } + + /** + * Sets acquirerReferenceNo + * + * @param string|null $acquirerReferenceNo The unique ID assigned by the non-Antom acquirer for the transaction. More information: Maximum length: 64 characters + * + * @return self + */ + public function setAcquirerReferenceNo($acquirerReferenceNo) + { + $this->container['acquirerReferenceNo'] = $acquirerReferenceNo; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayVaultingPaymentMethodResponse.php b/response/pay/AlipayVaultingPaymentMethodResponse.php new file mode 100644 index 0000000..abb3577 --- /dev/null +++ b/response/pay/AlipayVaultingPaymentMethodResponse.php @@ -0,0 +1,571 @@ + + */ +class AlipayVaultingPaymentMethodResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayVaultingPaymentMethodResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'vaultingRequestId' => 'string', + 'paymentMethodDetail' => '\request\model\PaymentMethodDetail', + 'normalUrl' => 'string', + 'schemeUrl' => 'string', + 'applinkUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'vaultingRequestId' => null, + 'paymentMethodDetail' => null, + 'normalUrl' => null, + 'schemeUrl' => null, + 'applinkUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'vaultingRequestId' => false, + 'paymentMethodDetail' => false, + 'normalUrl' => false, + 'schemeUrl' => false, + 'applinkUrl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'vaultingRequestId' => 'vaultingRequestId', + 'paymentMethodDetail' => 'paymentMethodDetail', + 'normalUrl' => 'normalUrl', + 'schemeUrl' => 'schemeUrl', + 'applinkUrl' => 'applinkUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'vaultingRequestId' => 'setVaultingRequestId', + 'paymentMethodDetail' => 'setPaymentMethodDetail', + 'normalUrl' => 'setNormalUrl', + 'schemeUrl' => 'setSchemeUrl', + 'applinkUrl' => 'setApplinkUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'vaultingRequestId' => 'getVaultingRequestId', + 'paymentMethodDetail' => 'getPaymentMethodDetail', + 'normalUrl' => 'getNormalUrl', + 'schemeUrl' => 'getSchemeUrl', + 'applinkUrl' => 'getApplinkUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('vaultingRequestId', $data ?? [], null); + $this->setIfExists('paymentMethodDetail', $data ?? [], null); + $this->setIfExists('normalUrl', $data ?? [], null); + $this->setIfExists('schemeUrl', $data ?? [], null); + $this->setIfExists('applinkUrl', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + if ($this->container['vaultingRequestId'] === null) { + $invalidProperties[] = "'vaultingRequestId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets vaultingRequestId + * + * @return string + */ + public function getVaultingRequestId() + { + return $this->container['vaultingRequestId']; + } + + /** + * Sets vaultingRequestId + * + * @param string $vaultingRequestId The unique ID that is assigned by a merchant to identify a card vaulting request. More information: Maximum length: 64 characters + * + * @return self + */ + public function setVaultingRequestId($vaultingRequestId) + { + $this->container['vaultingRequestId'] = $vaultingRequestId; + + return $this; + } + + /** + * Gets paymentMethodDetail + * + * @return \request\model\PaymentMethodDetail|null + */ + public function getPaymentMethodDetail() + { + return $this->container['paymentMethodDetail']; + } + + /** + * Sets paymentMethodDetail + * + * @param \request\model\PaymentMethodDetail|null $paymentMethodDetail paymentMethodDetail + * + * @return self + */ + public function setPaymentMethodDetail($paymentMethodDetail) + { + $this->container['paymentMethodDetail'] = $paymentMethodDetail; + + return $this; + } + + /** + * Gets normalUrl + * + * @return string|null + */ + public function getNormalUrl() + { + return $this->container['normalUrl']; + } + + /** + * Sets normalUrl + * + * @param string|null $normalUrl The URL that redirects the user to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of result.resultCode is VERIFICATION_IN_PROCESS, one or more of the following URLs may be returned: schemeUrl, appLinkUrl, and normalUrl. When the value of paymentMethodType is CARD, the user is required to complete the 3DS authentication on the page accessed through this URL. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setNormalUrl($normalUrl) + { + $this->container['normalUrl'] = $normalUrl; + + return $this; + } + + /** + * Gets schemeUrl + * + * @return string|null + */ + public function getSchemeUrl() + { + return $this->container['schemeUrl']; + } + + /** + * Sets schemeUrl + * + * @param string|null $schemeUrl The URL scheme that redirects the user to open an app in an Android or iOS system when the target app is installed. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setSchemeUrl($schemeUrl) + { + $this->container['schemeUrl'] = $schemeUrl; + + return $this; + } + + /** + * Gets applinkUrl + * + * @return string|null + */ + public function getApplinkUrl() + { + return $this->container['applinkUrl']; + } + + /** + * Sets applinkUrl + * + * @param string|null $applinkUrl The URL that redirects the user to open an app when the target app is installed, or to open a WAP page when the target app is not installed. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setApplinkUrl($applinkUrl) + { + $this->container['applinkUrl'] = $applinkUrl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayVaultingQueryResponse.php b/response/pay/AlipayVaultingQueryResponse.php new file mode 100644 index 0000000..7336b7d --- /dev/null +++ b/response/pay/AlipayVaultingQueryResponse.php @@ -0,0 +1,602 @@ + + */ +class AlipayVaultingQueryResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayVaultingQueryResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'vaultingRequestId' => 'string', + 'normalUrl' => 'string', + 'schemeUrl' => 'string', + 'applinkUrl' => 'string', + 'vaultingStatus' => 'string', + 'paymentMethodDetail' => '\request\model\PaymentMethodDetail' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'vaultingRequestId' => null, + 'normalUrl' => null, + 'schemeUrl' => null, + 'applinkUrl' => null, + 'vaultingStatus' => null, + 'paymentMethodDetail' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'vaultingRequestId' => false, + 'normalUrl' => false, + 'schemeUrl' => false, + 'applinkUrl' => false, + 'vaultingStatus' => false, + 'paymentMethodDetail' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'vaultingRequestId' => 'vaultingRequestId', + 'normalUrl' => 'normalUrl', + 'schemeUrl' => 'schemeUrl', + 'applinkUrl' => 'applinkUrl', + 'vaultingStatus' => 'vaultingStatus', + 'paymentMethodDetail' => 'paymentMethodDetail' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'vaultingRequestId' => 'setVaultingRequestId', + 'normalUrl' => 'setNormalUrl', + 'schemeUrl' => 'setSchemeUrl', + 'applinkUrl' => 'setApplinkUrl', + 'vaultingStatus' => 'setVaultingStatus', + 'paymentMethodDetail' => 'setPaymentMethodDetail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'vaultingRequestId' => 'getVaultingRequestId', + 'normalUrl' => 'getNormalUrl', + 'schemeUrl' => 'getSchemeUrl', + 'applinkUrl' => 'getApplinkUrl', + 'vaultingStatus' => 'getVaultingStatus', + 'paymentMethodDetail' => 'getPaymentMethodDetail' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('vaultingRequestId', $data ?? [], null); + $this->setIfExists('normalUrl', $data ?? [], null); + $this->setIfExists('schemeUrl', $data ?? [], null); + $this->setIfExists('applinkUrl', $data ?? [], null); + $this->setIfExists('vaultingStatus', $data ?? [], null); + $this->setIfExists('paymentMethodDetail', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + if ($this->container['vaultingRequestId'] === null) { + $invalidProperties[] = "'vaultingRequestId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets vaultingRequestId + * + * @return string + */ + public function getVaultingRequestId() + { + return $this->container['vaultingRequestId']; + } + + /** + * Sets vaultingRequestId + * + * @param string $vaultingRequestId The unique ID that is assigned by a merchant to identify a card vaulting request. More information: Maximum length: 64 characters + * + * @return self + */ + public function setVaultingRequestId($vaultingRequestId) + { + $this->container['vaultingRequestId'] = $vaultingRequestId; + + return $this; + } + + /** + * Gets normalUrl + * + * @return string|null + */ + public function getNormalUrl() + { + return $this->container['normalUrl']; + } + + /** + * Sets normalUrl + * + * @param string|null $normalUrl The URL that redirects users to a WAP or WEB page in the default browser or the embedded WebView. Note: When the value of result.resultStatus is S and the value of vaultingStatus is PROCESSING, one or more of the following URLs may be returned: schemeUrl, applinkUrl, and normalUrl. When the value of paymentMethodType is CARD, the user is required to complete the 3DS authentication on the page accessed through this URL. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setNormalUrl($normalUrl) + { + $this->container['normalUrl'] = $normalUrl; + + return $this; + } + + /** + * Gets schemeUrl + * + * @return string|null + */ + public function getSchemeUrl() + { + return $this->container['schemeUrl']; + } + + /** + * Sets schemeUrl + * + * @param string|null $schemeUrl The URL scheme that redirects users to open an App in an Android or iOS system when the target App is installed. Note: When the value of result.resultStatus is S and the value of vaultingStatus is PROCESSING, one or more of the following URLs may be returned: schemeUrl, applinkUrl, and normalUrl. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setSchemeUrl($schemeUrl) + { + $this->container['schemeUrl'] = $schemeUrl; + + return $this; + } + + /** + * Gets applinkUrl + * + * @return string|null + */ + public function getApplinkUrl() + { + return $this->container['applinkUrl']; + } + + /** + * Sets applinkUrl + * + * @param string|null $applinkUrl The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of result.resultStatus is S and the value of vaultingStatus is PROCESSING, one or more of the following URLs may be returned: schemeUrl, applinkUrl, and normalUrl. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setApplinkUrl($applinkUrl) + { + $this->container['applinkUrl'] = $applinkUrl; + + return $this; + } + + /** + * Gets vaultingStatus + * + * @return string|null + */ + public function getVaultingStatus() + { + return $this->container['vaultingStatus']; + } + + /** + * Sets vaultingStatus + * + * @param string|null $vaultingStatus Indicates the payment method's vaulting status. Valid values are: SUCCESS: indicates that the vaulting is successful. FAIL: indicates that the vaulting failed. PROCESSING: indicates that the vaulting is under process. This parameter is returned when the value of result.resultStatus is S. More information: Maximum length: 10 characters + * + * @return self + */ + public function setVaultingStatus($vaultingStatus) + { + $this->container['vaultingStatus'] = $vaultingStatus; + + return $this; + } + + /** + * Gets paymentMethodDetail + * + * @return \request\model\PaymentMethodDetail|null + */ + public function getPaymentMethodDetail() + { + return $this->container['paymentMethodDetail']; + } + + /** + * Sets paymentMethodDetail + * + * @param \request\model\PaymentMethodDetail|null $paymentMethodDetail paymentMethodDetail + * + * @return self + */ + public function setPaymentMethodDetail($paymentMethodDetail) + { + $this->container['paymentMethodDetail'] = $paymentMethodDetail; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/pay/AlipayVaultingSessionResponse.php b/response/pay/AlipayVaultingSessionResponse.php new file mode 100644 index 0000000..071f990 --- /dev/null +++ b/response/pay/AlipayVaultingSessionResponse.php @@ -0,0 +1,512 @@ + + */ +class AlipayVaultingSessionResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipayVaultingSessionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'vaultingSessionData' => 'string', + 'vaultingSessionId' => 'string', + 'vaultingSessionExpiryTime' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'vaultingSessionData' => null, + 'vaultingSessionId' => null, + 'vaultingSessionExpiryTime' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'vaultingSessionData' => false, + 'vaultingSessionId' => false, + 'vaultingSessionExpiryTime' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'vaultingSessionData' => 'vaultingSessionData', + 'vaultingSessionId' => 'vaultingSessionId', + 'vaultingSessionExpiryTime' => 'vaultingSessionExpiryTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'vaultingSessionData' => 'setVaultingSessionData', + 'vaultingSessionId' => 'setVaultingSessionId', + 'vaultingSessionExpiryTime' => 'setVaultingSessionExpiryTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'vaultingSessionData' => 'getVaultingSessionData', + 'vaultingSessionId' => 'getVaultingSessionId', + 'vaultingSessionExpiryTime' => 'getVaultingSessionExpiryTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('vaultingSessionData', $data ?? [], null); + $this->setIfExists('vaultingSessionId', $data ?? [], null); + $this->setIfExists('vaultingSessionExpiryTime', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['vaultingSessionData'] === null) { + $invalidProperties[] = "'vaultingSessionData' can't be null"; + } + if ($this->container['vaultingSessionId'] === null) { + $invalidProperties[] = "'vaultingSessionId' can't be null"; + } + if ($this->container['vaultingSessionExpiryTime'] === null) { + $invalidProperties[] = "'vaultingSessionExpiryTime' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result|null $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets vaultingSessionData + * + * @return string + */ + public function getVaultingSessionData() + { + return $this->container['vaultingSessionData']; + } + + /** + * Sets vaultingSessionData + * + * @param string $vaultingSessionData The encrypted vaulting session data. Pass the data to your front end to initiate the client-side SDK. More information: Maximum length: 4096 characters + * + * @return self + */ + public function setVaultingSessionData($vaultingSessionData) + { + $this->container['vaultingSessionData'] = $vaultingSessionData; + + return $this; + } + + /** + * Gets vaultingSessionId + * + * @return string + */ + public function getVaultingSessionId() + { + return $this->container['vaultingSessionId']; + } + + /** + * Sets vaultingSessionId + * + * @param string $vaultingSessionId The encrypted ID is assigned by Antom to identify a vaulting session. More information: Maximum length: 64 characters + * + * @return self + */ + public function setVaultingSessionId($vaultingSessionId) + { + $this->container['vaultingSessionId'] = $vaultingSessionId; + + return $this; + } + + /** + * Gets vaultingSessionExpiryTime + * + * @return string + */ + public function getVaultingSessionExpiryTime() + { + return $this->container['vaultingSessionExpiryTime']; + } + + /** + * Sets vaultingSessionExpiryTime + * + * @param string $vaultingSessionExpiryTime The specific date and time after which the vaulting session will expire. More information: The value follows the ISO 8601 standard format. For example, \"2019-11-27T12:01:01+08:00\". + * + * @return self + */ + public function setVaultingSessionExpiryTime($vaultingSessionExpiryTime) + { + $this->container['vaultingSessionExpiryTime'] = $vaultingSessionExpiryTime; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/subscription/AlipaySubscriptionCancelResponse.php b/response/subscription/AlipaySubscriptionCancelResponse.php new file mode 100644 index 0000000..f52aaf2 --- /dev/null +++ b/response/subscription/AlipaySubscriptionCancelResponse.php @@ -0,0 +1,413 @@ + + */ +class AlipaySubscriptionCancelResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionCancelResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/subscription/AlipaySubscriptionChangeResponse.php b/response/subscription/AlipaySubscriptionChangeResponse.php new file mode 100644 index 0000000..c2f5876 --- /dev/null +++ b/response/subscription/AlipaySubscriptionChangeResponse.php @@ -0,0 +1,413 @@ + + */ +class AlipaySubscriptionChangeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionChangeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/subscription/AlipaySubscriptionCreateResponse.php b/response/subscription/AlipaySubscriptionCreateResponse.php new file mode 100644 index 0000000..0370475 --- /dev/null +++ b/response/subscription/AlipaySubscriptionCreateResponse.php @@ -0,0 +1,537 @@ + + */ +class AlipaySubscriptionCreateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionCreateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result', + 'schemeUrl' => 'string', + 'applinkUrl' => 'string', + 'normalUrl' => 'string', + 'appIdentifier' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'schemeUrl' => null, + 'applinkUrl' => null, + 'normalUrl' => null, + 'appIdentifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false, + 'schemeUrl' => false, + 'applinkUrl' => false, + 'normalUrl' => false, + 'appIdentifier' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result', + 'schemeUrl' => 'schemeUrl', + 'applinkUrl' => 'applinkUrl', + 'normalUrl' => 'normalUrl', + 'appIdentifier' => 'appIdentifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'schemeUrl' => 'setSchemeUrl', + 'applinkUrl' => 'setApplinkUrl', + 'normalUrl' => 'setNormalUrl', + 'appIdentifier' => 'setAppIdentifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + 'schemeUrl' => 'getSchemeUrl', + 'applinkUrl' => 'getApplinkUrl', + 'normalUrl' => 'getNormalUrl', + 'appIdentifier' => 'getAppIdentifier' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('schemeUrl', $data ?? [], null); + $this->setIfExists('applinkUrl', $data ?? [], null); + $this->setIfExists('normalUrl', $data ?? [], null); + $this->setIfExists('appIdentifier', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets schemeUrl + * + * @return string|null + */ + public function getSchemeUrl() + { + return $this->container['schemeUrl']; + } + + /** + * Sets schemeUrl + * + * @param string|null $schemeUrl The URL scheme that redirects users to open an app in an Android or iOS system when the target app is installed. Note: When the value of result.resultCode is S, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setSchemeUrl($schemeUrl) + { + $this->container['schemeUrl'] = $schemeUrl; + + return $this; + } + + /** + * Gets applinkUrl + * + * @return string|null + */ + public function getApplinkUrl() + { + return $this->container['applinkUrl']; + } + + /** + * Sets applinkUrl + * + * @param string|null $applinkUrl The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed. For Android, the URL is a Native App Link. For iOS, the URL is a Universal Link. Note: When the value of result.resultCode is S, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setApplinkUrl($applinkUrl) + { + $this->container['applinkUrl'] = $applinkUrl; + + return $this; + } + + /** + * Gets normalUrl + * + * @return string|null + */ + public function getNormalUrl() + { + return $this->container['normalUrl']; + } + + /** + * Sets normalUrl + * + * @param string|null $normalUrl The URL that redirects users to a WAP or Web page in the default browser or the embedded WebView. Note: When the value of result.resultCode is S, at least one of schemeUrl, applinkUrl, and normalUrl is to be returned. More information: Maximum length: 2048 characters + * + * @return self + */ + public function setNormalUrl($normalUrl) + { + $this->container['normalUrl'] = $normalUrl; + + return $this; + } + + /** + * Gets appIdentifier + * + * @return string|null + */ + public function getAppIdentifier() + { + return $this->container['appIdentifier']; + } + + /** + * Sets appIdentifier + * + * @param string|null $appIdentifier An Android package name, which is used for Android app to open a cashier page. Note: This field is returned when result.resultCode is S and terminalType is APP or WAP. More information: Maximum length: 128 characters + * + * @return self + */ + public function setAppIdentifier($appIdentifier) + { + $this->container['appIdentifier'] = $appIdentifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/response/subscription/AlipaySubscriptionUpdateResponse.php b/response/subscription/AlipaySubscriptionUpdateResponse.php new file mode 100644 index 0000000..0e5c4b2 --- /dev/null +++ b/response/subscription/AlipaySubscriptionUpdateResponse.php @@ -0,0 +1,413 @@ + + */ +class AlipaySubscriptionUpdateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AlipaySubscriptionUpdateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => '\request\model\Result' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('result', $data ?? [], null); + + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets result + * + * @return \request\model\Result + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \request\model\Result $result result + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + public function toArray(): array + { + $array = []; + foreach (self::$openAPITypes as $propertyName => $propertyType) { + $propertyValue = $this[$propertyName]; + if ($propertyValue !== null) { + // Check if the property value is an object and has a toArray() method + if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) { + $array[$propertyName] = $propertyValue->toArray(); + // Check if it's type datetime + } elseif ($propertyValue instanceof \DateTime) { + $array[$propertyName] = $propertyValue->format(DATE_ATOM); + // If it's an array type we should check whether it contains objects and if so call toArray method + } elseif (is_array($propertyValue)) { + $array[$propertyName] = array_map(function ($item) { + return $item instanceof ModelInterface ? $item->toArray() : $item; + }, $propertyValue); + } else { + // Otherwise, directly assign the property value to the array + $array[$propertyName] = $propertyValue; + } + } + } + return $array; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +}