diff --git a/src/Adyen/Model/AcsWebhooks/ObjectSerializer.php b/src/Adyen/Model/AcsWebhooks/ObjectSerializer.php index 755ed1ce..e1442134 100644 --- a/src/Adyen/Model/AcsWebhooks/ObjectSerializer.php +++ b/src/Adyen/Model/AcsWebhooks/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/BalanceControl/ObjectSerializer.php b/src/Adyen/Model/BalanceControl/ObjectSerializer.php index b5ae3313..2ed0eb3a 100644 --- a/src/Adyen/Model/BalanceControl/ObjectSerializer.php +++ b/src/Adyen/Model/BalanceControl/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/BalancePlatform/CapabilitySettings.php b/src/Adyen/Model/BalancePlatform/CapabilitySettings.php index 67e88b5f..ada0db0b 100644 --- a/src/Adyen/Model/BalancePlatform/CapabilitySettings.php +++ b/src/Adyen/Model/BalancePlatform/CapabilitySettings.php @@ -358,7 +358,7 @@ public function getAmountPerIndustry() /** * Sets amountPerIndustry * - * @param array|null $amountPerIndustry + * @param array|null $amountPerIndustry * * @return self */ @@ -382,7 +382,7 @@ public function getAuthorizedCardUsers() /** * Sets authorizedCardUsers * - * @param bool|null $authorizedCardUsers + * @param bool|null $authorizedCardUsers * * @return self */ @@ -406,7 +406,7 @@ public function getFundingSource() /** * Sets fundingSource * - * @param string[]|null $fundingSource + * @param string[]|null $fundingSource * * @return self */ @@ -439,7 +439,7 @@ public function getInterval() /** * Sets interval * - * @param string|null $interval + * @param string|null $interval * * @return self */ diff --git a/src/Adyen/Model/BalancePlatform/ObjectSerializer.php b/src/Adyen/Model/BalancePlatform/ObjectSerializer.php index 141ec623..fa9af7e8 100644 --- a/src/Adyen/Model/BalancePlatform/ObjectSerializer.php +++ b/src/Adyen/Model/BalancePlatform/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/BinLookup/ObjectSerializer.php b/src/Adyen/Model/BinLookup/ObjectSerializer.php index 4bdfceed..09437b7d 100644 --- a/src/Adyen/Model/BinLookup/ObjectSerializer.php +++ b/src/Adyen/Model/BinLookup/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php b/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php index c5efe3d9..acea2bcf 100644 --- a/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php +++ b/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php @@ -731,7 +731,6 @@ public function listInvalidProperties() if ($this->container['issuer'] === null) { $invalidProperties[] = "'issuer' can't be null"; } - if ($this->container['firstName'] === null) { $invalidProperties[] = "'firstName' can't be null"; } @@ -1922,7 +1921,7 @@ public function getShopperEmail() /** * Sets shopperEmail * - * @param string $shopperEmail + * @param string $shopperEmail * * @return self */ @@ -1946,7 +1945,7 @@ public function getTelephoneNumber() /** * Sets telephoneNumber * - * @param string $telephoneNumber + * @param string $telephoneNumber * * @return self */ diff --git a/src/Adyen/Model/Checkout/EBankingFinlandDetails.php b/src/Adyen/Model/Checkout/EBankingFinlandDetails.php new file mode 100644 index 00000000..10b70226 --- /dev/null +++ b/src/Adyen/Model/Checkout/EBankingFinlandDetails.php @@ -0,0 +1,503 @@ + + */ +class EBankingFinlandDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EBankingFinlandDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'checkoutAttemptId' => 'string', + 'issuer' => '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, + 'issuer' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'checkoutAttemptId' => false, + 'issuer' => 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', + 'issuer' => 'issuer', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'checkoutAttemptId' => 'setCheckoutAttemptId', + 'issuer' => 'setIssuer', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'checkoutAttemptId' => 'getCheckoutAttemptId', + 'issuer' => 'getIssuer', + '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_EBANKING_FI = 'ebanking_FI'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_EBANKING_FI, + ]; + } + /** + * 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('issuer', $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 = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $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 issuer + * + * @return string|null + */ + public function getIssuer() + { + return $this->container['issuer']; + } + + /** + * Sets issuer + * + * @param string|null $issuer The Ebanking Finland issuer value of the shopper's selected bank. + * + * @return self + */ + public function setIssuer($issuer) + { + $this->container['issuer'] = $issuer; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type **ebanking_FI** + * + * @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/FundRecipient.php b/src/Adyen/Model/Checkout/FundRecipient.php index 5770a299..5a9ca982 100644 --- a/src/Adyen/Model/Checkout/FundRecipient.php +++ b/src/Adyen/Model/Checkout/FundRecipient.php @@ -395,7 +395,7 @@ public function getIBAN() /** * Sets iBAN * - * @param string|null $iBAN Fund Recipient Iban for C2C payments + * @param string|null $iBAN The IBAN of the bank account where the funds are being transferred to. * * @return self */ @@ -611,7 +611,7 @@ public function getWalletIdentifier() /** * Sets walletIdentifier * - * @param string|null $walletIdentifier Indicates where the money is going. + * @param string|null $walletIdentifier The unique identifier for the wallet the funds are being transferred to. You can use the shopper reference or any other identifier. * * @return self */ @@ -635,7 +635,7 @@ public function getWalletOwnerTaxId() /** * Sets walletOwnerTaxId * - * @param string|null $walletOwnerTaxId Indicates the tax identifier of the fund recipient + * @param string|null $walletOwnerTaxId The tax identifier of the person receiving the funds. * * @return self */ @@ -659,7 +659,7 @@ public function getWalletPurpose() /** * Sets walletPurpose * - * @param string|null $walletPurpose The purpose of a digital wallet transaction + * @param string|null $walletPurpose The purpose of a digital wallet transaction. * * @return self */ diff --git a/src/Adyen/Model/Checkout/Mandate.php b/src/Adyen/Model/Checkout/Mandate.php index 5d840846..a775ce98 100644 --- a/src/Adyen/Model/Checkout/Mandate.php +++ b/src/Adyen/Model/Checkout/Mandate.php @@ -601,7 +601,7 @@ public function getFrequency() /** * Sets frequency * - * @param string $frequency The frequency with which a shopper should be charged. Possible values: **daily**, **weekly**, **biWeekly**, **monthly**, **quarterly**, **halfYearly**, **yearly**. + * @param string $frequency The frequency with which a shopper should be charged. Possible values: **adhoc**, **daily**, **weekly**, **biWeekly**, **monthly**, **quarterly**, **halfYearly**, **yearly**. * * @return self */ diff --git a/src/Adyen/Model/Checkout/MbwayDetails.php b/src/Adyen/Model/Checkout/MbwayDetails.php index dc73d3c3..becc716f 100644 --- a/src/Adyen/Model/Checkout/MbwayDetails.php +++ b/src/Adyen/Model/Checkout/MbwayDetails.php @@ -361,7 +361,7 @@ public function getShopperEmail() /** * Sets shopperEmail * - * @param string $shopperEmail + * @param string $shopperEmail * * @return self */ @@ -385,7 +385,7 @@ public function getTelephoneNumber() /** * Sets telephoneNumber * - * @param string $telephoneNumber + * @param string $telephoneNumber * * @return self */ diff --git a/src/Adyen/Model/Checkout/ObjectSerializer.php b/src/Adyen/Model/Checkout/ObjectSerializer.php index 2b682c18..628f63ad 100644 --- a/src/Adyen/Model/Checkout/ObjectSerializer.php +++ b/src/Adyen/Model/Checkout/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Checkout/PayByBankAISDirectDebitDetails.php b/src/Adyen/Model/Checkout/PayByBankAISDirectDebitDetails.php new file mode 100644 index 00000000..98637c16 --- /dev/null +++ b/src/Adyen/Model/Checkout/PayByBankAISDirectDebitDetails.php @@ -0,0 +1,536 @@ + + */ +class PayByBankAISDirectDebitDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PayByBankAISDirectDebitDetails'; + + /** + * 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_PAYBYBANK_AIS_DD = 'paybybank_AIS_DD'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PAYBYBANK_AIS_DD, + ]; + } + /** + * 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 = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $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 + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type **paybybank_** + * + * @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 553c4914..4e6ad821 100644 --- a/src/Adyen/Model/Checkout/PaymentDetails.php +++ b/src/Adyen/Model/Checkout/PaymentDetails.php @@ -251,7 +251,6 @@ public function getModelName() public const TYPE_UPI_QR = 'upi_qr'; public const TYPE_PAYTM = 'paytm'; public const TYPE_MOLPAY_EBANKING_VN = 'molpay_ebanking_VN'; - public const TYPE_EBANKING_FI = 'ebanking_FI'; public const TYPE_MOLPAY_EBANKING_MY = 'molpay_ebanking_MY'; public const TYPE_MOLPAY_EBANKING_DIRECT_MY = 'molpay_ebanking_direct_MY'; public const TYPE_SWISH = 'swish'; @@ -351,7 +350,6 @@ public function getTypeAllowableValues() self::TYPE_UPI_QR, self::TYPE_PAYTM, self::TYPE_MOLPAY_EBANKING_VN, - self::TYPE_EBANKING_FI, self::TYPE_MOLPAY_EBANKING_MY, self::TYPE_MOLPAY_EBANKING_DIRECT_MY, self::TYPE_SWISH, diff --git a/src/Adyen/Model/Checkout/ResponseAdditionalDataCard.php b/src/Adyen/Model/Checkout/ResponseAdditionalDataCard.php index b8d97aae..57924260 100644 --- a/src/Adyen/Model/Checkout/ResponseAdditionalDataCard.php +++ b/src/Adyen/Model/Checkout/ResponseAdditionalDataCard.php @@ -50,6 +50,7 @@ class ResponseAdditionalDataCard implements ModelInterface, ArrayAccess, \JsonSe 'cardIssuingCountry' => 'string', 'cardIssuingCurrency' => 'string', 'cardPaymentMethod' => 'string', + 'cardProductId' => 'string', 'cardSummary' => 'string', 'issuerBin' => 'string' ]; @@ -68,6 +69,7 @@ class ResponseAdditionalDataCard implements ModelInterface, ArrayAccess, \JsonSe 'cardIssuingCountry' => null, 'cardIssuingCurrency' => null, 'cardPaymentMethod' => null, + 'cardProductId' => null, 'cardSummary' => null, 'issuerBin' => null ]; @@ -84,6 +86,7 @@ class ResponseAdditionalDataCard implements ModelInterface, ArrayAccess, \JsonSe 'cardIssuingCountry' => false, 'cardIssuingCurrency' => false, 'cardPaymentMethod' => false, + 'cardProductId' => false, 'cardSummary' => false, 'issuerBin' => false ]; @@ -180,6 +183,7 @@ public function isNullableSetToNull(string $property): bool 'cardIssuingCountry' => 'cardIssuingCountry', 'cardIssuingCurrency' => 'cardIssuingCurrency', 'cardPaymentMethod' => 'cardPaymentMethod', + 'cardProductId' => 'cardProductId', 'cardSummary' => 'cardSummary', 'issuerBin' => 'issuerBin' ]; @@ -196,6 +200,7 @@ public function isNullableSetToNull(string $property): bool 'cardIssuingCountry' => 'setCardIssuingCountry', 'cardIssuingCurrency' => 'setCardIssuingCurrency', 'cardPaymentMethod' => 'setCardPaymentMethod', + 'cardProductId' => 'setCardProductId', 'cardSummary' => 'setCardSummary', 'issuerBin' => 'setIssuerBin' ]; @@ -212,6 +217,7 @@ public function isNullableSetToNull(string $property): bool 'cardIssuingCountry' => 'getCardIssuingCountry', 'cardIssuingCurrency' => 'getCardIssuingCurrency', 'cardPaymentMethod' => 'getCardPaymentMethod', + 'cardProductId' => 'getCardProductId', 'cardSummary' => 'getCardSummary', 'issuerBin' => 'getIssuerBin' ]; @@ -257,7 +263,39 @@ public function getModelName() return self::$openAPIModelName; } + public const CARD_PRODUCT_ID_A = 'A'; + public const CARD_PRODUCT_ID_B = 'B'; + public const CARD_PRODUCT_ID_C = 'C'; + public const CARD_PRODUCT_ID_D = 'D'; + public const CARD_PRODUCT_ID_F = 'F'; + public const CARD_PRODUCT_ID_MCC = 'MCC'; + public const CARD_PRODUCT_ID_MCE = 'MCE'; + public const CARD_PRODUCT_ID_MCF = 'MCF'; + public const CARD_PRODUCT_ID_MCG = 'MCG'; + public const CARD_PRODUCT_ID_MCH = 'MCH'; + public const CARD_PRODUCT_ID_MCI = 'MCI'; + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCardProductIdAllowableValues() + { + return [ + self::CARD_PRODUCT_ID_A, + self::CARD_PRODUCT_ID_B, + self::CARD_PRODUCT_ID_C, + self::CARD_PRODUCT_ID_D, + self::CARD_PRODUCT_ID_F, + self::CARD_PRODUCT_ID_MCC, + self::CARD_PRODUCT_ID_MCE, + self::CARD_PRODUCT_ID_MCF, + self::CARD_PRODUCT_ID_MCG, + self::CARD_PRODUCT_ID_MCH, + self::CARD_PRODUCT_ID_MCI, + ]; + } /** * Associative array for storing property values * @@ -279,6 +317,7 @@ public function __construct(array $data = null) $this->setIfExists('cardIssuingCountry', $data ?? [], null); $this->setIfExists('cardIssuingCurrency', $data ?? [], null); $this->setIfExists('cardPaymentMethod', $data ?? [], null); + $this->setIfExists('cardProductId', $data ?? [], null); $this->setIfExists('cardSummary', $data ?? [], null); $this->setIfExists('issuerBin', $data ?? [], null); } @@ -310,6 +349,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getCardProductIdAllowableValues(); + if (!is_null($this->container['cardProductId']) && !in_array($this->container['cardProductId'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'cardProductId', must be one of '%s'", + $this->container['cardProductId'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -469,6 +517,40 @@ public function setCardPaymentMethod($cardPaymentMethod) return $this; } + /** + * Gets cardProductId + * + * @return string|null + */ + public function getCardProductId() + { + return $this->container['cardProductId']; + } + + /** + * Sets cardProductId + * + * @param string|null $cardProductId The Card Product ID represents the type of card following card scheme product definitions and can be returned for Adyen Acquiring service level payments. Possible values Visa: * **A** - Visa Traditional * **B** - Visa Traditional Rewards * **C** - Visa Signature * **D** - Visa Signature Preferred * **F** - Visa Classic Possible values Mastercard: * **MCC** - Mastercard Card * **MCE** - Mastercard Electronic Card * **MCF** - Mastercard Corporate Fleet Card * **MCG** - Gold Mastercard Card * **MCH** - Mastercard Premium Charge * **MCI** - Mastercard Select Debit + * + * @return self + */ + public function setCardProductId($cardProductId) + { + $allowedValues = $this->getCardProductIdAllowableValues(); + if (!in_array($cardProductId, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'cardProductId', must be one of '%s'", + $cardProductId, + implode("', '", $allowedValues) + ) + ); + } + $this->container['cardProductId'] = $cardProductId; + + return $this; + } + /** * Gets cardSummary * diff --git a/src/Adyen/Model/Checkout/StoredPaymentMethodDetails.php b/src/Adyen/Model/Checkout/StoredPaymentMethodDetails.php index bd930be5..39abd649 100644 --- a/src/Adyen/Model/Checkout/StoredPaymentMethodDetails.php +++ b/src/Adyen/Model/Checkout/StoredPaymentMethodDetails.php @@ -238,7 +238,6 @@ public function getModelName() public const TYPE_BCMC_MOBILE_APP = 'bcmc_mobile_app'; public const TYPE_MOMO_WALLET = 'momo_wallet'; public const TYPE_MOMO_WALLET_APP = 'momo_wallet_app'; - public const TYPE_TWINT = 'twint'; public const TYPE_PAYMAYA_WALLET = 'paymaya_wallet'; public const TYPE_GRABPAY_SG = 'grabpay_SG'; public const TYPE_GRABPAY_MY = 'grabpay_MY'; @@ -265,7 +264,6 @@ public function getTypeAllowableValues() self::TYPE_BCMC_MOBILE_APP, self::TYPE_MOMO_WALLET, self::TYPE_MOMO_WALLET_APP, - self::TYPE_TWINT, self::TYPE_PAYMAYA_WALLET, self::TYPE_GRABPAY_SG, self::TYPE_GRABPAY_MY, diff --git a/src/Adyen/Model/Checkout/ThreeDSRequestData.php b/src/Adyen/Model/Checkout/ThreeDSRequestData.php index 087c5ce5..eee0d257 100644 --- a/src/Adyen/Model/Checkout/ThreeDSRequestData.php +++ b/src/Adyen/Model/Checkout/ThreeDSRequestData.php @@ -241,6 +241,7 @@ public function getModelName() public const DATA_ONLY_FALSE = 'false'; public const DATA_ONLY_TRUE = 'true'; public const NATIVE_THREE_DS_PREFERRED = 'preferred'; + public const NATIVE_THREE_DS_DISABLED = 'disabled'; public const THREE_DS_VERSION__1_0 = '2.1.0'; public const THREE_DS_VERSION__2_0 = '2.2.0'; @@ -280,6 +281,7 @@ public function getNativeThreeDSAllowableValues() { return [ self::NATIVE_THREE_DS_PREFERRED, + self::NATIVE_THREE_DS_DISABLED, ]; } /** @@ -474,7 +476,7 @@ public function getNativeThreeDS() /** * Sets nativeThreeDS * - * @param string|null $nativeThreeDS Indicates if [native 3D Secure authentication](https://docs.adyen.com/online-payments/3d-secure/native-3ds2) should be used when available. Possible values: * **preferred**: Use native 3D Secure authentication when available. + * @param string|null $nativeThreeDS Indicates if [native 3D Secure authentication](https://docs.adyen.com/online-payments/3d-secure/native-3ds2) should be used when available. Possible values: * **preferred**: Use native 3D Secure authentication when available. * **disabled**: Only use the redirect 3D Secure authentication flow. * * @return self */ diff --git a/src/Adyen/Model/Checkout/TwintDetails.php b/src/Adyen/Model/Checkout/TwintDetails.php new file mode 100644 index 00000000..9617fb73 --- /dev/null +++ b/src/Adyen/Model/Checkout/TwintDetails.php @@ -0,0 +1,564 @@ + + */ +class TwintDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TwintDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'checkoutAttemptId' => 'string', + 'recurringDetailReference' => 'string', + 'storedPaymentMethodId' => 'string', + 'subtype' => '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, + 'subtype' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'checkoutAttemptId' => false, + 'recurringDetailReference' => false, + 'storedPaymentMethodId' => false, + 'subtype' => 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', + 'subtype' => 'subtype', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'checkoutAttemptId' => 'setCheckoutAttemptId', + 'recurringDetailReference' => 'setRecurringDetailReference', + 'storedPaymentMethodId' => 'setStoredPaymentMethodId', + 'subtype' => 'setSubtype', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'checkoutAttemptId' => 'getCheckoutAttemptId', + 'recurringDetailReference' => 'getRecurringDetailReference', + 'storedPaymentMethodId' => 'getStoredPaymentMethodId', + 'subtype' => 'getSubtype', + '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_TWINT = 'twint'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_TWINT, + ]; + } + /** + * 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('subtype', $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 subtype + * + * @return string|null + */ + public function getSubtype() + { + return $this->container['subtype']; + } + + /** + * Sets subtype + * + * @param string|null $subtype The type of flow to initiate. + * + * @return self + */ + public function setSubtype($subtype) + { + $this->container['subtype'] = $subtype; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The payment method type. + * + * @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/VippsDetails.php b/src/Adyen/Model/Checkout/VippsDetails.php index 6787fd03..a5087a92 100644 --- a/src/Adyen/Model/Checkout/VippsDetails.php +++ b/src/Adyen/Model/Checkout/VippsDetails.php @@ -415,7 +415,7 @@ public function getTelephoneNumber() /** * Sets telephoneNumber * - * @param string $telephoneNumber + * @param string $telephoneNumber * * @return self */ diff --git a/src/Adyen/Model/ConfigurationWebhooks/CapabilitySettings.php b/src/Adyen/Model/ConfigurationWebhooks/CapabilitySettings.php index 77bba385..478ff891 100644 --- a/src/Adyen/Model/ConfigurationWebhooks/CapabilitySettings.php +++ b/src/Adyen/Model/ConfigurationWebhooks/CapabilitySettings.php @@ -358,7 +358,7 @@ public function getAmountPerIndustry() /** * Sets amountPerIndustry * - * @param array|null $amountPerIndustry + * @param array|null $amountPerIndustry * * @return self */ @@ -382,7 +382,7 @@ public function getAuthorizedCardUsers() /** * Sets authorizedCardUsers * - * @param bool|null $authorizedCardUsers + * @param bool|null $authorizedCardUsers * * @return self */ @@ -406,7 +406,7 @@ public function getFundingSource() /** * Sets fundingSource * - * @param string[]|null $fundingSource + * @param string[]|null $fundingSource * * @return self */ @@ -439,7 +439,7 @@ public function getInterval() /** * Sets interval * - * @param string|null $interval + * @param string|null $interval * * @return self */ diff --git a/src/Adyen/Model/ConfigurationWebhooks/ObjectSerializer.php b/src/Adyen/Model/ConfigurationWebhooks/ObjectSerializer.php index 6629bee4..2d912cd5 100644 --- a/src/Adyen/Model/ConfigurationWebhooks/ObjectSerializer.php +++ b/src/Adyen/Model/ConfigurationWebhooks/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/DataProtection/ObjectSerializer.php b/src/Adyen/Model/DataProtection/ObjectSerializer.php index 1b86733a..fe849181 100644 --- a/src/Adyen/Model/DataProtection/ObjectSerializer.php +++ b/src/Adyen/Model/DataProtection/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Disputes/ObjectSerializer.php b/src/Adyen/Model/Disputes/ObjectSerializer.php index 5ef9f66a..d363f9e2 100644 --- a/src/Adyen/Model/Disputes/ObjectSerializer.php +++ b/src/Adyen/Model/Disputes/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/LegalEntityManagement/AcceptTermsOfServiceResponse.php b/src/Adyen/Model/LegalEntityManagement/AcceptTermsOfServiceResponse.php index e8b62d04..bbc1c41a 100644 --- a/src/Adyen/Model/LegalEntityManagement/AcceptTermsOfServiceResponse.php +++ b/src/Adyen/Model/LegalEntityManagement/AcceptTermsOfServiceResponse.php @@ -248,6 +248,7 @@ public function getModelName() public const TYPE_ADYEN_ACCOUNT = 'adyenAccount'; public const TYPE_ADYEN_CAPITAL = 'adyenCapital'; public const TYPE_ADYEN_CARD = 'adyenCard'; + public const TYPE_ADYEN_CHARGE_CARD = 'adyenChargeCard'; public const TYPE_ADYEN_FOR_PLATFORMS_ADVANCED = 'adyenForPlatformsAdvanced'; public const TYPE_ADYEN_FOR_PLATFORMS_MANAGE = 'adyenForPlatformsManage'; public const TYPE_ADYEN_FRANCHISEE = 'adyenFranchisee'; @@ -265,6 +266,7 @@ public function getTypeAllowableValues() self::TYPE_ADYEN_ACCOUNT, self::TYPE_ADYEN_CAPITAL, self::TYPE_ADYEN_CARD, + self::TYPE_ADYEN_CHARGE_CARD, self::TYPE_ADYEN_FOR_PLATFORMS_ADVANCED, self::TYPE_ADYEN_FOR_PLATFORMS_MANAGE, self::TYPE_ADYEN_FRANCHISEE, @@ -479,7 +481,7 @@ public function getType() /** * Sets type * - * @param string|null $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** + * @param string|null $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** * **adyenChargeCard** * * @return self */ diff --git a/src/Adyen/Model/LegalEntityManagement/CalculateTermsOfServiceStatusResponse.php b/src/Adyen/Model/LegalEntityManagement/CalculateTermsOfServiceStatusResponse.php index 58430085..ff6c690f 100644 --- a/src/Adyen/Model/LegalEntityManagement/CalculateTermsOfServiceStatusResponse.php +++ b/src/Adyen/Model/LegalEntityManagement/CalculateTermsOfServiceStatusResponse.php @@ -218,6 +218,7 @@ public function getModelName() public const TERMS_OF_SERVICE_TYPES_ADYEN_ACCOUNT = 'adyenAccount'; public const TERMS_OF_SERVICE_TYPES_ADYEN_CAPITAL = 'adyenCapital'; public const TERMS_OF_SERVICE_TYPES_ADYEN_CARD = 'adyenCard'; + public const TERMS_OF_SERVICE_TYPES_ADYEN_CHARGE_CARD = 'adyenChargeCard'; public const TERMS_OF_SERVICE_TYPES_ADYEN_FOR_PLATFORMS_ADVANCED = 'adyenForPlatformsAdvanced'; public const TERMS_OF_SERVICE_TYPES_ADYEN_FOR_PLATFORMS_MANAGE = 'adyenForPlatformsManage'; public const TERMS_OF_SERVICE_TYPES_ADYEN_FRANCHISEE = 'adyenFranchisee'; @@ -235,6 +236,7 @@ public function getTermsOfServiceTypesAllowableValues() self::TERMS_OF_SERVICE_TYPES_ADYEN_ACCOUNT, self::TERMS_OF_SERVICE_TYPES_ADYEN_CAPITAL, self::TERMS_OF_SERVICE_TYPES_ADYEN_CARD, + self::TERMS_OF_SERVICE_TYPES_ADYEN_CHARGE_CARD, self::TERMS_OF_SERVICE_TYPES_ADYEN_FOR_PLATFORMS_ADVANCED, self::TERMS_OF_SERVICE_TYPES_ADYEN_FOR_PLATFORMS_MANAGE, self::TERMS_OF_SERVICE_TYPES_ADYEN_FRANCHISEE, diff --git a/src/Adyen/Model/LegalEntityManagement/GetAcceptedTermsOfServiceDocumentResponse.php b/src/Adyen/Model/LegalEntityManagement/GetAcceptedTermsOfServiceDocumentResponse.php new file mode 100644 index 00000000..8c596499 --- /dev/null +++ b/src/Adyen/Model/LegalEntityManagement/GetAcceptedTermsOfServiceDocumentResponse.php @@ -0,0 +1,535 @@ + + */ +class GetAcceptedTermsOfServiceDocumentResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GetAcceptedTermsOfServiceDocumentResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'document' => 'string', + 'id' => 'string', + 'termsOfServiceAcceptanceReference' => 'string', + 'termsOfServiceDocumentFormat' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'document' => 'byte', + 'id' => null, + 'termsOfServiceAcceptanceReference' => null, + 'termsOfServiceDocumentFormat' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'document' => false, + 'id' => false, + 'termsOfServiceAcceptanceReference' => false, + 'termsOfServiceDocumentFormat' => 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 = [ + 'document' => 'document', + 'id' => 'id', + 'termsOfServiceAcceptanceReference' => 'termsOfServiceAcceptanceReference', + 'termsOfServiceDocumentFormat' => 'termsOfServiceDocumentFormat' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'document' => 'setDocument', + 'id' => 'setId', + 'termsOfServiceAcceptanceReference' => 'setTermsOfServiceAcceptanceReference', + 'termsOfServiceDocumentFormat' => 'setTermsOfServiceDocumentFormat' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'document' => 'getDocument', + 'id' => 'getId', + 'termsOfServiceAcceptanceReference' => 'getTermsOfServiceAcceptanceReference', + 'termsOfServiceDocumentFormat' => 'getTermsOfServiceDocumentFormat' + ]; + + /** + * 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 TERMS_OF_SERVICE_DOCUMENT_FORMAT_JSON = 'JSON'; + public const TERMS_OF_SERVICE_DOCUMENT_FORMAT_PDF = 'PDF'; + public const TERMS_OF_SERVICE_DOCUMENT_FORMAT_TXT = 'TXT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTermsOfServiceDocumentFormatAllowableValues() + { + return [ + self::TERMS_OF_SERVICE_DOCUMENT_FORMAT_JSON, + self::TERMS_OF_SERVICE_DOCUMENT_FORMAT_PDF, + self::TERMS_OF_SERVICE_DOCUMENT_FORMAT_TXT, + ]; + } + /** + * 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('document', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('termsOfServiceAcceptanceReference', $data ?? [], null); + $this->setIfExists('termsOfServiceDocumentFormat', $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->getTermsOfServiceDocumentFormatAllowableValues(); + if (!is_null($this->container['termsOfServiceDocumentFormat']) && !in_array($this->container['termsOfServiceDocumentFormat'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'termsOfServiceDocumentFormat', must be one of '%s'", + $this->container['termsOfServiceDocumentFormat'], + 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 document + * + * @return string|null + */ + public function getDocument() + { + return $this->container['document']; + } + + /** + * Sets document + * + * @param string|null $document The accepted Terms of Service document in the requested format represented as a Base64-encoded bytes array. + * + * @return self + */ + public function setDocument($document) + { + $this->container['document'] = $document; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier of the legal entity. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets termsOfServiceAcceptanceReference + * + * @return string|null + */ + public function getTermsOfServiceAcceptanceReference() + { + return $this->container['termsOfServiceAcceptanceReference']; + } + + /** + * Sets termsOfServiceAcceptanceReference + * + * @param string|null $termsOfServiceAcceptanceReference An Adyen-generated reference for the accepted Terms of Service. + * + * @return self + */ + public function setTermsOfServiceAcceptanceReference($termsOfServiceAcceptanceReference) + { + $this->container['termsOfServiceAcceptanceReference'] = $termsOfServiceAcceptanceReference; + + return $this; + } + + /** + * Gets termsOfServiceDocumentFormat + * + * @return string|null + */ + public function getTermsOfServiceDocumentFormat() + { + return $this->container['termsOfServiceDocumentFormat']; + } + + /** + * Sets termsOfServiceDocumentFormat + * + * @param string|null $termsOfServiceDocumentFormat The format of the Terms of Service document. + * + * @return self + */ + public function setTermsOfServiceDocumentFormat($termsOfServiceDocumentFormat) + { + $allowedValues = $this->getTermsOfServiceDocumentFormatAllowableValues(); + if (!in_array($termsOfServiceDocumentFormat, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'termsOfServiceDocumentFormat', must be one of '%s'", + $termsOfServiceDocumentFormat, + implode("', '", $allowedValues) + ) + ); + } + $this->container['termsOfServiceDocumentFormat'] = $termsOfServiceDocumentFormat; + + 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/LegalEntityManagement/GetTermsOfServiceDocumentRequest.php b/src/Adyen/Model/LegalEntityManagement/GetTermsOfServiceDocumentRequest.php index 62554d91..4b5a104d 100644 --- a/src/Adyen/Model/LegalEntityManagement/GetTermsOfServiceDocumentRequest.php +++ b/src/Adyen/Model/LegalEntityManagement/GetTermsOfServiceDocumentRequest.php @@ -230,6 +230,7 @@ public function getModelName() public const TYPE_ADYEN_ACCOUNT = 'adyenAccount'; public const TYPE_ADYEN_CAPITAL = 'adyenCapital'; public const TYPE_ADYEN_CARD = 'adyenCard'; + public const TYPE_ADYEN_CHARGE_CARD = 'adyenChargeCard'; public const TYPE_ADYEN_FOR_PLATFORMS_ADVANCED = 'adyenForPlatformsAdvanced'; public const TYPE_ADYEN_FOR_PLATFORMS_MANAGE = 'adyenForPlatformsManage'; public const TYPE_ADYEN_FRANCHISEE = 'adyenFranchisee'; @@ -247,6 +248,7 @@ public function getTypeAllowableValues() self::TYPE_ADYEN_ACCOUNT, self::TYPE_ADYEN_CAPITAL, self::TYPE_ADYEN_CARD, + self::TYPE_ADYEN_CHARGE_CARD, self::TYPE_ADYEN_FOR_PLATFORMS_ADVANCED, self::TYPE_ADYEN_FOR_PLATFORMS_MANAGE, self::TYPE_ADYEN_FRANCHISEE, @@ -392,7 +394,7 @@ public function getType() /** * Sets type * - * @param string $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** + * @param string $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** * **adyenChargeCard** * * @return self */ diff --git a/src/Adyen/Model/LegalEntityManagement/GetTermsOfServiceDocumentResponse.php b/src/Adyen/Model/LegalEntityManagement/GetTermsOfServiceDocumentResponse.php index 990a5f4e..d7e1d261 100644 --- a/src/Adyen/Model/LegalEntityManagement/GetTermsOfServiceDocumentResponse.php +++ b/src/Adyen/Model/LegalEntityManagement/GetTermsOfServiceDocumentResponse.php @@ -248,6 +248,7 @@ public function getModelName() public const TYPE_ADYEN_ACCOUNT = 'adyenAccount'; public const TYPE_ADYEN_CAPITAL = 'adyenCapital'; public const TYPE_ADYEN_CARD = 'adyenCard'; + public const TYPE_ADYEN_CHARGE_CARD = 'adyenChargeCard'; public const TYPE_ADYEN_FOR_PLATFORMS_ADVANCED = 'adyenForPlatformsAdvanced'; public const TYPE_ADYEN_FOR_PLATFORMS_MANAGE = 'adyenForPlatformsManage'; public const TYPE_ADYEN_FRANCHISEE = 'adyenFranchisee'; @@ -265,6 +266,7 @@ public function getTypeAllowableValues() self::TYPE_ADYEN_ACCOUNT, self::TYPE_ADYEN_CAPITAL, self::TYPE_ADYEN_CARD, + self::TYPE_ADYEN_CHARGE_CARD, self::TYPE_ADYEN_FOR_PLATFORMS_ADVANCED, self::TYPE_ADYEN_FOR_PLATFORMS_MANAGE, self::TYPE_ADYEN_FRANCHISEE, @@ -479,7 +481,7 @@ public function getType() /** * Sets type * - * @param string|null $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** + * @param string|null $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** * **adyenChargeCard** * * @return self */ diff --git a/src/Adyen/Model/LegalEntityManagement/ObjectSerializer.php b/src/Adyen/Model/LegalEntityManagement/ObjectSerializer.php index d25ad19d..66642b91 100644 --- a/src/Adyen/Model/LegalEntityManagement/ObjectSerializer.php +++ b/src/Adyen/Model/LegalEntityManagement/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/LegalEntityManagement/TermsOfServiceAcceptanceInfo.php b/src/Adyen/Model/LegalEntityManagement/TermsOfServiceAcceptanceInfo.php index c124af25..d0f7d5d9 100644 --- a/src/Adyen/Model/LegalEntityManagement/TermsOfServiceAcceptanceInfo.php +++ b/src/Adyen/Model/LegalEntityManagement/TermsOfServiceAcceptanceInfo.php @@ -242,6 +242,7 @@ public function getModelName() public const TYPE_ADYEN_ACCOUNT = 'adyenAccount'; public const TYPE_ADYEN_CAPITAL = 'adyenCapital'; public const TYPE_ADYEN_CARD = 'adyenCard'; + public const TYPE_ADYEN_CHARGE_CARD = 'adyenChargeCard'; public const TYPE_ADYEN_FOR_PLATFORMS_ADVANCED = 'adyenForPlatformsAdvanced'; public const TYPE_ADYEN_FOR_PLATFORMS_MANAGE = 'adyenForPlatformsManage'; public const TYPE_ADYEN_FRANCHISEE = 'adyenFranchisee'; @@ -259,6 +260,7 @@ public function getTypeAllowableValues() self::TYPE_ADYEN_ACCOUNT, self::TYPE_ADYEN_CAPITAL, self::TYPE_ADYEN_CARD, + self::TYPE_ADYEN_CHARGE_CARD, self::TYPE_ADYEN_FOR_PLATFORMS_ADVANCED, self::TYPE_ADYEN_FOR_PLATFORMS_MANAGE, self::TYPE_ADYEN_FRANCHISEE, @@ -448,7 +450,7 @@ public function getType() /** * Sets type * - * @param string|null $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** + * @param string|null $type The type of Terms of Service. Possible values: * **adyenForPlatformsManage** * **adyenIssuing** * **adyenForPlatformsAdvanced** * **adyenCapital** * **adyenAccount** * **adyenCard** * **adyenFranchisee** * **adyenPccr** * **adyenChargeCard** * * @return self */ diff --git a/src/Adyen/Model/Management/ObjectSerializer.php b/src/Adyen/Model/Management/ObjectSerializer.php index cc5272bf..2ff0b7ef 100644 --- a/src/Adyen/Model/Management/ObjectSerializer.php +++ b/src/Adyen/Model/Management/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/ManagementWebhooks/ObjectSerializer.php b/src/Adyen/Model/ManagementWebhooks/ObjectSerializer.php index 9c73e94b..a3626e45 100644 --- a/src/Adyen/Model/ManagementWebhooks/ObjectSerializer.php +++ b/src/Adyen/Model/ManagementWebhooks/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/POSTerminalManagement/ObjectSerializer.php b/src/Adyen/Model/POSTerminalManagement/ObjectSerializer.php index 8032f208..b6a5027e 100644 --- a/src/Adyen/Model/POSTerminalManagement/ObjectSerializer.php +++ b/src/Adyen/Model/POSTerminalManagement/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Payments/ObjectSerializer.php b/src/Adyen/Model/Payments/ObjectSerializer.php index 4e217461..ae7a870c 100644 --- a/src/Adyen/Model/Payments/ObjectSerializer.php +++ b/src/Adyen/Model/Payments/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Payments/ResponseAdditionalDataCard.php b/src/Adyen/Model/Payments/ResponseAdditionalDataCard.php index 97986396..3a87adcb 100644 --- a/src/Adyen/Model/Payments/ResponseAdditionalDataCard.php +++ b/src/Adyen/Model/Payments/ResponseAdditionalDataCard.php @@ -50,6 +50,7 @@ class ResponseAdditionalDataCard implements ModelInterface, ArrayAccess, \JsonSe 'cardIssuingCountry' => 'string', 'cardIssuingCurrency' => 'string', 'cardPaymentMethod' => 'string', + 'cardProductId' => 'string', 'cardSummary' => 'string', 'issuerBin' => 'string' ]; @@ -68,6 +69,7 @@ class ResponseAdditionalDataCard implements ModelInterface, ArrayAccess, \JsonSe 'cardIssuingCountry' => null, 'cardIssuingCurrency' => null, 'cardPaymentMethod' => null, + 'cardProductId' => null, 'cardSummary' => null, 'issuerBin' => null ]; @@ -84,6 +86,7 @@ class ResponseAdditionalDataCard implements ModelInterface, ArrayAccess, \JsonSe 'cardIssuingCountry' => false, 'cardIssuingCurrency' => false, 'cardPaymentMethod' => false, + 'cardProductId' => false, 'cardSummary' => false, 'issuerBin' => false ]; @@ -180,6 +183,7 @@ public function isNullableSetToNull(string $property): bool 'cardIssuingCountry' => 'cardIssuingCountry', 'cardIssuingCurrency' => 'cardIssuingCurrency', 'cardPaymentMethod' => 'cardPaymentMethod', + 'cardProductId' => 'cardProductId', 'cardSummary' => 'cardSummary', 'issuerBin' => 'issuerBin' ]; @@ -196,6 +200,7 @@ public function isNullableSetToNull(string $property): bool 'cardIssuingCountry' => 'setCardIssuingCountry', 'cardIssuingCurrency' => 'setCardIssuingCurrency', 'cardPaymentMethod' => 'setCardPaymentMethod', + 'cardProductId' => 'setCardProductId', 'cardSummary' => 'setCardSummary', 'issuerBin' => 'setIssuerBin' ]; @@ -212,6 +217,7 @@ public function isNullableSetToNull(string $property): bool 'cardIssuingCountry' => 'getCardIssuingCountry', 'cardIssuingCurrency' => 'getCardIssuingCurrency', 'cardPaymentMethod' => 'getCardPaymentMethod', + 'cardProductId' => 'getCardProductId', 'cardSummary' => 'getCardSummary', 'issuerBin' => 'getIssuerBin' ]; @@ -257,7 +263,39 @@ public function getModelName() return self::$openAPIModelName; } + public const CARD_PRODUCT_ID_A = 'A'; + public const CARD_PRODUCT_ID_B = 'B'; + public const CARD_PRODUCT_ID_C = 'C'; + public const CARD_PRODUCT_ID_D = 'D'; + public const CARD_PRODUCT_ID_F = 'F'; + public const CARD_PRODUCT_ID_MCC = 'MCC'; + public const CARD_PRODUCT_ID_MCE = 'MCE'; + public const CARD_PRODUCT_ID_MCF = 'MCF'; + public const CARD_PRODUCT_ID_MCG = 'MCG'; + public const CARD_PRODUCT_ID_MCH = 'MCH'; + public const CARD_PRODUCT_ID_MCI = 'MCI'; + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCardProductIdAllowableValues() + { + return [ + self::CARD_PRODUCT_ID_A, + self::CARD_PRODUCT_ID_B, + self::CARD_PRODUCT_ID_C, + self::CARD_PRODUCT_ID_D, + self::CARD_PRODUCT_ID_F, + self::CARD_PRODUCT_ID_MCC, + self::CARD_PRODUCT_ID_MCE, + self::CARD_PRODUCT_ID_MCF, + self::CARD_PRODUCT_ID_MCG, + self::CARD_PRODUCT_ID_MCH, + self::CARD_PRODUCT_ID_MCI, + ]; + } /** * Associative array for storing property values * @@ -279,6 +317,7 @@ public function __construct(array $data = null) $this->setIfExists('cardIssuingCountry', $data ?? [], null); $this->setIfExists('cardIssuingCurrency', $data ?? [], null); $this->setIfExists('cardPaymentMethod', $data ?? [], null); + $this->setIfExists('cardProductId', $data ?? [], null); $this->setIfExists('cardSummary', $data ?? [], null); $this->setIfExists('issuerBin', $data ?? [], null); } @@ -310,6 +349,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getCardProductIdAllowableValues(); + if (!is_null($this->container['cardProductId']) && !in_array($this->container['cardProductId'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'cardProductId', must be one of '%s'", + $this->container['cardProductId'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -469,6 +517,40 @@ public function setCardPaymentMethod($cardPaymentMethod) return $this; } + /** + * Gets cardProductId + * + * @return string|null + */ + public function getCardProductId() + { + return $this->container['cardProductId']; + } + + /** + * Sets cardProductId + * + * @param string|null $cardProductId The Card Product ID represents the type of card following card scheme product definitions and can be returned for Adyen Acquiring service level payments. Possible values Visa: * **A** - Visa Traditional * **B** - Visa Traditional Rewards * **C** - Visa Signature * **D** - Visa Signature Preferred * **F** - Visa Classic Possible values Mastercard: * **MCC** - Mastercard Card * **MCE** - Mastercard Electronic Card * **MCF** - Mastercard Corporate Fleet Card * **MCG** - Gold Mastercard Card * **MCH** - Mastercard Premium Charge * **MCI** - Mastercard Select Debit + * + * @return self + */ + public function setCardProductId($cardProductId) + { + $allowedValues = $this->getCardProductIdAllowableValues(); + if (!in_array($cardProductId, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'cardProductId', must be one of '%s'", + $cardProductId, + implode("', '", $allowedValues) + ) + ); + } + $this->container['cardProductId'] = $cardProductId; + + return $this; + } + /** * Gets cardSummary * diff --git a/src/Adyen/Model/PaymentsApp/ObjectSerializer.php b/src/Adyen/Model/PaymentsApp/ObjectSerializer.php index b900dc2b..56c51256 100644 --- a/src/Adyen/Model/PaymentsApp/ObjectSerializer.php +++ b/src/Adyen/Model/PaymentsApp/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Payout/ObjectSerializer.php b/src/Adyen/Model/Payout/ObjectSerializer.php index ad1c991a..0d50f436 100644 --- a/src/Adyen/Model/Payout/ObjectSerializer.php +++ b/src/Adyen/Model/Payout/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/PosMobile/ObjectSerializer.php b/src/Adyen/Model/PosMobile/ObjectSerializer.php index ae87baef..ba0e91ce 100644 --- a/src/Adyen/Model/PosMobile/ObjectSerializer.php +++ b/src/Adyen/Model/PosMobile/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Recurring/ObjectSerializer.php b/src/Adyen/Model/Recurring/ObjectSerializer.php index 7adbf8e5..3b2a857b 100644 --- a/src/Adyen/Model/Recurring/ObjectSerializer.php +++ b/src/Adyen/Model/Recurring/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/ReportWebhooks/ObjectSerializer.php b/src/Adyen/Model/ReportWebhooks/ObjectSerializer.php index 97f67038..a8a265ce 100644 --- a/src/Adyen/Model/ReportWebhooks/ObjectSerializer.php +++ b/src/Adyen/Model/ReportWebhooks/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/StoredValue/ObjectSerializer.php b/src/Adyen/Model/StoredValue/ObjectSerializer.php index ed3372fb..93497545 100644 --- a/src/Adyen/Model/StoredValue/ObjectSerializer.php +++ b/src/Adyen/Model/StoredValue/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/TransactionWebhooks/BalancePlatformNotificationResponse.php b/src/Adyen/Model/TransactionWebhooks/BalancePlatformNotificationResponse.php index 65767d08..51fcad32 100644 --- a/src/Adyen/Model/TransactionWebhooks/BalancePlatformNotificationResponse.php +++ b/src/Adyen/Model/TransactionWebhooks/BalancePlatformNotificationResponse.php @@ -289,7 +289,7 @@ public function getNotificationResponse() /** * Sets notificationResponse * - * @param string|null $notificationResponse Respond with **HTTP 200 OK** and `[accepted]` in the response body to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications). + * @param string|null $notificationResponse Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications). * * @return self */ diff --git a/src/Adyen/Model/TransactionWebhooks/BankCategoryData.php b/src/Adyen/Model/TransactionWebhooks/BankCategoryData.php new file mode 100644 index 00000000..bd92fc0f --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/BankCategoryData.php @@ -0,0 +1,510 @@ + + */ +class BankCategoryData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BankCategoryData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'priority' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'priority' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'priority' => 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 = [ + 'priority' => 'priority', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'priority' => 'setPriority', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'priority' => 'getPriority', + '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 PRIORITY_CROSS_BORDER = 'crossBorder'; + public const PRIORITY_FAST = 'fast'; + public const PRIORITY_INSTANT = 'instant'; + public const PRIORITY_INTERNAL = 'internal'; + public const PRIORITY_REGULAR = 'regular'; + public const PRIORITY_WIRE = 'wire'; + public const TYPE_BANK = 'bank'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPriorityAllowableValues() + { + return [ + self::PRIORITY_CROSS_BORDER, + self::PRIORITY_FAST, + self::PRIORITY_INSTANT, + self::PRIORITY_INTERNAL, + self::PRIORITY_REGULAR, + self::PRIORITY_WIRE, + ]; + } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_BANK, + ]; + } + /** + * 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('priority', $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->getPriorityAllowableValues(); + if (!is_null($this->container['priority']) && !in_array($this->container['priority'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'priority', must be one of '%s'", + $this->container['priority'], + implode("', '", $allowedValues) + ); + } + + $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 priority + * + * @return string|null + */ + public function getPriority() + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param string|null $priority The priority for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. Required for transfers with `category` **bank**. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). + * + * @return self + */ + public function setPriority($priority) + { + $allowedValues = $this->getPriorityAllowableValues(); + if (!in_array($priority, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'priority', must be one of '%s'", + $priority, + implode("', '", $allowedValues) + ) + ); + } + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type **bank** + * + * @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/TransactionWebhooks/InternalCategoryData.php b/src/Adyen/Model/TransactionWebhooks/InternalCategoryData.php new file mode 100644 index 00000000..87ac3ba7 --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/InternalCategoryData.php @@ -0,0 +1,500 @@ + + */ +class InternalCategoryData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InternalCategoryData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'modificationMerchantReference' => 'string', + 'modificationPspReference' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'modificationMerchantReference' => null, + 'modificationPspReference' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'modificationMerchantReference' => false, + 'modificationPspReference' => 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 = [ + 'modificationMerchantReference' => 'modificationMerchantReference', + 'modificationPspReference' => 'modificationPspReference', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'modificationMerchantReference' => 'setModificationMerchantReference', + 'modificationPspReference' => 'setModificationPspReference', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'modificationMerchantReference' => 'getModificationMerchantReference', + 'modificationPspReference' => 'getModificationPspReference', + '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_INTERNAL = 'internal'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_INTERNAL, + ]; + } + /** + * 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('modificationMerchantReference', $data ?? [], null); + $this->setIfExists('modificationPspReference', $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 modificationMerchantReference + * + * @return string|null + */ + public function getModificationMerchantReference() + { + return $this->container['modificationMerchantReference']; + } + + /** + * Sets modificationMerchantReference + * + * @param string|null $modificationMerchantReference The capture's merchant reference included in the transfer. + * + * @return self + */ + public function setModificationMerchantReference($modificationMerchantReference) + { + $this->container['modificationMerchantReference'] = $modificationMerchantReference; + + return $this; + } + + /** + * Gets modificationPspReference + * + * @return string|null + */ + public function getModificationPspReference() + { + return $this->container['modificationPspReference']; + } + + /** + * Sets modificationPspReference + * + * @param string|null $modificationPspReference The capture reference included in the transfer. + * + * @return self + */ + public function setModificationPspReference($modificationPspReference) + { + $this->container['modificationPspReference'] = $modificationPspReference; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type **internal** + * + * @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/TransactionWebhooks/IssuedCard.php b/src/Adyen/Model/TransactionWebhooks/IssuedCard.php new file mode 100644 index 00000000..6507c02f --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/IssuedCard.php @@ -0,0 +1,743 @@ + + */ +class IssuedCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'IssuedCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'authorisationType' => 'string', + 'panEntryMode' => 'string', + 'processingType' => 'string', + 'relayedAuthorisationData' => '\Adyen\Model\TransactionWebhooks\RelayedAuthorisationData', + 'schemeTraceId' => 'string', + 'schemeUniqueTransactionId' => 'string', + 'type' => 'string', + 'validationFacts' => '\Adyen\Model\TransactionWebhooks\TransferNotificationValidationFact[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'authorisationType' => null, + 'panEntryMode' => null, + 'processingType' => null, + 'relayedAuthorisationData' => null, + 'schemeTraceId' => null, + 'schemeUniqueTransactionId' => null, + 'type' => null, + 'validationFacts' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'authorisationType' => false, + 'panEntryMode' => false, + 'processingType' => false, + 'relayedAuthorisationData' => false, + 'schemeTraceId' => false, + 'schemeUniqueTransactionId' => false, + 'type' => false, + 'validationFacts' => 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 = [ + 'authorisationType' => 'authorisationType', + 'panEntryMode' => 'panEntryMode', + 'processingType' => 'processingType', + 'relayedAuthorisationData' => 'relayedAuthorisationData', + 'schemeTraceId' => 'schemeTraceId', + 'schemeUniqueTransactionId' => 'schemeUniqueTransactionId', + 'type' => 'type', + 'validationFacts' => 'validationFacts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'authorisationType' => 'setAuthorisationType', + 'panEntryMode' => 'setPanEntryMode', + 'processingType' => 'setProcessingType', + 'relayedAuthorisationData' => 'setRelayedAuthorisationData', + 'schemeTraceId' => 'setSchemeTraceId', + 'schemeUniqueTransactionId' => 'setSchemeUniqueTransactionId', + 'type' => 'setType', + 'validationFacts' => 'setValidationFacts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'authorisationType' => 'getAuthorisationType', + 'panEntryMode' => 'getPanEntryMode', + 'processingType' => 'getProcessingType', + 'relayedAuthorisationData' => 'getRelayedAuthorisationData', + 'schemeTraceId' => 'getSchemeTraceId', + 'schemeUniqueTransactionId' => 'getSchemeUniqueTransactionId', + 'type' => 'getType', + 'validationFacts' => 'getValidationFacts' + ]; + + /** + * 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 PAN_ENTRY_MODE_CHIP = 'chip'; + public const PAN_ENTRY_MODE_COF = 'cof'; + public const PAN_ENTRY_MODE_CONTACTLESS = 'contactless'; + public const PAN_ENTRY_MODE_ECOMMERCE = 'ecommerce'; + public const PAN_ENTRY_MODE_MAGSTRIPE = 'magstripe'; + public const PAN_ENTRY_MODE_MANUAL = 'manual'; + public const PAN_ENTRY_MODE_TOKEN = 'token'; + public const PROCESSING_TYPE_ATM_WITHDRAW = 'atmWithdraw'; + public const PROCESSING_TYPE_BALANCE_INQUIRY = 'balanceInquiry'; + public const PROCESSING_TYPE_ECOMMERCE = 'ecommerce'; + public const PROCESSING_TYPE_MOTO = 'moto'; + public const PROCESSING_TYPE_POS = 'pos'; + public const PROCESSING_TYPE_PURCHASE_WITH_CASHBACK = 'purchaseWithCashback'; + public const PROCESSING_TYPE_RECURRING = 'recurring'; + public const PROCESSING_TYPE_TOKEN = 'token'; + public const TYPE_ISSUED_CARD = 'issuedCard'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPanEntryModeAllowableValues() + { + return [ + self::PAN_ENTRY_MODE_CHIP, + self::PAN_ENTRY_MODE_COF, + self::PAN_ENTRY_MODE_CONTACTLESS, + self::PAN_ENTRY_MODE_ECOMMERCE, + self::PAN_ENTRY_MODE_MAGSTRIPE, + self::PAN_ENTRY_MODE_MANUAL, + self::PAN_ENTRY_MODE_TOKEN, + ]; + } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getProcessingTypeAllowableValues() + { + return [ + self::PROCESSING_TYPE_ATM_WITHDRAW, + self::PROCESSING_TYPE_BALANCE_INQUIRY, + self::PROCESSING_TYPE_ECOMMERCE, + self::PROCESSING_TYPE_MOTO, + self::PROCESSING_TYPE_POS, + self::PROCESSING_TYPE_PURCHASE_WITH_CASHBACK, + self::PROCESSING_TYPE_RECURRING, + self::PROCESSING_TYPE_TOKEN, + ]; + } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_ISSUED_CARD, + ]; + } + /** + * 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('authorisationType', $data ?? [], null); + $this->setIfExists('panEntryMode', $data ?? [], null); + $this->setIfExists('processingType', $data ?? [], null); + $this->setIfExists('relayedAuthorisationData', $data ?? [], null); + $this->setIfExists('schemeTraceId', $data ?? [], null); + $this->setIfExists('schemeUniqueTransactionId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('validationFacts', $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->getPanEntryModeAllowableValues(); + if (!is_null($this->container['panEntryMode']) && !in_array($this->container['panEntryMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'panEntryMode', must be one of '%s'", + $this->container['panEntryMode'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getProcessingTypeAllowableValues(); + if (!is_null($this->container['processingType']) && !in_array($this->container['processingType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'processingType', must be one of '%s'", + $this->container['processingType'], + implode("', '", $allowedValues) + ); + } + + $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 authorisationType + * + * @return string|null + */ + public function getAuthorisationType() + { + return $this->container['authorisationType']; + } + + /** + * Sets authorisationType + * + * @param string|null $authorisationType The authorisation type. For example, **defaultAuthorisation**, **preAuthorisation**, **finalAuthorisation** + * + * @return self + */ + public function setAuthorisationType($authorisationType) + { + $this->container['authorisationType'] = $authorisationType; + + return $this; + } + + /** + * Gets panEntryMode + * + * @return string|null + */ + public function getPanEntryMode() + { + return $this->container['panEntryMode']; + } + + /** + * Sets panEntryMode + * + * @param string|null $panEntryMode Indicates the method used for entering the PAN to initiate a transaction. Possible values: **manual**, **chip**, **magstripe**, **contactless**, **cof**, **ecommerce**, **token**. + * + * @return self + */ + public function setPanEntryMode($panEntryMode) + { + $allowedValues = $this->getPanEntryModeAllowableValues(); + if (!in_array($panEntryMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'panEntryMode', must be one of '%s'", + $panEntryMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['panEntryMode'] = $panEntryMode; + + return $this; + } + + /** + * Gets processingType + * + * @return string|null + */ + public function getProcessingType() + { + return $this->container['processingType']; + } + + /** + * Sets processingType + * + * @param string|null $processingType Contains information about how the payment was processed. For example, **ecommerce** for online or **pos** for in-person payments. + * + * @return self + */ + public function setProcessingType($processingType) + { + $allowedValues = $this->getProcessingTypeAllowableValues(); + if (!in_array($processingType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'processingType', must be one of '%s'", + $processingType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['processingType'] = $processingType; + + return $this; + } + + /** + * Gets relayedAuthorisationData + * + * @return \Adyen\Model\TransactionWebhooks\RelayedAuthorisationData|null + */ + public function getRelayedAuthorisationData() + { + return $this->container['relayedAuthorisationData']; + } + + /** + * Sets relayedAuthorisationData + * + * @param \Adyen\Model\TransactionWebhooks\RelayedAuthorisationData|null $relayedAuthorisationData relayedAuthorisationData + * + * @return self + */ + public function setRelayedAuthorisationData($relayedAuthorisationData) + { + $this->container['relayedAuthorisationData'] = $relayedAuthorisationData; + + return $this; + } + + /** + * Gets schemeTraceId + * + * @return string|null + */ + public function getSchemeTraceId() + { + return $this->container['schemeTraceId']; + } + + /** + * Sets schemeTraceId + * + * @param string|null $schemeTraceId The identifier of the original payment. This ID is provided by the scheme and can be alphanumeric or numeric, depending on the scheme. The `schemeTraceID` should refer to an original `schemeUniqueTransactionID` provided in an earlier payment (not necessarily processed by Adyen). A `schemeTraceId` is typically available for authorization adjustments or recurring payments. + * + * @return self + */ + public function setSchemeTraceId($schemeTraceId) + { + $this->container['schemeTraceId'] = $schemeTraceId; + + return $this; + } + + /** + * Gets schemeUniqueTransactionId + * + * @return string|null + */ + public function getSchemeUniqueTransactionId() + { + return $this->container['schemeUniqueTransactionId']; + } + + /** + * Sets schemeUniqueTransactionId + * + * @param string|null $schemeUniqueTransactionId The unique identifier created by the scheme. This ID can be alphanumeric or numeric depending on the scheme. + * + * @return self + */ + public function setSchemeUniqueTransactionId($schemeUniqueTransactionId) + { + $this->container['schemeUniqueTransactionId'] = $schemeUniqueTransactionId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type **issuedCard** + * + * @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; + } + + /** + * Gets validationFacts + * + * @return \Adyen\Model\TransactionWebhooks\TransferNotificationValidationFact[]|null + */ + public function getValidationFacts() + { + return $this->container['validationFacts']; + } + + /** + * Sets validationFacts + * + * @param \Adyen\Model\TransactionWebhooks\TransferNotificationValidationFact[]|null $validationFacts The evaluation of the validation facts. See [validation checks](https://docs.adyen.com/issuing/validation-checks) for more information. + * + * @return self + */ + public function setValidationFacts($validationFacts) + { + $this->container['validationFacts'] = $validationFacts; + + 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/TransactionWebhooks/ObjectSerializer.php b/src/Adyen/Model/TransactionWebhooks/ObjectSerializer.php index 6592bf84..9ccc6758 100644 --- a/src/Adyen/Model/TransactionWebhooks/ObjectSerializer.php +++ b/src/Adyen/Model/TransactionWebhooks/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/TransactionWebhooks/PaymentInstrument.php b/src/Adyen/Model/TransactionWebhooks/PaymentInstrument.php new file mode 100644 index 00000000..4f653196 --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/PaymentInstrument.php @@ -0,0 +1,500 @@ + + */ +class PaymentInstrument implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentInstrument'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'description' => 'string', + 'id' => 'string', + 'reference' => 'string', + 'tokenType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'description' => null, + 'id' => null, + 'reference' => null, + 'tokenType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'description' => false, + 'id' => false, + 'reference' => false, + 'tokenType' => 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 = [ + 'description' => 'description', + 'id' => 'id', + 'reference' => 'reference', + 'tokenType' => 'tokenType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'description' => 'setDescription', + 'id' => 'setId', + 'reference' => 'setReference', + 'tokenType' => 'setTokenType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'description' => 'getDescription', + 'id' => 'getId', + 'reference' => 'getReference', + 'tokenType' => 'getTokenType' + ]; + + /** + * 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('description', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('reference', $data ?? [], null); + $this->setIfExists('tokenType', $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 description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the resource. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier of the resource. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets reference + * + * @return string|null + */ + public function getReference() + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string|null $reference The reference for the resource. + * + * @return self + */ + public function setReference($reference) + { + $this->container['reference'] = $reference; + + return $this; + } + + /** + * Gets tokenType + * + * @return string|null + */ + public function getTokenType() + { + return $this->container['tokenType']; + } + + /** + * Sets tokenType + * + * @param string|null $tokenType The type of wallet that the network token is associated with. + * + * @return self + */ + public function setTokenType($tokenType) + { + $this->container['tokenType'] = $tokenType; + + 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/TransactionWebhooks/PlatformPayment.php b/src/Adyen/Model/TransactionWebhooks/PlatformPayment.php new file mode 100644 index 00000000..970ea9e0 --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/PlatformPayment.php @@ -0,0 +1,652 @@ + + */ +class PlatformPayment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PlatformPayment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'modificationMerchantReference' => 'string', + 'modificationPspReference' => 'string', + 'paymentMerchantReference' => 'string', + 'platformPaymentType' => 'string', + 'pspPaymentReference' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'modificationMerchantReference' => null, + 'modificationPspReference' => null, + 'paymentMerchantReference' => null, + 'platformPaymentType' => null, + 'pspPaymentReference' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'modificationMerchantReference' => false, + 'modificationPspReference' => false, + 'paymentMerchantReference' => false, + 'platformPaymentType' => false, + 'pspPaymentReference' => 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 = [ + 'modificationMerchantReference' => 'modificationMerchantReference', + 'modificationPspReference' => 'modificationPspReference', + 'paymentMerchantReference' => 'paymentMerchantReference', + 'platformPaymentType' => 'platformPaymentType', + 'pspPaymentReference' => 'pspPaymentReference', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'modificationMerchantReference' => 'setModificationMerchantReference', + 'modificationPspReference' => 'setModificationPspReference', + 'paymentMerchantReference' => 'setPaymentMerchantReference', + 'platformPaymentType' => 'setPlatformPaymentType', + 'pspPaymentReference' => 'setPspPaymentReference', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'modificationMerchantReference' => 'getModificationMerchantReference', + 'modificationPspReference' => 'getModificationPspReference', + 'paymentMerchantReference' => 'getPaymentMerchantReference', + 'platformPaymentType' => 'getPlatformPaymentType', + 'pspPaymentReference' => 'getPspPaymentReference', + '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 PLATFORM_PAYMENT_TYPE_ACQUIRING_FEES = 'AcquiringFees'; + public const PLATFORM_PAYMENT_TYPE_ADYEN_COMMISSION = 'AdyenCommission'; + public const PLATFORM_PAYMENT_TYPE_ADYEN_FEES = 'AdyenFees'; + public const PLATFORM_PAYMENT_TYPE_ADYEN_MARKUP = 'AdyenMarkup'; + public const PLATFORM_PAYMENT_TYPE_BALANCE_ACCOUNT = 'BalanceAccount'; + public const PLATFORM_PAYMENT_TYPE_COMMISSION = 'Commission'; + public const PLATFORM_PAYMENT_TYPE__DEFAULT = 'Default'; + public const PLATFORM_PAYMENT_TYPE_INTERCHANGE = 'Interchange'; + public const PLATFORM_PAYMENT_TYPE_PAYMENT_FEE = 'PaymentFee'; + public const PLATFORM_PAYMENT_TYPE_REMAINDER = 'Remainder'; + public const PLATFORM_PAYMENT_TYPE_SCHEME_FEE = 'SchemeFee'; + public const PLATFORM_PAYMENT_TYPE_SURCHARGE = 'Surcharge'; + public const PLATFORM_PAYMENT_TYPE_TIP = 'Tip'; + public const PLATFORM_PAYMENT_TYPE_TOP_UP = 'TopUp'; + public const PLATFORM_PAYMENT_TYPE_VAT = 'VAT'; + public const TYPE_PLATFORM_PAYMENT = 'platformPayment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPlatformPaymentTypeAllowableValues() + { + return [ + self::PLATFORM_PAYMENT_TYPE_ACQUIRING_FEES, + self::PLATFORM_PAYMENT_TYPE_ADYEN_COMMISSION, + self::PLATFORM_PAYMENT_TYPE_ADYEN_FEES, + self::PLATFORM_PAYMENT_TYPE_ADYEN_MARKUP, + self::PLATFORM_PAYMENT_TYPE_BALANCE_ACCOUNT, + self::PLATFORM_PAYMENT_TYPE_COMMISSION, + self::PLATFORM_PAYMENT_TYPE__DEFAULT, + self::PLATFORM_PAYMENT_TYPE_INTERCHANGE, + self::PLATFORM_PAYMENT_TYPE_PAYMENT_FEE, + self::PLATFORM_PAYMENT_TYPE_REMAINDER, + self::PLATFORM_PAYMENT_TYPE_SCHEME_FEE, + self::PLATFORM_PAYMENT_TYPE_SURCHARGE, + self::PLATFORM_PAYMENT_TYPE_TIP, + self::PLATFORM_PAYMENT_TYPE_TOP_UP, + self::PLATFORM_PAYMENT_TYPE_VAT, + ]; + } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PLATFORM_PAYMENT, + ]; + } + /** + * 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('modificationMerchantReference', $data ?? [], null); + $this->setIfExists('modificationPspReference', $data ?? [], null); + $this->setIfExists('paymentMerchantReference', $data ?? [], null); + $this->setIfExists('platformPaymentType', $data ?? [], null); + $this->setIfExists('pspPaymentReference', $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->getPlatformPaymentTypeAllowableValues(); + if (!is_null($this->container['platformPaymentType']) && !in_array($this->container['platformPaymentType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'platformPaymentType', must be one of '%s'", + $this->container['platformPaymentType'], + implode("', '", $allowedValues) + ); + } + + $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 modificationMerchantReference + * + * @return string|null + */ + public function getModificationMerchantReference() + { + return $this->container['modificationMerchantReference']; + } + + /** + * Sets modificationMerchantReference + * + * @param string|null $modificationMerchantReference The capture's merchant reference included in the transfer. + * + * @return self + */ + public function setModificationMerchantReference($modificationMerchantReference) + { + $this->container['modificationMerchantReference'] = $modificationMerchantReference; + + return $this; + } + + /** + * Gets modificationPspReference + * + * @return string|null + */ + public function getModificationPspReference() + { + return $this->container['modificationPspReference']; + } + + /** + * Sets modificationPspReference + * + * @param string|null $modificationPspReference The capture reference included in the transfer. + * + * @return self + */ + public function setModificationPspReference($modificationPspReference) + { + $this->container['modificationPspReference'] = $modificationPspReference; + + return $this; + } + + /** + * Gets paymentMerchantReference + * + * @return string|null + */ + public function getPaymentMerchantReference() + { + return $this->container['paymentMerchantReference']; + } + + /** + * Sets paymentMerchantReference + * + * @param string|null $paymentMerchantReference The payment's merchant reference included in the transfer. + * + * @return self + */ + public function setPaymentMerchantReference($paymentMerchantReference) + { + $this->container['paymentMerchantReference'] = $paymentMerchantReference; + + return $this; + } + + /** + * Gets platformPaymentType + * + * @return string|null + */ + public function getPlatformPaymentType() + { + return $this->container['platformPaymentType']; + } + + /** + * Sets platformPaymentType + * + * @param string|null $platformPaymentType The type of the related split. + * + * @return self + */ + public function setPlatformPaymentType($platformPaymentType) + { + $allowedValues = $this->getPlatformPaymentTypeAllowableValues(); + if (!in_array($platformPaymentType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'platformPaymentType', must be one of '%s'", + $platformPaymentType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['platformPaymentType'] = $platformPaymentType; + + return $this; + } + + /** + * Gets pspPaymentReference + * + * @return string|null + */ + public function getPspPaymentReference() + { + return $this->container['pspPaymentReference']; + } + + /** + * Sets pspPaymentReference + * + * @param string|null $pspPaymentReference The payment reference included in the transfer. + * + * @return self + */ + public function setPspPaymentReference($pspPaymentReference) + { + $this->container['pspPaymentReference'] = $pspPaymentReference; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type **platformPayment** + * + * @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/TransactionWebhooks/RelayedAuthorisationData.php b/src/Adyen/Model/TransactionWebhooks/RelayedAuthorisationData.php new file mode 100644 index 00000000..ad581f49 --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/RelayedAuthorisationData.php @@ -0,0 +1,438 @@ + + */ +class RelayedAuthorisationData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RelayedAuthorisationData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => 'array', + 'reference' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null, + 'reference' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'metadata' => false, + 'reference' => 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 = [ + 'metadata' => 'metadata', + 'reference' => 'reference' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata', + 'reference' => 'setReference' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata', + 'reference' => 'getReference' + ]; + + /** + * 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('metadata', $data ?? [], null); + $this->setIfExists('reference', $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 metadata + * + * @return array|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param array|null $metadata Contains key-value pairs of your references and descriptions, for example, `customId`:`your-own-custom-field-12345`. + * + * @return self + */ + public function setMetadata($metadata) + { + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets reference + * + * @return string|null + */ + public function getReference() + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string|null $reference Your reference for the relayed authorisation data. + * + * @return self + */ + public function setReference($reference) + { + $this->container['reference'] = $reference; + + 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/TransactionWebhooks/Transaction.php b/src/Adyen/Model/TransactionWebhooks/Transaction.php index d5ebf56d..3030136a 100644 --- a/src/Adyen/Model/TransactionWebhooks/Transaction.php +++ b/src/Adyen/Model/TransactionWebhooks/Transaction.php @@ -50,9 +50,12 @@ class Transaction implements ModelInterface, ArrayAccess, \JsonSerializable 'balancePlatform' => 'string', 'bookingDate' => '\DateTime', 'creationDate' => '\DateTime', + 'description' => 'string', 'id' => 'string', + 'paymentInstrument' => '\Adyen\Model\TransactionWebhooks\PaymentInstrument', + 'referenceForBeneficiary' => 'string', 'status' => 'string', - 'transfer' => '\Adyen\Model\TransactionWebhooks\TransferData', + 'transfer' => '\Adyen\Model\TransactionWebhooks\TransferView', 'valueDate' => '\DateTime' ]; @@ -70,7 +73,10 @@ class Transaction implements ModelInterface, ArrayAccess, \JsonSerializable 'balancePlatform' => null, 'bookingDate' => 'date-time', 'creationDate' => 'date-time', + 'description' => null, 'id' => null, + 'paymentInstrument' => null, + 'referenceForBeneficiary' => null, 'status' => null, 'transfer' => null, 'valueDate' => 'date-time' @@ -88,7 +94,10 @@ class Transaction implements ModelInterface, ArrayAccess, \JsonSerializable 'balancePlatform' => false, 'bookingDate' => false, 'creationDate' => false, + 'description' => false, 'id' => false, + 'paymentInstrument' => false, + 'referenceForBeneficiary' => false, 'status' => false, 'transfer' => false, 'valueDate' => false @@ -186,7 +195,10 @@ public function isNullableSetToNull(string $property): bool 'balancePlatform' => 'balancePlatform', 'bookingDate' => 'bookingDate', 'creationDate' => 'creationDate', + 'description' => 'description', 'id' => 'id', + 'paymentInstrument' => 'paymentInstrument', + 'referenceForBeneficiary' => 'referenceForBeneficiary', 'status' => 'status', 'transfer' => 'transfer', 'valueDate' => 'valueDate' @@ -204,7 +216,10 @@ public function isNullableSetToNull(string $property): bool 'balancePlatform' => 'setBalancePlatform', 'bookingDate' => 'setBookingDate', 'creationDate' => 'setCreationDate', + 'description' => 'setDescription', 'id' => 'setId', + 'paymentInstrument' => 'setPaymentInstrument', + 'referenceForBeneficiary' => 'setReferenceForBeneficiary', 'status' => 'setStatus', 'transfer' => 'setTransfer', 'valueDate' => 'setValueDate' @@ -222,7 +237,10 @@ public function isNullableSetToNull(string $property): bool 'balancePlatform' => 'getBalancePlatform', 'bookingDate' => 'getBookingDate', 'creationDate' => 'getCreationDate', + 'description' => 'getDescription', 'id' => 'getId', + 'paymentInstrument' => 'getPaymentInstrument', + 'referenceForBeneficiary' => 'getReferenceForBeneficiary', 'status' => 'getStatus', 'transfer' => 'getTransfer', 'valueDate' => 'getValueDate' @@ -305,7 +323,10 @@ public function __construct(array $data = null) $this->setIfExists('balancePlatform', $data ?? [], null); $this->setIfExists('bookingDate', $data ?? [], null); $this->setIfExists('creationDate', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('paymentInstrument', $data ?? [], null); + $this->setIfExists('referenceForBeneficiary', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); $this->setIfExists('transfer', $data ?? [], null); $this->setIfExists('valueDate', $data ?? [], null); @@ -530,6 +551,30 @@ public function setCreationDate($creationDate) return $this; } + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The `description` from the `/transfers` request. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + /** * Gets id * @@ -554,6 +599,54 @@ public function setId($id) return $this; } + /** + * Gets paymentInstrument + * + * @return \Adyen\Model\TransactionWebhooks\PaymentInstrument|null + */ + public function getPaymentInstrument() + { + return $this->container['paymentInstrument']; + } + + /** + * Sets paymentInstrument + * + * @param \Adyen\Model\TransactionWebhooks\PaymentInstrument|null $paymentInstrument paymentInstrument + * + * @return self + */ + public function setPaymentInstrument($paymentInstrument) + { + $this->container['paymentInstrument'] = $paymentInstrument; + + return $this; + } + + /** + * Gets referenceForBeneficiary + * + * @return string|null + */ + public function getReferenceForBeneficiary() + { + return $this->container['referenceForBeneficiary']; + } + + /** + * Sets referenceForBeneficiary + * + * @param string|null $referenceForBeneficiary The reference sent to or received from the counterparty. * For outgoing funds, this is the [`referenceForBeneficiary`](https://docs.adyen.com/api-explorer/#/transfers/latest/post/transfers__resParam_referenceForBeneficiary) from the [`/transfers`](https://docs.adyen.com/api-explorer/#/transfers/latest/post/transfers__reqParam_referenceForBeneficiary) request. * For incoming funds, this is the reference from the sender. + * + * @return self + */ + public function setReferenceForBeneficiary($referenceForBeneficiary) + { + $this->container['referenceForBeneficiary'] = $referenceForBeneficiary; + + return $this; + } + /** * Gets status * @@ -591,7 +684,7 @@ public function setStatus($status) /** * Gets transfer * - * @return \Adyen\Model\TransactionWebhooks\TransferData|null + * @return \Adyen\Model\TransactionWebhooks\TransferView|null */ public function getTransfer() { @@ -601,7 +694,7 @@ public function getTransfer() /** * Sets transfer * - * @param \Adyen\Model\TransactionWebhooks\TransferData|null $transfer transfer + * @param \Adyen\Model\TransactionWebhooks\TransferView|null $transfer transfer * * @return self */ diff --git a/src/Adyen/Model/TransactionWebhooks/TransferNotificationValidationFact.php b/src/Adyen/Model/TransactionWebhooks/TransferNotificationValidationFact.php new file mode 100644 index 00000000..9d32266d --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/TransferNotificationValidationFact.php @@ -0,0 +1,438 @@ + + */ +class TransferNotificationValidationFact implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransferNotificationValidationFact'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'result' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'result' => 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 = [ + 'result' => 'result', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result' => 'setResult', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result' => 'getResult', + '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; + } + + + /** + * 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('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 = []; + + 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 string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result The evaluation result of the validation fact. + * + * @return self + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the validation fact. + * + * @return self + */ + public function setType($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; + } + + /** + * 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/TransactionWebhooks/TransferView.php b/src/Adyen/Model/TransactionWebhooks/TransferView.php new file mode 100644 index 00000000..20ed624e --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/TransferView.php @@ -0,0 +1,472 @@ + + */ +class TransferView implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransferView'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'categoryData' => '\Adyen\Model\TransactionWebhooks\TransferViewCategoryData', + 'id' => 'string', + 'reference' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'categoryData' => null, + 'id' => null, + 'reference' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'categoryData' => false, + 'id' => false, + 'reference' => 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 = [ + 'categoryData' => 'categoryData', + 'id' => 'id', + 'reference' => 'reference' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'categoryData' => 'setCategoryData', + 'id' => 'setId', + 'reference' => 'setReference' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'categoryData' => 'getCategoryData', + 'id' => 'getId', + 'reference' => 'getReference' + ]; + + /** + * 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('categoryData', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('reference', $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['reference'] === null) { + $invalidProperties[] = "'reference' 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 categoryData + * + * @return \Adyen\Model\TransactionWebhooks\TransferViewCategoryData|null + */ + public function getCategoryData() + { + return $this->container['categoryData']; + } + + /** + * Sets categoryData + * + * @param \Adyen\Model\TransactionWebhooks\TransferViewCategoryData|null $categoryData categoryData + * + * @return self + */ + public function setCategoryData($categoryData) + { + $this->container['categoryData'] = $categoryData; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of the resource. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets reference + * + * @return string + */ + public function getReference() + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string $reference The [`reference`](https://docs.adyen.com/api-explorer/#/transfers/latest/post/transfers__reqParam_reference) from the `/transfers` request. If you haven't provided any, Adyen generates a unique reference. + * + * @return self + */ + public function setReference($reference) + { + $this->container['reference'] = $reference; + + 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/TransactionWebhooks/TransferViewCategoryData.php b/src/Adyen/Model/TransactionWebhooks/TransferViewCategoryData.php new file mode 100644 index 00000000..366a91d4 --- /dev/null +++ b/src/Adyen/Model/TransactionWebhooks/TransferViewCategoryData.php @@ -0,0 +1,815 @@ + + */ +class TransferViewCategoryData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransferView_categoryData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'priority' => 'string', + 'type' => 'string', + 'modificationMerchantReference' => 'string', + 'modificationPspReference' => 'string', + 'authorisationType' => 'string', + 'panEntryMode' => 'string', + 'processingType' => 'string', + 'relayedAuthorisationData' => '\Adyen\Model\TransactionWebhooks\RelayedAuthorisationData', + 'schemeTraceId' => 'string', + 'schemeUniqueTransactionId' => 'string', + 'validationFacts' => '\Adyen\Model\TransactionWebhooks\TransferNotificationValidationFact[]', + 'paymentMerchantReference' => 'string', + 'platformPaymentType' => 'string', + 'pspPaymentReference' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'priority' => null, + 'type' => null, + 'modificationMerchantReference' => null, + 'modificationPspReference' => null, + 'authorisationType' => null, + 'panEntryMode' => null, + 'processingType' => null, + 'relayedAuthorisationData' => null, + 'schemeTraceId' => null, + 'schemeUniqueTransactionId' => null, + 'validationFacts' => null, + 'paymentMerchantReference' => null, + 'platformPaymentType' => null, + 'pspPaymentReference' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'priority' => false, + 'type' => false, + 'modificationMerchantReference' => false, + 'modificationPspReference' => false, + 'authorisationType' => false, + 'panEntryMode' => false, + 'processingType' => false, + 'relayedAuthorisationData' => false, + 'schemeTraceId' => false, + 'schemeUniqueTransactionId' => false, + 'validationFacts' => false, + 'paymentMerchantReference' => false, + 'platformPaymentType' => false, + 'pspPaymentReference' => 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 = [ + 'priority' => 'priority', + 'type' => 'type', + 'modificationMerchantReference' => 'modificationMerchantReference', + 'modificationPspReference' => 'modificationPspReference', + 'authorisationType' => 'authorisationType', + 'panEntryMode' => 'panEntryMode', + 'processingType' => 'processingType', + 'relayedAuthorisationData' => 'relayedAuthorisationData', + 'schemeTraceId' => 'schemeTraceId', + 'schemeUniqueTransactionId' => 'schemeUniqueTransactionId', + 'validationFacts' => 'validationFacts', + 'paymentMerchantReference' => 'paymentMerchantReference', + 'platformPaymentType' => 'platformPaymentType', + 'pspPaymentReference' => 'pspPaymentReference' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'priority' => 'setPriority', + 'type' => 'setType', + 'modificationMerchantReference' => 'setModificationMerchantReference', + 'modificationPspReference' => 'setModificationPspReference', + 'authorisationType' => 'setAuthorisationType', + 'panEntryMode' => 'setPanEntryMode', + 'processingType' => 'setProcessingType', + 'relayedAuthorisationData' => 'setRelayedAuthorisationData', + 'schemeTraceId' => 'setSchemeTraceId', + 'schemeUniqueTransactionId' => 'setSchemeUniqueTransactionId', + 'validationFacts' => 'setValidationFacts', + 'paymentMerchantReference' => 'setPaymentMerchantReference', + 'platformPaymentType' => 'setPlatformPaymentType', + 'pspPaymentReference' => 'setPspPaymentReference' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'priority' => 'getPriority', + 'type' => 'getType', + 'modificationMerchantReference' => 'getModificationMerchantReference', + 'modificationPspReference' => 'getModificationPspReference', + 'authorisationType' => 'getAuthorisationType', + 'panEntryMode' => 'getPanEntryMode', + 'processingType' => 'getProcessingType', + 'relayedAuthorisationData' => 'getRelayedAuthorisationData', + 'schemeTraceId' => 'getSchemeTraceId', + 'schemeUniqueTransactionId' => 'getSchemeUniqueTransactionId', + 'validationFacts' => 'getValidationFacts', + 'paymentMerchantReference' => 'getPaymentMerchantReference', + 'platformPaymentType' => 'getPlatformPaymentType', + 'pspPaymentReference' => 'getPspPaymentReference' + ]; + + /** + * 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('priority', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('modificationMerchantReference', $data ?? [], null); + $this->setIfExists('modificationPspReference', $data ?? [], null); + $this->setIfExists('authorisationType', $data ?? [], null); + $this->setIfExists('panEntryMode', $data ?? [], null); + $this->setIfExists('processingType', $data ?? [], null); + $this->setIfExists('relayedAuthorisationData', $data ?? [], null); + $this->setIfExists('schemeTraceId', $data ?? [], null); + $this->setIfExists('schemeUniqueTransactionId', $data ?? [], null); + $this->setIfExists('validationFacts', $data ?? [], null); + $this->setIfExists('paymentMerchantReference', $data ?? [], null); + $this->setIfExists('platformPaymentType', $data ?? [], null); + $this->setIfExists('pspPaymentReference', $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 priority + * + * @return string|null + */ + public function getPriority() + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param string|null $priority The priority for the bank transfer. This sets the speed at which the transfer is sent and the fees that you have to pay. Required for transfers with `category` **bank**. Possible values: * **regular**: for normal, low-value transactions. * **fast**: a faster way to transfer funds, but the fees are higher. Recommended for high-priority, low-value transactions. * **wire**: the fastest way to transfer funds, but this has the highest fees. Recommended for high-priority, high-value transactions. * **instant**: for instant funds transfers in [SEPA countries](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html). * **crossBorder**: for high-value transfers to a recipient in a different country. * **internal**: for transfers to an Adyen-issued business bank account (by bank account number/IBAN). + * + * @return self + */ + public function setPriority($priority) + { + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type **platformPayment** + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets modificationMerchantReference + * + * @return string|null + */ + public function getModificationMerchantReference() + { + return $this->container['modificationMerchantReference']; + } + + /** + * Sets modificationMerchantReference + * + * @param string|null $modificationMerchantReference The capture's merchant reference included in the transfer. + * + * @return self + */ + public function setModificationMerchantReference($modificationMerchantReference) + { + $this->container['modificationMerchantReference'] = $modificationMerchantReference; + + return $this; + } + + /** + * Gets modificationPspReference + * + * @return string|null + */ + public function getModificationPspReference() + { + return $this->container['modificationPspReference']; + } + + /** + * Sets modificationPspReference + * + * @param string|null $modificationPspReference The capture reference included in the transfer. + * + * @return self + */ + public function setModificationPspReference($modificationPspReference) + { + $this->container['modificationPspReference'] = $modificationPspReference; + + return $this; + } + + /** + * Gets authorisationType + * + * @return string|null + */ + public function getAuthorisationType() + { + return $this->container['authorisationType']; + } + + /** + * Sets authorisationType + * + * @param string|null $authorisationType The authorisation type. For example, **defaultAuthorisation**, **preAuthorisation**, **finalAuthorisation** + * + * @return self + */ + public function setAuthorisationType($authorisationType) + { + $this->container['authorisationType'] = $authorisationType; + + return $this; + } + + /** + * Gets panEntryMode + * + * @return string|null + */ + public function getPanEntryMode() + { + return $this->container['panEntryMode']; + } + + /** + * Sets panEntryMode + * + * @param string|null $panEntryMode Indicates the method used for entering the PAN to initiate a transaction. Possible values: **manual**, **chip**, **magstripe**, **contactless**, **cof**, **ecommerce**, **token**. + * + * @return self + */ + public function setPanEntryMode($panEntryMode) + { + $this->container['panEntryMode'] = $panEntryMode; + + return $this; + } + + /** + * Gets processingType + * + * @return string|null + */ + public function getProcessingType() + { + return $this->container['processingType']; + } + + /** + * Sets processingType + * + * @param string|null $processingType Contains information about how the payment was processed. For example, **ecommerce** for online or **pos** for in-person payments. + * + * @return self + */ + public function setProcessingType($processingType) + { + $this->container['processingType'] = $processingType; + + return $this; + } + + /** + * Gets relayedAuthorisationData + * + * @return \Adyen\Model\TransactionWebhooks\RelayedAuthorisationData|null + */ + public function getRelayedAuthorisationData() + { + return $this->container['relayedAuthorisationData']; + } + + /** + * Sets relayedAuthorisationData + * + * @param \Adyen\Model\TransactionWebhooks\RelayedAuthorisationData|null $relayedAuthorisationData relayedAuthorisationData + * + * @return self + */ + public function setRelayedAuthorisationData($relayedAuthorisationData) + { + $this->container['relayedAuthorisationData'] = $relayedAuthorisationData; + + return $this; + } + + /** + * Gets schemeTraceId + * + * @return string|null + */ + public function getSchemeTraceId() + { + return $this->container['schemeTraceId']; + } + + /** + * Sets schemeTraceId + * + * @param string|null $schemeTraceId The identifier of the original payment. This ID is provided by the scheme and can be alphanumeric or numeric, depending on the scheme. The `schemeTraceID` should refer to an original `schemeUniqueTransactionID` provided in an earlier payment (not necessarily processed by Adyen). A `schemeTraceId` is typically available for authorization adjustments or recurring payments. + * + * @return self + */ + public function setSchemeTraceId($schemeTraceId) + { + $this->container['schemeTraceId'] = $schemeTraceId; + + return $this; + } + + /** + * Gets schemeUniqueTransactionId + * + * @return string|null + */ + public function getSchemeUniqueTransactionId() + { + return $this->container['schemeUniqueTransactionId']; + } + + /** + * Sets schemeUniqueTransactionId + * + * @param string|null $schemeUniqueTransactionId The unique identifier created by the scheme. This ID can be alphanumeric or numeric depending on the scheme. + * + * @return self + */ + public function setSchemeUniqueTransactionId($schemeUniqueTransactionId) + { + $this->container['schemeUniqueTransactionId'] = $schemeUniqueTransactionId; + + return $this; + } + + /** + * Gets validationFacts + * + * @return \Adyen\Model\TransactionWebhooks\TransferNotificationValidationFact[]|null + */ + public function getValidationFacts() + { + return $this->container['validationFacts']; + } + + /** + * Sets validationFacts + * + * @param \Adyen\Model\TransactionWebhooks\TransferNotificationValidationFact[]|null $validationFacts The evaluation of the validation facts. See [validation checks](https://docs.adyen.com/issuing/validation-checks) for more information. + * + * @return self + */ + public function setValidationFacts($validationFacts) + { + $this->container['validationFacts'] = $validationFacts; + + return $this; + } + + /** + * Gets paymentMerchantReference + * + * @return string|null + */ + public function getPaymentMerchantReference() + { + return $this->container['paymentMerchantReference']; + } + + /** + * Sets paymentMerchantReference + * + * @param string|null $paymentMerchantReference The payment's merchant reference included in the transfer. + * + * @return self + */ + public function setPaymentMerchantReference($paymentMerchantReference) + { + $this->container['paymentMerchantReference'] = $paymentMerchantReference; + + return $this; + } + + /** + * Gets platformPaymentType + * + * @return string|null + */ + public function getPlatformPaymentType() + { + return $this->container['platformPaymentType']; + } + + /** + * Sets platformPaymentType + * + * @param string|null $platformPaymentType The type of the related split. + * + * @return self + */ + public function setPlatformPaymentType($platformPaymentType) + { + $this->container['platformPaymentType'] = $platformPaymentType; + + return $this; + } + + /** + * Gets pspPaymentReference + * + * @return string|null + */ + public function getPspPaymentReference() + { + return $this->container['pspPaymentReference']; + } + + /** + * Sets pspPaymentReference + * + * @param string|null $pspPaymentReference The payment reference included in the transfer. + * + * @return self + */ + public function setPspPaymentReference($pspPaymentReference) + { + $this->container['pspPaymentReference'] = $pspPaymentReference; + + 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/TransferWebhooks/ObjectSerializer.php b/src/Adyen/Model/TransferWebhooks/ObjectSerializer.php index 01b25bf2..d05b2690 100644 --- a/src/Adyen/Model/TransferWebhooks/ObjectSerializer.php +++ b/src/Adyen/Model/TransferWebhooks/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Model/Transfers/ObjectSerializer.php b/src/Adyen/Model/Transfers/ObjectSerializer.php index b9cbe36b..349b367b 100644 --- a/src/Adyen/Model/Transfers/ObjectSerializer.php +++ b/src/Adyen/Model/Transfers/ObjectSerializer.php @@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } else { - foreach ($data as $property => $value) { + foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } @@ -117,9 +117,7 @@ public static function sanitizeFilename($filename) */ public static function sanitizeTimestamp($timestamp) { - if (!is_string($timestamp)) { - return $timestamp; - } + if (!is_string($timestamp)) return $timestamp; return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -242,7 +240,8 @@ public static function deserialize($data, $class, $httpHeaders = null) /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (is_array($httpHeaders) + if ( + is_array($httpHeaders) && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { diff --git a/src/Adyen/Service/BalancePlatform/BalanceAccountsApi.php b/src/Adyen/Service/BalancePlatform/BalanceAccountsApi.php index 980edd95..bcb0276b 100644 --- a/src/Adyen/Service/BalancePlatform/BalanceAccountsApi.php +++ b/src/Adyen/Service/BalancePlatform/BalanceAccountsApi.php @@ -76,13 +76,14 @@ public function createSweep(string $balanceAccountId, \Adyen\Model\BalancePlatfo * @param string $balanceAccountId * @param string $sweepId * @param array|null $requestOptions - + * @throws AdyenException */ public function deleteSweep(string $balanceAccountId, string $sweepId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{balanceAccountId}', '{sweepId}'], [$balanceAccountId, $sweepId], "/balanceAccounts/{balanceAccountId}/sweeps/{sweepId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/BalancePlatform/BankAccountValidationApi.php b/src/Adyen/Service/BalancePlatform/BankAccountValidationApi.php index c6114356..99bc3b6b 100644 --- a/src/Adyen/Service/BalancePlatform/BankAccountValidationApi.php +++ b/src/Adyen/Service/BalancePlatform/BankAccountValidationApi.php @@ -44,12 +44,13 @@ public function __construct(Client $client) * * @param \Adyen\Model\BalancePlatform\BankAccountIdentificationValidationRequest $bankAccountIdentificationValidationRequest * @param array|null $requestOptions - + * @throws AdyenException */ public function validateBankAccountIdentification(\Adyen\Model\BalancePlatform\BankAccountIdentificationValidationRequest $bankAccountIdentificationValidationRequest, array $requestOptions = null) { $endpoint = $this->baseURL . "/validateBankAccountIdentification"; $this->requestHttp($endpoint, strtolower('POST'), (array) $bankAccountIdentificationValidationRequest->jsonSerialize(), $requestOptions); + } } diff --git a/src/Adyen/Service/BalancePlatform/ManageSCADevicesApi.php b/src/Adyen/Service/BalancePlatform/ManageSCADevicesApi.php index df3b7a28..50ba91f1 100644 --- a/src/Adyen/Service/BalancePlatform/ManageSCADevicesApi.php +++ b/src/Adyen/Service/BalancePlatform/ManageSCADevicesApi.php @@ -60,13 +60,14 @@ public function completeRegistrationOfScaDevice(string $id, \Adyen\Model\Balance * * @param string $id * @param array|null $requestOptions ['queryParams' => ['paymentInstrumentId'=> string]] - + * @throws AdyenException */ public function deleteRegistrationOfScaDevice(string $id, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/registeredDevices/{id}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/BalancePlatform/NetworkTokensApi.php b/src/Adyen/Service/BalancePlatform/NetworkTokensApi.php index ad86f120..2e704599 100644 --- a/src/Adyen/Service/BalancePlatform/NetworkTokensApi.php +++ b/src/Adyen/Service/BalancePlatform/NetworkTokensApi.php @@ -60,12 +60,13 @@ public function getNetworkToken(string $networkTokenId, array $requestOptions = * @param string $networkTokenId * @param \Adyen\Model\BalancePlatform\UpdateNetworkTokenRequest $updateNetworkTokenRequest * @param array|null $requestOptions - + * @throws AdyenException */ public function updateNetworkToken(string $networkTokenId, \Adyen\Model\BalancePlatform\UpdateNetworkTokenRequest $updateNetworkTokenRequest, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{networkTokenId}'], [$networkTokenId], "/networkTokens/{networkTokenId}"); $this->requestHttp($endpoint, strtolower('PATCH'), (array) $updateNetworkTokenRequest->jsonSerialize(), $requestOptions); + } } diff --git a/src/Adyen/Service/Checkout/RecurringApi.php b/src/Adyen/Service/Checkout/RecurringApi.php index 233c0918..72b257fd 100644 --- a/src/Adyen/Service/Checkout/RecurringApi.php +++ b/src/Adyen/Service/Checkout/RecurringApi.php @@ -44,13 +44,14 @@ public function __construct(Client $client) * * @param string $storedPaymentMethodId * @param array|null $requestOptions ['queryParams' => ['shopperReference'=> string, 'merchantAccount'=> string]] - + * @throws AdyenException */ public function deleteTokenForStoredPaymentDetails(string $storedPaymentMethodId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{storedPaymentMethodId}'], [$storedPaymentMethodId], "/storedPaymentMethods/{storedPaymentMethodId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/LegalEntityManagement/BusinessLinesApi.php b/src/Adyen/Service/LegalEntityManagement/BusinessLinesApi.php index f94b39ed..2551bbc5 100644 --- a/src/Adyen/Service/LegalEntityManagement/BusinessLinesApi.php +++ b/src/Adyen/Service/LegalEntityManagement/BusinessLinesApi.php @@ -59,13 +59,14 @@ public function createBusinessLine(\Adyen\Model\LegalEntityManagement\BusinessLi * * @param string $id * @param array|null $requestOptions - + * @throws AdyenException */ public function deleteBusinessLine(string $id, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/businessLines/{id}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/LegalEntityManagement/DocumentsApi.php b/src/Adyen/Service/LegalEntityManagement/DocumentsApi.php index d834bf55..9a6ea175 100644 --- a/src/Adyen/Service/LegalEntityManagement/DocumentsApi.php +++ b/src/Adyen/Service/LegalEntityManagement/DocumentsApi.php @@ -44,13 +44,14 @@ public function __construct(Client $client) * * @param string $id * @param array|null $requestOptions - + * @throws AdyenException */ public function deleteDocument(string $id, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/documents/{id}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/LegalEntityManagement/TaxEDeliveryConsentApi.php b/src/Adyen/Service/LegalEntityManagement/TaxEDeliveryConsentApi.php index b61d2b23..714550af 100644 --- a/src/Adyen/Service/LegalEntityManagement/TaxEDeliveryConsentApi.php +++ b/src/Adyen/Service/LegalEntityManagement/TaxEDeliveryConsentApi.php @@ -60,12 +60,13 @@ public function checkStatusOfConsentForElectronicDeliveryOfTaxForms(string $id, * @param string $id * @param \Adyen\Model\LegalEntityManagement\SetTaxElectronicDeliveryConsentRequest $setTaxElectronicDeliveryConsentRequest * @param array|null $requestOptions - + * @throws AdyenException */ public function setConsentStatusForElectronicDeliveryOfTaxForms(string $id, \Adyen\Model\LegalEntityManagement\SetTaxElectronicDeliveryConsentRequest $setTaxElectronicDeliveryConsentRequest, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/legalEntities/{id}/setTaxElectronicDeliveryConsent"); $this->requestHttp($endpoint, strtolower('POST'), (array) $setTaxElectronicDeliveryConsentRequest->jsonSerialize(), $requestOptions); + } } diff --git a/src/Adyen/Service/LegalEntityManagement/TermsOfServiceApi.php b/src/Adyen/Service/LegalEntityManagement/TermsOfServiceApi.php index 4db8819b..f3ccef0b 100644 --- a/src/Adyen/Service/LegalEntityManagement/TermsOfServiceApi.php +++ b/src/Adyen/Service/LegalEntityManagement/TermsOfServiceApi.php @@ -56,6 +56,22 @@ public function acceptTermsOfService(string $id, string $termsofservicedocumenti return ObjectSerializer::deserialize($response, \Adyen\Model\LegalEntityManagement\AcceptTermsOfServiceResponse::class); } + /** + * Get accepted Terms of Service document + * + * @param string $id + * @param string $termsofserviceacceptancereference + * @param array|null $requestOptions ['queryParams' => ['termsOfServiceDocumentFormat'=> string]] + * @return \Adyen\Model\LegalEntityManagement\GetAcceptedTermsOfServiceDocumentResponse + * @throws AdyenException + */ + public function getAcceptedTermsOfServiceDocument(string $id, string $termsofserviceacceptancereference, array $requestOptions = null): \Adyen\Model\LegalEntityManagement\GetAcceptedTermsOfServiceDocumentResponse + { + $endpoint = $this->baseURL . str_replace(['{id}', '{termsofserviceacceptancereference}'], [$id, $termsofserviceacceptancereference], "/legalEntities/{id}/acceptedTermsOfServiceDocument/{termsofserviceacceptancereference}"); + $response = $this->requestHttp($endpoint, strtolower('GET'), null, $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\LegalEntityManagement\GetAcceptedTermsOfServiceDocumentResponse::class); + } + /** * Get Terms of Service document * diff --git a/src/Adyen/Service/LegalEntityManagement/TransferInstrumentsApi.php b/src/Adyen/Service/LegalEntityManagement/TransferInstrumentsApi.php index 70c2e076..3bf8aeaa 100644 --- a/src/Adyen/Service/LegalEntityManagement/TransferInstrumentsApi.php +++ b/src/Adyen/Service/LegalEntityManagement/TransferInstrumentsApi.php @@ -59,13 +59,14 @@ public function createTransferInstrument(\Adyen\Model\LegalEntityManagement\Tran * * @param string $id * @param array|null $requestOptions - + * @throws AdyenException */ public function deleteTransferInstrument(string $id, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/transferInstruments/{id}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/Management/AllowedOriginsCompanyLevelApi.php b/src/Adyen/Service/Management/AllowedOriginsCompanyLevelApi.php index c2557d39..60813025 100644 --- a/src/Adyen/Service/Management/AllowedOriginsCompanyLevelApi.php +++ b/src/Adyen/Service/Management/AllowedOriginsCompanyLevelApi.php @@ -63,13 +63,14 @@ public function createAllowedOrigin(string $companyId, string $apiCredentialId, * @param string $apiCredentialId * @param string $originId * @param array|null $requestOptions - + * @throws AdyenException */ public function deleteAllowedOrigin(string $companyId, string $apiCredentialId, string $originId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{companyId}', '{apiCredentialId}', '{originId}'], [$companyId, $apiCredentialId, $originId], "/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/Management/AllowedOriginsMerchantLevelApi.php b/src/Adyen/Service/Management/AllowedOriginsMerchantLevelApi.php index 1b40d271..ec0d042a 100644 --- a/src/Adyen/Service/Management/AllowedOriginsMerchantLevelApi.php +++ b/src/Adyen/Service/Management/AllowedOriginsMerchantLevelApi.php @@ -63,13 +63,14 @@ public function createAllowedOrigin(string $merchantId, string $apiCredentialId, * @param string $apiCredentialId * @param string $originId * @param array|null $requestOptions - + * @throws AdyenException */ public function deleteAllowedOrigin(string $merchantId, string $apiCredentialId, string $originId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{merchantId}', '{apiCredentialId}', '{originId}'], [$merchantId, $apiCredentialId, $originId], "/merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/Management/MyAPICredentialApi.php b/src/Adyen/Service/Management/MyAPICredentialApi.php index 54005b35..65cdadc5 100644 --- a/src/Adyen/Service/Management/MyAPICredentialApi.php +++ b/src/Adyen/Service/Management/MyAPICredentialApi.php @@ -116,12 +116,13 @@ public function getApiCredentialDetails(array $requestOptions = null): \Adyen\Mo * * @param string $originId * @param array|null $requestOptions - + * @throws AdyenException */ public function removeAllowedOrigin(string $originId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{originId}'], [$originId], "/me/allowedOrigins/{originId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } } diff --git a/src/Adyen/Service/Management/PaymentMethodsMerchantLevelApi.php b/src/Adyen/Service/Management/PaymentMethodsMerchantLevelApi.php index f8b7cc0b..4f955b8b 100644 --- a/src/Adyen/Service/Management/PaymentMethodsMerchantLevelApi.php +++ b/src/Adyen/Service/Management/PaymentMethodsMerchantLevelApi.php @@ -46,13 +46,14 @@ public function __construct(Client $client) * @param string $paymentMethodId * @param \Adyen\Model\Management\ApplePayInfo $applePayInfo * @param array|null $requestOptions - + * @throws AdyenException */ public function addApplePayDomain(string $merchantId, string $paymentMethodId, \Adyen\Model\Management\ApplePayInfo $applePayInfo, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{merchantId}', '{paymentMethodId}'], [$merchantId, $paymentMethodId], "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}/addApplePayDomains"); $this->requestHttp($endpoint, strtolower('POST'), (array) $applePayInfo->jsonSerialize(), $requestOptions); + } /** diff --git a/src/Adyen/Service/Management/PayoutSettingsMerchantLevelApi.php b/src/Adyen/Service/Management/PayoutSettingsMerchantLevelApi.php index efff80b6..499e7895 100644 --- a/src/Adyen/Service/Management/PayoutSettingsMerchantLevelApi.php +++ b/src/Adyen/Service/Management/PayoutSettingsMerchantLevelApi.php @@ -61,13 +61,14 @@ public function addPayoutSetting(string $merchantId, \Adyen\Model\Management\Pay * @param string $merchantId * @param string $payoutSettingsId * @param array|null $requestOptions - + * @throws AdyenException */ public function deletePayoutSetting(string $merchantId, string $payoutSettingsId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{merchantId}', '{payoutSettingsId}'], [$merchantId, $payoutSettingsId], "/merchants/{merchantId}/payoutSettings/{payoutSettingsId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/Management/TerminalsTerminalLevelApi.php b/src/Adyen/Service/Management/TerminalsTerminalLevelApi.php index 8a7c5e73..8b6d78c7 100644 --- a/src/Adyen/Service/Management/TerminalsTerminalLevelApi.php +++ b/src/Adyen/Service/Management/TerminalsTerminalLevelApi.php @@ -59,12 +59,13 @@ public function listTerminals(array $requestOptions = null): \Adyen\Model\Manage * @param string $terminalId * @param \Adyen\Model\Management\TerminalReassignmentRequest $terminalReassignmentRequest * @param array|null $requestOptions - + * @throws AdyenException */ public function reassignTerminal(string $terminalId, \Adyen\Model\Management\TerminalReassignmentRequest $terminalReassignmentRequest, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{terminalId}'], [$terminalId], "/terminals/{terminalId}/reassign"); $this->requestHttp($endpoint, strtolower('POST'), (array) $terminalReassignmentRequest->jsonSerialize(), $requestOptions); + } } diff --git a/src/Adyen/Service/Management/WebhooksCompanyLevelApi.php b/src/Adyen/Service/Management/WebhooksCompanyLevelApi.php index cfe85a38..6caa292a 100644 --- a/src/Adyen/Service/Management/WebhooksCompanyLevelApi.php +++ b/src/Adyen/Service/Management/WebhooksCompanyLevelApi.php @@ -92,13 +92,14 @@ public function listAllWebhooks(string $companyId, array $requestOptions = null) * @param string $companyId * @param string $webhookId * @param array|null $requestOptions - + * @throws AdyenException */ public function removeWebhook(string $companyId, string $webhookId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{companyId}', '{webhookId}'], [$companyId, $webhookId], "/companies/{companyId}/webhooks/{webhookId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/Management/WebhooksMerchantLevelApi.php b/src/Adyen/Service/Management/WebhooksMerchantLevelApi.php index 968e9c61..7113c9c3 100644 --- a/src/Adyen/Service/Management/WebhooksMerchantLevelApi.php +++ b/src/Adyen/Service/Management/WebhooksMerchantLevelApi.php @@ -92,13 +92,14 @@ public function listAllWebhooks(string $merchantId, array $requestOptions = null * @param string $merchantId * @param string $webhookId * @param array|null $requestOptions - + * @throws AdyenException */ public function removeWebhook(string $merchantId, string $webhookId, array $requestOptions = null) { $endpoint = $this->baseURL . str_replace(['{merchantId}', '{webhookId}'], [$merchantId, $webhookId], "/merchants/{merchantId}/webhooks/{webhookId}"); $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } /** diff --git a/src/Adyen/Service/Transfers/TransfersApi.php b/src/Adyen/Service/Transfers/TransfersApi.php index 869e9d60..7b62cec3 100644 --- a/src/Adyen/Service/Transfers/TransfersApi.php +++ b/src/Adyen/Service/Transfers/TransfersApi.php @@ -44,13 +44,14 @@ public function __construct(Client $client) * * @param \Adyen\Model\Transfers\ApproveTransfersRequest $approveTransfersRequest * @param array|null $requestOptions - + * @throws AdyenException */ public function approveInitiatedTransfers(\Adyen\Model\Transfers\ApproveTransfersRequest $approveTransfersRequest, array $requestOptions = null) { $endpoint = $this->baseURL . "/transfers/approve"; $this->requestHttp($endpoint, strtolower('POST'), (array) $approveTransfersRequest->jsonSerialize(), $requestOptions); + } /** @@ -58,13 +59,14 @@ public function approveInitiatedTransfers(\Adyen\Model\Transfers\ApproveTransfer * * @param \Adyen\Model\Transfers\CancelTransfersRequest $cancelTransfersRequest * @param array|null $requestOptions - + * @throws AdyenException */ public function cancelInitiatedTransfers(\Adyen\Model\Transfers\CancelTransfersRequest $cancelTransfersRequest, array $requestOptions = null) { $endpoint = $this->baseURL . "/transfers/cancel"; $this->requestHttp($endpoint, strtolower('POST'), (array) $cancelTransfersRequest->jsonSerialize(), $requestOptions); + } /**