diff --git a/src/Adyen/Model/Checkout/AdditionalDataAirline.php b/src/Adyen/Model/Checkout/AdditionalDataAirline.php index 4169bae1..43a7425d 100644 --- a/src/Adyen/Model/Checkout/AdditionalDataAirline.php +++ b/src/Adyen/Model/Checkout/AdditionalDataAirline.php @@ -66,7 +66,7 @@ class AdditionalDataAirline implements ModelInterface, ArrayAccess, \JsonSeriali 'airlinePassengerDateOfBirth' => 'string', 'airlinePassengerFirstName' => 'string', 'airlinePassengerLastName' => 'string', - 'airlinePassengerTelephoneNumber' => 'string', + 'airlinePassengerPhoneNumber' => 'string', 'airlinePassengerTravellerType' => 'string', 'airlinePassengerName' => 'string', 'airlineTicketIssueAddress' => 'string', @@ -105,7 +105,7 @@ class AdditionalDataAirline implements ModelInterface, ArrayAccess, \JsonSeriali 'airlinePassengerDateOfBirth' => null, 'airlinePassengerFirstName' => null, 'airlinePassengerLastName' => null, - 'airlinePassengerTelephoneNumber' => null, + 'airlinePassengerPhoneNumber' => null, 'airlinePassengerTravellerType' => null, 'airlinePassengerName' => null, 'airlineTicketIssueAddress' => null, @@ -142,7 +142,7 @@ class AdditionalDataAirline implements ModelInterface, ArrayAccess, \JsonSeriali 'airlinePassengerDateOfBirth' => false, 'airlinePassengerFirstName' => false, 'airlinePassengerLastName' => false, - 'airlinePassengerTelephoneNumber' => false, + 'airlinePassengerPhoneNumber' => false, 'airlinePassengerTravellerType' => false, 'airlinePassengerName' => false, 'airlineTicketIssueAddress' => false, @@ -259,7 +259,7 @@ public function isNullableSetToNull(string $property): bool 'airlinePassengerDateOfBirth' => 'airline.passenger.date_of_birth', 'airlinePassengerFirstName' => 'airline.passenger.first_name', 'airlinePassengerLastName' => 'airline.passenger.last_name', - 'airlinePassengerTelephoneNumber' => 'airline.passenger.telephone_number', + 'airlinePassengerPhoneNumber' => 'airline.passenger.phone_number', 'airlinePassengerTravellerType' => 'airline.passenger.traveller_type', 'airlinePassengerName' => 'airline.passenger_name', 'airlineTicketIssueAddress' => 'airline.ticket_issue_address', @@ -296,7 +296,7 @@ public function isNullableSetToNull(string $property): bool 'airlinePassengerDateOfBirth' => 'setAirlinePassengerDateOfBirth', 'airlinePassengerFirstName' => 'setAirlinePassengerFirstName', 'airlinePassengerLastName' => 'setAirlinePassengerLastName', - 'airlinePassengerTelephoneNumber' => 'setAirlinePassengerTelephoneNumber', + 'airlinePassengerPhoneNumber' => 'setAirlinePassengerPhoneNumber', 'airlinePassengerTravellerType' => 'setAirlinePassengerTravellerType', 'airlinePassengerName' => 'setAirlinePassengerName', 'airlineTicketIssueAddress' => 'setAirlineTicketIssueAddress', @@ -333,7 +333,7 @@ public function isNullableSetToNull(string $property): bool 'airlinePassengerDateOfBirth' => 'getAirlinePassengerDateOfBirth', 'airlinePassengerFirstName' => 'getAirlinePassengerFirstName', 'airlinePassengerLastName' => 'getAirlinePassengerLastName', - 'airlinePassengerTelephoneNumber' => 'getAirlinePassengerTelephoneNumber', + 'airlinePassengerPhoneNumber' => 'getAirlinePassengerPhoneNumber', 'airlinePassengerTravellerType' => 'getAirlinePassengerTravellerType', 'airlinePassengerName' => 'getAirlinePassengerName', 'airlineTicketIssueAddress' => 'getAirlineTicketIssueAddress', @@ -421,7 +421,7 @@ public function __construct(array $data = null) $this->setIfExists('airlinePassengerDateOfBirth', $data ?? [], null); $this->setIfExists('airlinePassengerFirstName', $data ?? [], null); $this->setIfExists('airlinePassengerLastName', $data ?? [], null); - $this->setIfExists('airlinePassengerTelephoneNumber', $data ?? [], null); + $this->setIfExists('airlinePassengerPhoneNumber', $data ?? [], null); $this->setIfExists('airlinePassengerTravellerType', $data ?? [], null); $this->setIfExists('airlinePassengerName', $data ?? [], null); $this->setIfExists('airlineTicketIssueAddress', $data ?? [], null); @@ -1004,25 +1004,25 @@ public function setAirlinePassengerLastName($airlinePassengerLastName) } /** - * Gets airlinePassengerTelephoneNumber + * Gets airlinePassengerPhoneNumber * * @return string|null */ - public function getAirlinePassengerTelephoneNumber() + public function getAirlinePassengerPhoneNumber() { - return $this->container['airlinePassengerTelephoneNumber']; + return $this->container['airlinePassengerPhoneNumber']; } /** - * Sets airlinePassengerTelephoneNumber + * Sets airlinePassengerPhoneNumber * - * @param string|null $airlinePassengerTelephoneNumber The passenger's telephone number, including country code. This is an alphanumeric field that can include the '+' and '-' signs. * Encoding: ASCII * minLength: 3 characters * maxLength: 30 characters + * @param string|null $airlinePassengerPhoneNumber The passenger's phone number, including country code. This is an alphanumeric field that can include the '+' and '-' signs. * Encoding: ASCII * minLength: 3 characters * maxLength: 30 characters * * @return self */ - public function setAirlinePassengerTelephoneNumber($airlinePassengerTelephoneNumber) + public function setAirlinePassengerPhoneNumber($airlinePassengerPhoneNumber) { - $this->container['airlinePassengerTelephoneNumber'] = $airlinePassengerTelephoneNumber; + $this->container['airlinePassengerPhoneNumber'] = $airlinePassengerPhoneNumber; return $this; } diff --git a/src/Adyen/Model/Checkout/AdditionalDataCommon.php b/src/Adyen/Model/Checkout/AdditionalDataCommon.php index ccdc7c1f..f635b951 100644 --- a/src/Adyen/Model/Checkout/AdditionalDataCommon.php +++ b/src/Adyen/Model/Checkout/AdditionalDataCommon.php @@ -47,9 +47,11 @@ class AdditionalDataCommon implements ModelInterface, ArrayAccess, \JsonSerializ 'requestedTestErrorResponseCode' => 'string', 'allowPartialAuth' => 'string', 'authorisationType' => 'string', + 'autoRescue' => 'string', 'customRoutingFlag' => 'string', 'industryUsage' => 'string', 'manualCapture' => 'string', + 'maxDaysToRescue' => 'string', 'networkTxReference' => 'string', 'overwriteBrand' => 'string', 'subMerchantCity' => 'string', @@ -73,9 +75,11 @@ class AdditionalDataCommon implements ModelInterface, ArrayAccess, \JsonSerializ 'requestedTestErrorResponseCode' => null, 'allowPartialAuth' => null, 'authorisationType' => null, + 'autoRescue' => null, 'customRoutingFlag' => null, 'industryUsage' => null, 'manualCapture' => null, + 'maxDaysToRescue' => null, 'networkTxReference' => null, 'overwriteBrand' => null, 'subMerchantCity' => null, @@ -97,9 +101,11 @@ class AdditionalDataCommon implements ModelInterface, ArrayAccess, \JsonSerializ 'requestedTestErrorResponseCode' => false, 'allowPartialAuth' => false, 'authorisationType' => false, + 'autoRescue' => false, 'customRoutingFlag' => false, 'industryUsage' => false, 'manualCapture' => false, + 'maxDaysToRescue' => false, 'networkTxReference' => false, 'overwriteBrand' => false, 'subMerchantCity' => false, @@ -201,9 +207,11 @@ public function isNullableSetToNull(string $property): bool 'requestedTestErrorResponseCode' => 'RequestedTestErrorResponseCode', 'allowPartialAuth' => 'allowPartialAuth', 'authorisationType' => 'authorisationType', + 'autoRescue' => 'autoRescue', 'customRoutingFlag' => 'customRoutingFlag', 'industryUsage' => 'industryUsage', 'manualCapture' => 'manualCapture', + 'maxDaysToRescue' => 'maxDaysToRescue', 'networkTxReference' => 'networkTxReference', 'overwriteBrand' => 'overwriteBrand', 'subMerchantCity' => 'subMerchantCity', @@ -225,9 +233,11 @@ public function isNullableSetToNull(string $property): bool 'requestedTestErrorResponseCode' => 'setRequestedTestErrorResponseCode', 'allowPartialAuth' => 'setAllowPartialAuth', 'authorisationType' => 'setAuthorisationType', + 'autoRescue' => 'setAutoRescue', 'customRoutingFlag' => 'setCustomRoutingFlag', 'industryUsage' => 'setIndustryUsage', 'manualCapture' => 'setManualCapture', + 'maxDaysToRescue' => 'setMaxDaysToRescue', 'networkTxReference' => 'setNetworkTxReference', 'overwriteBrand' => 'setOverwriteBrand', 'subMerchantCity' => 'setSubMerchantCity', @@ -249,9 +259,11 @@ public function isNullableSetToNull(string $property): bool 'requestedTestErrorResponseCode' => 'getRequestedTestErrorResponseCode', 'allowPartialAuth' => 'getAllowPartialAuth', 'authorisationType' => 'getAuthorisationType', + 'autoRescue' => 'getAutoRescue', 'customRoutingFlag' => 'getCustomRoutingFlag', 'industryUsage' => 'getIndustryUsage', 'manualCapture' => 'getManualCapture', + 'maxDaysToRescue' => 'getMaxDaysToRescue', 'networkTxReference' => 'getNetworkTxReference', 'overwriteBrand' => 'getOverwriteBrand', 'subMerchantCity' => 'getSubMerchantCity', @@ -338,9 +350,11 @@ public function __construct(array $data = null) $this->setIfExists('requestedTestErrorResponseCode', $data ?? [], null); $this->setIfExists('allowPartialAuth', $data ?? [], null); $this->setIfExists('authorisationType', $data ?? [], null); + $this->setIfExists('autoRescue', $data ?? [], null); $this->setIfExists('customRoutingFlag', $data ?? [], null); $this->setIfExists('industryUsage', $data ?? [], null); $this->setIfExists('manualCapture', $data ?? [], null); + $this->setIfExists('maxDaysToRescue', $data ?? [], null); $this->setIfExists('networkTxReference', $data ?? [], null); $this->setIfExists('overwriteBrand', $data ?? [], null); $this->setIfExists('subMerchantCity', $data ?? [], null); @@ -476,6 +490,30 @@ public function setAuthorisationType($authorisationType) return $this; } + /** + * Gets autoRescue + * + * @return string|null + */ + public function getAutoRescue() + { + return $this->container['autoRescue']; + } + + /** + * Sets autoRescue + * + * @param string|null $autoRescue Set to **true** to enable [Auto Rescue](https://docs.adyen.com/online-payments/auto-rescue/) for a transaction. Use the `maxDaysToRescue` to specify a rescue window. + * + * @return self + */ + public function setAutoRescue($autoRescue) + { + $this->container['autoRescue'] = $autoRescue; + + return $this; + } + /** * Gets customRoutingFlag * @@ -558,6 +596,30 @@ public function setManualCapture($manualCapture) return $this; } + /** + * Gets maxDaysToRescue + * + * @return string|null + */ + public function getMaxDaysToRescue() + { + return $this->container['maxDaysToRescue']; + } + + /** + * Sets maxDaysToRescue + * + * @param string|null $maxDaysToRescue The rescue window for a transaction, in days, when `autoRescue` is set to **true**. You can specify a value between 1 and 48. * For [cards](https://docs.adyen.com/online-payments/auto-rescue/cards/), the default is one calendar month. * For [SEPA](https://docs.adyen.com/online-payments/auto-rescue/sepa/), the default is 42 days. + * + * @return self + */ + public function setMaxDaysToRescue($maxDaysToRescue) + { + $this->container['maxDaysToRescue'] = $maxDaysToRescue; + + return $this; + } + /** * Gets networkTxReference * diff --git a/src/Adyen/Model/Checkout/AffirmDetails.php b/src/Adyen/Model/Checkout/AffirmDetails.php new file mode 100644 index 00000000..e21bb8ae --- /dev/null +++ b/src/Adyen/Model/Checkout/AffirmDetails.php @@ -0,0 +1,469 @@ + + */ +class AffirmDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AffirmDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'checkoutAttemptId' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'checkoutAttemptId' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'checkoutAttemptId' => 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 = [ + 'checkoutAttemptId' => 'checkoutAttemptId', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'checkoutAttemptId' => 'setCheckoutAttemptId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'checkoutAttemptId' => 'getCheckoutAttemptId', + '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; + } + + /** + * 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 const TYPE_AFFIRM = 'affirm'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AFFIRM, + ]; + } + /** + * 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('checkoutAttemptId', $data ?? [], null); + $this->setIfExists('type', $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 = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets checkoutAttemptId + * + * @return string|null + */ + public function getCheckoutAttemptId() + { + return $this->container['checkoutAttemptId']; + } + + /** + * Sets checkoutAttemptId + * + * @param string|null $checkoutAttemptId The checkout attempt identifier. + * + * @return self + */ + public function setCheckoutAttemptId($checkoutAttemptId) + { + $this->container['checkoutAttemptId'] = $checkoutAttemptId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type **affirm** + * + * @return self + */ + public function setType($type) + { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $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; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/src/Adyen/Model/Checkout/PayPayDetails.php b/src/Adyen/Model/Checkout/PayPayDetails.php new file mode 100644 index 00000000..dd63f12d --- /dev/null +++ b/src/Adyen/Model/Checkout/PayPayDetails.php @@ -0,0 +1,533 @@ + + */ +class PayPayDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PayPayDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'checkoutAttemptId' => 'string', + 'recurringDetailReference' => 'string', + 'storedPaymentMethodId' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'checkoutAttemptId' => null, + 'recurringDetailReference' => null, + 'storedPaymentMethodId' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'checkoutAttemptId' => false, + 'recurringDetailReference' => false, + 'storedPaymentMethodId' => 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 = [ + 'checkoutAttemptId' => 'checkoutAttemptId', + 'recurringDetailReference' => 'recurringDetailReference', + 'storedPaymentMethodId' => 'storedPaymentMethodId', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'checkoutAttemptId' => 'setCheckoutAttemptId', + 'recurringDetailReference' => 'setRecurringDetailReference', + 'storedPaymentMethodId' => 'setStoredPaymentMethodId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'checkoutAttemptId' => 'getCheckoutAttemptId', + 'recurringDetailReference' => 'getRecurringDetailReference', + 'storedPaymentMethodId' => 'getStoredPaymentMethodId', + '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; + } + + /** + * 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 const TYPE_PAYPAY = 'paypay'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PAYPAY, + ]; + } + /** + * 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('checkoutAttemptId', $data ?? [], null); + $this->setIfExists('recurringDetailReference', $data ?? [], null); + $this->setIfExists('storedPaymentMethodId', $data ?? [], null); + $this->setIfExists('type', $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 = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets checkoutAttemptId + * + * @return string|null + */ + public function getCheckoutAttemptId() + { + return $this->container['checkoutAttemptId']; + } + + /** + * Sets checkoutAttemptId + * + * @param string|null $checkoutAttemptId The checkout attempt identifier. + * + * @return self + */ + public function setCheckoutAttemptId($checkoutAttemptId) + { + $this->container['checkoutAttemptId'] = $checkoutAttemptId; + + return $this; + } + + /** + * Gets recurringDetailReference + * + * @return string|null + * @deprecated + */ + public function getRecurringDetailReference() + { + return $this->container['recurringDetailReference']; + } + + /** + * Sets recurringDetailReference + * + * @param string|null $recurringDetailReference This is the `recurringDetailReference` returned in the response when you created the token. + * + * @return self + * @deprecated + */ + public function setRecurringDetailReference($recurringDetailReference) + { + $this->container['recurringDetailReference'] = $recurringDetailReference; + + return $this; + } + + /** + * Gets storedPaymentMethodId + * + * @return string|null + */ + public function getStoredPaymentMethodId() + { + return $this->container['storedPaymentMethodId']; + } + + /** + * Sets storedPaymentMethodId + * + * @param string|null $storedPaymentMethodId This is the `recurringDetailReference` returned in the response when you created the token. + * + * @return self + */ + public function setStoredPaymentMethodId($storedPaymentMethodId) + { + $this->container['storedPaymentMethodId'] = $storedPaymentMethodId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type **paypay** + * + * @return self + */ + public function setType($type) + { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $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; + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} diff --git a/src/Adyen/Model/Checkout/PaymentDetails.php b/src/Adyen/Model/Checkout/PaymentDetails.php index 4e6ad821..e8a9b81c 100644 --- a/src/Adyen/Model/Checkout/PaymentDetails.php +++ b/src/Adyen/Model/Checkout/PaymentDetails.php @@ -226,7 +226,6 @@ public function getModelName() public const TYPE_BANK_TRANSFER_IBAN = 'bankTransfer_IBAN'; public const TYPE_PAYBRIGHT = 'paybright'; public const TYPE_PAYNOW = 'paynow'; - public const TYPE_AFFIRM = 'affirm'; public const TYPE_AFFIRM_POS = 'affirm_pos'; public const TYPE_TRUSTLY = 'trustly'; public const TYPE_TRUSTLYVECTOR = 'trustlyvector'; @@ -325,7 +324,6 @@ public function getTypeAllowableValues() self::TYPE_BANK_TRANSFER_IBAN, self::TYPE_PAYBRIGHT, self::TYPE_PAYNOW, - self::TYPE_AFFIRM, self::TYPE_AFFIRM_POS, self::TYPE_TRUSTLY, self::TYPE_TRUSTLYVECTOR, diff --git a/src/Adyen/Model/Payments/AdditionalDataCommon.php b/src/Adyen/Model/Payments/AdditionalDataCommon.php index 5f997bb3..5c8301cb 100644 --- a/src/Adyen/Model/Payments/AdditionalDataCommon.php +++ b/src/Adyen/Model/Payments/AdditionalDataCommon.php @@ -47,9 +47,11 @@ class AdditionalDataCommon implements ModelInterface, ArrayAccess, \JsonSerializ 'requestedTestErrorResponseCode' => 'string', 'allowPartialAuth' => 'string', 'authorisationType' => 'string', + 'autoRescue' => 'string', 'customRoutingFlag' => 'string', 'industryUsage' => 'string', 'manualCapture' => 'string', + 'maxDaysToRescue' => 'string', 'networkTxReference' => 'string', 'overwriteBrand' => 'string', 'subMerchantCity' => 'string', @@ -73,9 +75,11 @@ class AdditionalDataCommon implements ModelInterface, ArrayAccess, \JsonSerializ 'requestedTestErrorResponseCode' => null, 'allowPartialAuth' => null, 'authorisationType' => null, + 'autoRescue' => null, 'customRoutingFlag' => null, 'industryUsage' => null, 'manualCapture' => null, + 'maxDaysToRescue' => null, 'networkTxReference' => null, 'overwriteBrand' => null, 'subMerchantCity' => null, @@ -97,9 +101,11 @@ class AdditionalDataCommon implements ModelInterface, ArrayAccess, \JsonSerializ 'requestedTestErrorResponseCode' => false, 'allowPartialAuth' => false, 'authorisationType' => false, + 'autoRescue' => false, 'customRoutingFlag' => false, 'industryUsage' => false, 'manualCapture' => false, + 'maxDaysToRescue' => false, 'networkTxReference' => false, 'overwriteBrand' => false, 'subMerchantCity' => false, @@ -201,9 +207,11 @@ public function isNullableSetToNull(string $property): bool 'requestedTestErrorResponseCode' => 'RequestedTestErrorResponseCode', 'allowPartialAuth' => 'allowPartialAuth', 'authorisationType' => 'authorisationType', + 'autoRescue' => 'autoRescue', 'customRoutingFlag' => 'customRoutingFlag', 'industryUsage' => 'industryUsage', 'manualCapture' => 'manualCapture', + 'maxDaysToRescue' => 'maxDaysToRescue', 'networkTxReference' => 'networkTxReference', 'overwriteBrand' => 'overwriteBrand', 'subMerchantCity' => 'subMerchantCity', @@ -225,9 +233,11 @@ public function isNullableSetToNull(string $property): bool 'requestedTestErrorResponseCode' => 'setRequestedTestErrorResponseCode', 'allowPartialAuth' => 'setAllowPartialAuth', 'authorisationType' => 'setAuthorisationType', + 'autoRescue' => 'setAutoRescue', 'customRoutingFlag' => 'setCustomRoutingFlag', 'industryUsage' => 'setIndustryUsage', 'manualCapture' => 'setManualCapture', + 'maxDaysToRescue' => 'setMaxDaysToRescue', 'networkTxReference' => 'setNetworkTxReference', 'overwriteBrand' => 'setOverwriteBrand', 'subMerchantCity' => 'setSubMerchantCity', @@ -249,9 +259,11 @@ public function isNullableSetToNull(string $property): bool 'requestedTestErrorResponseCode' => 'getRequestedTestErrorResponseCode', 'allowPartialAuth' => 'getAllowPartialAuth', 'authorisationType' => 'getAuthorisationType', + 'autoRescue' => 'getAutoRescue', 'customRoutingFlag' => 'getCustomRoutingFlag', 'industryUsage' => 'getIndustryUsage', 'manualCapture' => 'getManualCapture', + 'maxDaysToRescue' => 'getMaxDaysToRescue', 'networkTxReference' => 'getNetworkTxReference', 'overwriteBrand' => 'getOverwriteBrand', 'subMerchantCity' => 'getSubMerchantCity', @@ -338,9 +350,11 @@ public function __construct(array $data = null) $this->setIfExists('requestedTestErrorResponseCode', $data ?? [], null); $this->setIfExists('allowPartialAuth', $data ?? [], null); $this->setIfExists('authorisationType', $data ?? [], null); + $this->setIfExists('autoRescue', $data ?? [], null); $this->setIfExists('customRoutingFlag', $data ?? [], null); $this->setIfExists('industryUsage', $data ?? [], null); $this->setIfExists('manualCapture', $data ?? [], null); + $this->setIfExists('maxDaysToRescue', $data ?? [], null); $this->setIfExists('networkTxReference', $data ?? [], null); $this->setIfExists('overwriteBrand', $data ?? [], null); $this->setIfExists('subMerchantCity', $data ?? [], null); @@ -476,6 +490,30 @@ public function setAuthorisationType($authorisationType) return $this; } + /** + * Gets autoRescue + * + * @return string|null + */ + public function getAutoRescue() + { + return $this->container['autoRescue']; + } + + /** + * Sets autoRescue + * + * @param string|null $autoRescue Set to **true** to enable [Auto Rescue](https://docs.adyen.com/online-payments/auto-rescue/) for a transaction. Use the `maxDaysToRescue` to specify a rescue window. + * + * @return self + */ + public function setAutoRescue($autoRescue) + { + $this->container['autoRescue'] = $autoRescue; + + return $this; + } + /** * Gets customRoutingFlag * @@ -558,6 +596,30 @@ public function setManualCapture($manualCapture) return $this; } + /** + * Gets maxDaysToRescue + * + * @return string|null + */ + public function getMaxDaysToRescue() + { + return $this->container['maxDaysToRescue']; + } + + /** + * Sets maxDaysToRescue + * + * @param string|null $maxDaysToRescue The rescue window for a transaction, in days, when `autoRescue` is set to **true**. You can specify a value between 1 and 48. * For [cards](https://docs.adyen.com/online-payments/auto-rescue/cards/), the default is one calendar month. * For [SEPA](https://docs.adyen.com/online-payments/auto-rescue/sepa/), the default is 42 days. + * + * @return self + */ + public function setMaxDaysToRescue($maxDaysToRescue) + { + $this->container['maxDaysToRescue'] = $maxDaysToRescue; + + return $this; + } + /** * Gets networkTxReference *