diff --git a/src/Adyen/Model/BalancePlatform/ApproveTransferLimitRequest.php b/src/Adyen/Model/BalancePlatform/ApproveTransferLimitRequest.php new file mode 100644 index 000000000..80e09cbea --- /dev/null +++ b/src/Adyen/Model/BalancePlatform/ApproveTransferLimitRequest.php @@ -0,0 +1,407 @@ + + */ +class ApproveTransferLimitRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ApproveTransferLimitRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transferLimitIds' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transferLimitIds' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transferLimitIds' => 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 = [ + 'transferLimitIds' => 'transferLimitIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transferLimitIds' => 'setTransferLimitIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transferLimitIds' => 'getTransferLimitIds' + ]; + + /** + * 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('transferLimitIds', $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['transferLimitIds'] === null) { + $invalidProperties[] = "'transferLimitIds' 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 transferLimitIds + * + * @return string[] + */ + public function getTransferLimitIds() + { + return $this->container['transferLimitIds']; + } + + /** + * Sets transferLimitIds + * + * @param string[] $transferLimitIds A list that includes the `transferLimitId` of all the pending transfer limits you want to approve. + * + * @return self + */ + public function setTransferLimitIds($transferLimitIds) + { + $this->container['transferLimitIds'] = $transferLimitIds; + + 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/BalancePlatform/CreateScaInformation.php b/src/Adyen/Model/BalancePlatform/CreateScaInformation.php new file mode 100644 index 000000000..be3790060 --- /dev/null +++ b/src/Adyen/Model/BalancePlatform/CreateScaInformation.php @@ -0,0 +1,435 @@ + + */ +class CreateScaInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateScaInformation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exemption' => '\Adyen\Model\BalancePlatform\ScaExemption', + 'scaOnApproval' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exemption' => null, + 'scaOnApproval' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'exemption' => false, + 'scaOnApproval' => 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 = [ + 'exemption' => 'exemption', + 'scaOnApproval' => 'scaOnApproval' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exemption' => 'setExemption', + 'scaOnApproval' => 'setScaOnApproval' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exemption' => 'getExemption', + 'scaOnApproval' => 'getScaOnApproval' + ]; + + /** + * 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('exemption', $data ?? [], null); + $this->setIfExists('scaOnApproval', $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 exemption + * + * @return \Adyen\Model\BalancePlatform\ScaExemption|null + */ + public function getExemption() + { + return $this->container['exemption']; + } + + /** + * Sets exemption + * + * @param \Adyen\Model\BalancePlatform\ScaExemption|null $exemption exemption + * + * @return self + */ + public function setExemption($exemption) + { + $this->container['exemption'] = $exemption; + + return $this; + } + + /** + * Gets scaOnApproval + * + * @return bool|null + */ + public function getScaOnApproval() + { + return $this->container['scaOnApproval']; + } + + /** + * Sets scaOnApproval + * + * @param bool|null $scaOnApproval Indicates whether to initiate Strong Customer Authentication (SCA) later, during approval, or immediately after you submit this request. Possible values: * **true**: you can initiate SCA later, during approval, for all pending transfer limits. * **false** (default): you initiate SCA immediately after submitting the transfer limit request. + * + * @return self + */ + public function setScaOnApproval($scaOnApproval) + { + $this->container['scaOnApproval'] = $scaOnApproval; + + 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/BalancePlatform/CreateTransferLimitRequest.php b/src/Adyen/Model/BalancePlatform/CreateTransferLimitRequest.php new file mode 100644 index 000000000..f35a6c155 --- /dev/null +++ b/src/Adyen/Model/BalancePlatform/CreateTransferLimitRequest.php @@ -0,0 +1,599 @@ + + */ +class CreateTransferLimitRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateTransferLimitRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\Adyen\Model\BalancePlatform\Amount', + 'endsAt' => '\DateTime', + 'reference' => 'string', + 'scaInformation' => '\Adyen\Model\BalancePlatform\CreateScaInformation', + 'scope' => '\Adyen\Model\BalancePlatform\Scope', + 'startsAt' => '\DateTime', + 'transferType' => '\Adyen\Model\BalancePlatform\TransferType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'endsAt' => 'date-time', + 'reference' => null, + 'scaInformation' => null, + 'scope' => null, + 'startsAt' => 'date-time', + 'transferType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'amount' => false, + 'endsAt' => false, + 'reference' => false, + 'scaInformation' => false, + 'scope' => false, + 'startsAt' => false, + 'transferType' => 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 = [ + 'amount' => 'amount', + 'endsAt' => 'endsAt', + 'reference' => 'reference', + 'scaInformation' => 'scaInformation', + 'scope' => 'scope', + 'startsAt' => 'startsAt', + 'transferType' => 'transferType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'endsAt' => 'setEndsAt', + 'reference' => 'setReference', + 'scaInformation' => 'setScaInformation', + 'scope' => 'setScope', + 'startsAt' => 'setStartsAt', + 'transferType' => 'setTransferType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'endsAt' => 'getEndsAt', + 'reference' => 'getReference', + 'scaInformation' => 'getScaInformation', + 'scope' => 'getScope', + 'startsAt' => 'getStartsAt', + 'transferType' => 'getTransferType' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('endsAt', $data ?? [], null); + $this->setIfExists('reference', $data ?? [], null); + $this->setIfExists('scaInformation', $data ?? [], null); + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('startsAt', $data ?? [], null); + $this->setIfExists('transferType', $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['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['scope'] === null) { + $invalidProperties[] = "'scope' can't be null"; + } + if ($this->container['transferType'] === null) { + $invalidProperties[] = "'transferType' 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 amount + * + * @return \Adyen\Model\BalancePlatform\Amount + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \Adyen\Model\BalancePlatform\Amount $amount amount + * + * @return self + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets endsAt + * + * @return \DateTime|null + */ + public function getEndsAt() + { + return $this->container['endsAt']; + } + + /** + * Sets endsAt + * + * @param \DateTime|null $endsAt The date and time when the transfer limit becomes inactive. If you do not specify an end date, the limit stays active until you override it with a new limit. Format [ISO 8601](https://www.w3.org/TR/NOTE-datetime): **YYYY-MM-DDThh:mm:ss.sssTZD** + * + * @return self + */ + public function setEndsAt($endsAt) + { + $this->container['endsAt'] = $endsAt; + + return $this; + } + + /** + * Gets reference + * + * @return string|null + */ + public function getReference() + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string|null $reference Your reference for the transfer limit. + * + * @return self + */ + public function setReference($reference) + { + $this->container['reference'] = $reference; + + return $this; + } + + /** + * Gets scaInformation + * + * @return \Adyen\Model\BalancePlatform\CreateScaInformation|null + */ + public function getScaInformation() + { + return $this->container['scaInformation']; + } + + /** + * Sets scaInformation + * + * @param \Adyen\Model\BalancePlatform\CreateScaInformation|null $scaInformation scaInformation + * + * @return self + */ + public function setScaInformation($scaInformation) + { + $this->container['scaInformation'] = $scaInformation; + + return $this; + } + + /** + * Gets scope + * + * @return \Adyen\Model\BalancePlatform\Scope + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param \Adyen\Model\BalancePlatform\Scope $scope scope + * + * @return self + */ + public function setScope($scope) + { + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets startsAt + * + * @return \DateTime|null + */ + public function getStartsAt() + { + return $this->container['startsAt']; + } + + /** + * Sets startsAt + * + * @param \DateTime|null $startsAt The date and time when the transfer limit becomes active. If you specify a date in the future, we will schedule a transfer limit. Format [ISO 8601](https://www.w3.org/TR/NOTE-datetime): **YYYY-MM-DDThh:mm:ss.sssTZD** + * + * @return self + */ + public function setStartsAt($startsAt) + { + $this->container['startsAt'] = $startsAt; + + return $this; + } + + /** + * Gets transferType + * + * @return \Adyen\Model\BalancePlatform\TransferType + */ + public function getTransferType() + { + return $this->container['transferType']; + } + + /** + * Sets transferType + * + * @param \Adyen\Model\BalancePlatform\TransferType $transferType transferType + * + * @return self + */ + public function setTransferType($transferType) + { + $this->container['transferType'] = $transferType; + + 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/BalancePlatform/LimitStatus.php b/src/Adyen/Model/BalancePlatform/LimitStatus.php new file mode 100644 index 000000000..0100348c5 --- /dev/null +++ b/src/Adyen/Model/BalancePlatform/LimitStatus.php @@ -0,0 +1,53 @@ + + */ +class ScaInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ScaInformation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exemption' => '\Adyen\Model\BalancePlatform\ScaExemption', + 'status' => '\Adyen\Model\BalancePlatform\ScaStatus' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exemption' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'exemption' => false, + 'status' => 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 = [ + 'exemption' => 'exemption', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exemption' => 'setExemption', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exemption' => 'getExemption', + 'status' => 'getStatus' + ]; + + /** + * 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('exemption', $data ?? [], null); + $this->setIfExists('status', $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['status'] === null) { + $invalidProperties[] = "'status' 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 exemption + * + * @return \Adyen\Model\BalancePlatform\ScaExemption|null + */ + public function getExemption() + { + return $this->container['exemption']; + } + + /** + * Sets exemption + * + * @param \Adyen\Model\BalancePlatform\ScaExemption|null $exemption exemption + * + * @return self + */ + public function setExemption($exemption) + { + $this->container['exemption'] = $exemption; + + return $this; + } + + /** + * Gets status + * + * @return \Adyen\Model\BalancePlatform\ScaStatus + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Adyen\Model\BalancePlatform\ScaStatus $status status + * + * @return self + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + 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/BalancePlatform/ScaStatus.php b/src/Adyen/Model/BalancePlatform/ScaStatus.php new file mode 100644 index 000000000..818f96696 --- /dev/null +++ b/src/Adyen/Model/BalancePlatform/ScaStatus.php @@ -0,0 +1,50 @@ + + */ +class TransferLimit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransferLimit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\Adyen\Model\BalancePlatform\Amount', + 'endsAt' => '\DateTime', + 'id' => 'string', + 'limitStatus' => '\Adyen\Model\BalancePlatform\LimitStatus', + 'reference' => 'string', + 'scaInformation' => '\Adyen\Model\BalancePlatform\ScaInformation', + 'scope' => '\Adyen\Model\BalancePlatform\Scope', + 'startsAt' => '\DateTime', + 'transferType' => '\Adyen\Model\BalancePlatform\TransferType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'endsAt' => 'date-time', + 'id' => null, + 'limitStatus' => null, + 'reference' => null, + 'scaInformation' => null, + 'scope' => null, + 'startsAt' => 'date-time', + 'transferType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'amount' => false, + 'endsAt' => false, + 'id' => false, + 'limitStatus' => false, + 'reference' => false, + 'scaInformation' => false, + 'scope' => false, + 'startsAt' => false, + 'transferType' => 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 = [ + 'amount' => 'amount', + 'endsAt' => 'endsAt', + 'id' => 'id', + 'limitStatus' => 'limitStatus', + 'reference' => 'reference', + 'scaInformation' => 'scaInformation', + 'scope' => 'scope', + 'startsAt' => 'startsAt', + 'transferType' => 'transferType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'endsAt' => 'setEndsAt', + 'id' => 'setId', + 'limitStatus' => 'setLimitStatus', + 'reference' => 'setReference', + 'scaInformation' => 'setScaInformation', + 'scope' => 'setScope', + 'startsAt' => 'setStartsAt', + 'transferType' => 'setTransferType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'endsAt' => 'getEndsAt', + 'id' => 'getId', + 'limitStatus' => 'getLimitStatus', + 'reference' => 'getReference', + 'scaInformation' => 'getScaInformation', + 'scope' => 'getScope', + 'startsAt' => 'getStartsAt', + 'transferType' => 'getTransferType' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('endsAt', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('limitStatus', $data ?? [], null); + $this->setIfExists('reference', $data ?? [], null); + $this->setIfExists('scaInformation', $data ?? [], null); + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('startsAt', $data ?? [], null); + $this->setIfExists('transferType', $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['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['limitStatus'] === null) { + $invalidProperties[] = "'limitStatus' can't be null"; + } + if ($this->container['scope'] === null) { + $invalidProperties[] = "'scope' can't be null"; + } + if ($this->container['startsAt'] === null) { + $invalidProperties[] = "'startsAt' can't be null"; + } + if ($this->container['transferType'] === null) { + $invalidProperties[] = "'transferType' 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 amount + * + * @return \Adyen\Model\BalancePlatform\Amount + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \Adyen\Model\BalancePlatform\Amount $amount amount + * + * @return self + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets endsAt + * + * @return \DateTime|null + */ + public function getEndsAt() + { + return $this->container['endsAt']; + } + + /** + * Sets endsAt + * + * @param \DateTime|null $endsAt The date and time when the transfer limit becomes inactive. If you do not specify an end date, the limit stays active until you override it with a new limit. Format [ISO 8601](https://www.w3.org/TR/NOTE-datetime): **YYYY-MM-DDThh:mm:ss.sssTZD** + * + * @return self + */ + public function setEndsAt($endsAt) + { + $this->container['endsAt'] = $endsAt; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The unique identifier of the transfer limit. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets limitStatus + * + * @return \Adyen\Model\BalancePlatform\LimitStatus + */ + public function getLimitStatus() + { + return $this->container['limitStatus']; + } + + /** + * Sets limitStatus + * + * @param \Adyen\Model\BalancePlatform\LimitStatus $limitStatus limitStatus + * + * @return self + */ + public function setLimitStatus($limitStatus) + { + $this->container['limitStatus'] = $limitStatus; + + return $this; + } + + /** + * Gets reference + * + * @return string|null + */ + public function getReference() + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string|null $reference Your reference for the transfer limit. + * + * @return self + */ + public function setReference($reference) + { + $this->container['reference'] = $reference; + + return $this; + } + + /** + * Gets scaInformation + * + * @return \Adyen\Model\BalancePlatform\ScaInformation|null + */ + public function getScaInformation() + { + return $this->container['scaInformation']; + } + + /** + * Sets scaInformation + * + * @param \Adyen\Model\BalancePlatform\ScaInformation|null $scaInformation scaInformation + * + * @return self + */ + public function setScaInformation($scaInformation) + { + $this->container['scaInformation'] = $scaInformation; + + return $this; + } + + /** + * Gets scope + * + * @return \Adyen\Model\BalancePlatform\Scope + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param \Adyen\Model\BalancePlatform\Scope $scope scope + * + * @return self + */ + public function setScope($scope) + { + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets startsAt + * + * @return \DateTime + */ + public function getStartsAt() + { + return $this->container['startsAt']; + } + + /** + * Sets startsAt + * + * @param \DateTime $startsAt The date and time when the transfer limit becomes active. If you specify a date in the future, we will schedule a transfer limit. Format [ISO 8601](https://www.w3.org/TR/NOTE-datetime): **YYYY-MM-DDThh:mm:ss.sssTZD** + * + * @return self + */ + public function setStartsAt($startsAt) + { + $this->container['startsAt'] = $startsAt; + + return $this; + } + + /** + * Gets transferType + * + * @return \Adyen\Model\BalancePlatform\TransferType + */ + public function getTransferType() + { + return $this->container['transferType']; + } + + /** + * Sets transferType + * + * @param \Adyen\Model\BalancePlatform\TransferType $transferType transferType + * + * @return self + */ + public function setTransferType($transferType) + { + $this->container['transferType'] = $transferType; + + 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/BalancePlatform/TransferLimitListResponse.php b/src/Adyen/Model/BalancePlatform/TransferLimitListResponse.php new file mode 100644 index 000000000..403cbd360 --- /dev/null +++ b/src/Adyen/Model/BalancePlatform/TransferLimitListResponse.php @@ -0,0 +1,407 @@ + + */ +class TransferLimitListResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransferLimitListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transferLimits' => '\Adyen\Model\BalancePlatform\TransferLimit[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transferLimits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static $openAPINullables = [ + 'transferLimits' => 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 = [ + 'transferLimits' => 'transferLimits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transferLimits' => 'setTransferLimits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transferLimits' => 'getTransferLimits' + ]; + + /** + * 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('transferLimits', $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['transferLimits'] === null) { + $invalidProperties[] = "'transferLimits' 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 transferLimits + * + * @return \Adyen\Model\BalancePlatform\TransferLimit[] + */ + public function getTransferLimits() + { + return $this->container['transferLimits']; + } + + /** + * Sets transferLimits + * + * @param \Adyen\Model\BalancePlatform\TransferLimit[] $transferLimits List of available transfer limits. + * + * @return self + */ + public function setTransferLimits($transferLimits) + { + $this->container['transferLimits'] = $transferLimits; + + 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/BalancePlatform/TransferType.php b/src/Adyen/Model/BalancePlatform/TransferType.php new file mode 100644 index 000000000..2976ebab3 --- /dev/null +++ b/src/Adyen/Model/BalancePlatform/TransferType.php @@ -0,0 +1,47 @@ +baseURL = $this->createBaseUrl("https://balanceplatform-api-test.adyen.com/bcl/v2"); + } + + /** + * Approve pending transfer limits + * + * @param string $id + * @param \Adyen\Model\BalancePlatform\ApproveTransferLimitRequest $approveTransferLimitRequest + * @param array|null $requestOptions + + * @throws AdyenException + */ + public function approvePendingTransferLimits(string $id, \Adyen\Model\BalancePlatform\ApproveTransferLimitRequest $approveTransferLimitRequest, ?array $requestOptions = null) + { + $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/balanceAccounts/{id}/transferLimits/approve"); + $this->requestHttp($endpoint, strtolower('POST'), (array) $approveTransferLimitRequest->jsonSerialize(), $requestOptions); + } + + /** + * Create a transfer limit + * + * @param string $id + * @param \Adyen\Model\BalancePlatform\CreateTransferLimitRequest $createTransferLimitRequest + * @param array|null $requestOptions + * @return \Adyen\Model\BalancePlatform\TransferLimit + * @throws AdyenException + */ + public function createTransferLimit(string $id, \Adyen\Model\BalancePlatform\CreateTransferLimitRequest $createTransferLimitRequest, ?array $requestOptions = null): \Adyen\Model\BalancePlatform\TransferLimit + { + $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/balanceAccounts/{id}/transferLimits"); + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $createTransferLimitRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\BalancePlatform\TransferLimit::class); + } + + /** + * Delete a scheduled or pending transfer limit + * + * @param string $id + * @param string $transferLimitId + * @param array|null $requestOptions + + * @throws AdyenException + */ + public function deletePendingTransferLimit(string $id, string $transferLimitId, ?array $requestOptions = null) + { + $endpoint = $this->baseURL . str_replace(['{id}', '{transferLimitId}'], [$id, $transferLimitId], "/balanceAccounts/{id}/transferLimits/{transferLimitId}"); + $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } + + /** + * Get all current transfer limits + * + * @param string $id + * @param array|null $requestOptions ['queryParams' => ['scope'=> Scope, 'transferType'=> TransferType]] + * @return \Adyen\Model\BalancePlatform\TransferLimitListResponse + * @throws AdyenException + */ + public function getCurrentTransferLimits(string $id, ?array $requestOptions = null): \Adyen\Model\BalancePlatform\TransferLimitListResponse + { + $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/balanceAccounts/{id}/transferLimits/current"); + $response = $this->requestHttp($endpoint, strtolower('GET'), null, $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\BalancePlatform\TransferLimitListResponse::class); + } + + /** + * Get the details of a transfer limit + * + * @param string $id + * @param string $transferLimitId + * @param array|null $requestOptions + * @return \Adyen\Model\BalancePlatform\TransferLimit + * @throws AdyenException + */ + public function getSpecificTransferLimit(string $id, string $transferLimitId, ?array $requestOptions = null): \Adyen\Model\BalancePlatform\TransferLimit + { + $endpoint = $this->baseURL . str_replace(['{id}', '{transferLimitId}'], [$id, $transferLimitId], "/balanceAccounts/{id}/transferLimits/{transferLimitId}"); + $response = $this->requestHttp($endpoint, strtolower('GET'), null, $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\BalancePlatform\TransferLimit::class); + } + + /** + * Filter and view the transfer limits + * + * @param string $id + * @param array|null $requestOptions ['queryParams' => ['scope'=> Scope, 'transferType'=> TransferType, 'status'=> LimitStatus]] + * @return \Adyen\Model\BalancePlatform\TransferLimitListResponse + * @throws AdyenException + */ + public function getTransferLimits(string $id, ?array $requestOptions = null): \Adyen\Model\BalancePlatform\TransferLimitListResponse + { + $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/balanceAccounts/{id}/transferLimits"); + $response = $this->requestHttp($endpoint, strtolower('GET'), null, $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\BalancePlatform\TransferLimitListResponse::class); + } +} diff --git a/src/Adyen/Service/BalancePlatform/TransferLimitsBalancePlatformLevelApi.php b/src/Adyen/Service/BalancePlatform/TransferLimitsBalancePlatformLevelApi.php new file mode 100644 index 000000000..34121d895 --- /dev/null +++ b/src/Adyen/Service/BalancePlatform/TransferLimitsBalancePlatformLevelApi.php @@ -0,0 +1,103 @@ +baseURL = $this->createBaseUrl("https://balanceplatform-api-test.adyen.com/bcl/v2"); + } + + /** + * Create a transfer limit + * + * @param string $id + * @param \Adyen\Model\BalancePlatform\CreateTransferLimitRequest $createTransferLimitRequest + * @param array|null $requestOptions + * @return \Adyen\Model\BalancePlatform\TransferLimit + * @throws AdyenException + */ + public function createTransferLimit(string $id, \Adyen\Model\BalancePlatform\CreateTransferLimitRequest $createTransferLimitRequest, ?array $requestOptions = null): \Adyen\Model\BalancePlatform\TransferLimit + { + $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/balancePlatforms/{id}/transferLimits"); + $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $createTransferLimitRequest->jsonSerialize(), $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\BalancePlatform\TransferLimit::class); + } + + /** + * Delete a scheduled or pending transfer limit + * + * @param string $id + * @param string $transferLimitId + * @param array|null $requestOptions + + * @throws AdyenException + */ + public function deletePendingTransferLimit(string $id, string $transferLimitId, ?array $requestOptions = null) + { + $endpoint = $this->baseURL . str_replace(['{id}', '{transferLimitId}'], [$id, $transferLimitId], "/balancePlatforms/{id}/transferLimits/{transferLimitId}"); + $this->requestHttp($endpoint, strtolower('DELETE'), null, $requestOptions); + } + + /** + * Get the details of a transfer limit + * + * @param string $id + * @param string $transferLimitId + * @param array|null $requestOptions + * @return \Adyen\Model\BalancePlatform\TransferLimit + * @throws AdyenException + */ + public function getSpecificTransferLimit(string $id, string $transferLimitId, ?array $requestOptions = null): \Adyen\Model\BalancePlatform\TransferLimit + { + $endpoint = $this->baseURL . str_replace(['{id}', '{transferLimitId}'], [$id, $transferLimitId], "/balancePlatforms/{id}/transferLimits/{transferLimitId}"); + $response = $this->requestHttp($endpoint, strtolower('GET'), null, $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\BalancePlatform\TransferLimit::class); + } + + /** + * Filter and view the transfer limits + * + * @param string $id + * @param array|null $requestOptions ['queryParams' => ['scope'=> Scope, 'transferType'=> TransferType, 'status'=> LimitStatus]] + * @return \Adyen\Model\BalancePlatform\TransferLimitListResponse + * @throws AdyenException + */ + public function getTransferLimits(string $id, ?array $requestOptions = null): \Adyen\Model\BalancePlatform\TransferLimitListResponse + { + $endpoint = $this->baseURL . str_replace(['{id}'], [$id], "/balancePlatforms/{id}/transferLimits"); + $response = $this->requestHttp($endpoint, strtolower('GET'), null, $requestOptions); + return ObjectSerializer::deserialize($response, \Adyen\Model\BalancePlatform\TransferLimitListResponse::class); + } +} diff --git a/tests/Resources/BalancePlatform/get-current-transfer-limits.json b/tests/Resources/BalancePlatform/get-current-transfer-limits.json new file mode 100644 index 000000000..08388b236 --- /dev/null +++ b/tests/Resources/BalancePlatform/get-current-transfer-limits.json @@ -0,0 +1,21 @@ +{ + "transferLimits": [ + { + "amount": { + "value": 10000, + "currency": "EUR" + }, + "id": "TRLI00000000000000000000000001", + "endsAt": "2026-08-13T23:00:00+01:00", + "scope": "perDay", + "reference": "Your reference for the transfer limit", + "scaInformation": { + "exemption": "initialLimit", + "status": "notPerformed" + }, + "startsAt": "2025-08-13T23:00:00+01:00", + "limitStatus": "active", + "transferType": "instant" + } + ] +} \ No newline at end of file diff --git a/tests/Unit/BalancePlatformTest.php b/tests/Unit/BalancePlatformTest.php index f1d5b39ca..036ff0d03 100644 --- a/tests/Unit/BalancePlatformTest.php +++ b/tests/Unit/BalancePlatformTest.php @@ -14,6 +14,7 @@ use Adyen\Service\BalancePlatform\BankAccountValidationApi; use Adyen\Service\BalancePlatform\PaymentInstrumentGroupsApi; use Adyen\Service\BalancePlatform\PlatformApi; +use Adyen\Service\BalancePlatform\TransferLimitsBalanceAccountLevelApi; use http\Env; use PharIo\Manifest\Url; use function PHPUnit\Framework\assertEquals; @@ -203,4 +204,20 @@ public function testGetSweepUrlCheckLive() $this->requestUrl ); } + + public function testGetCurrentTransferLimits() + { + $client = $this->createMockClientUrl( + 'tests/Resources/BalancePlatform/get-current-transfer-limits.json', + Environment::LIVE + ); + $service = new TransferLimitsBalanceAccountLevelApi($client); + $response = $service->getCurrentTransferLimits('balanceAccountId'); + + self::assertCount(1, $response->getTransferLimits()); + self::assertEquals( + 'https://balanceplatform-api-live.adyen.com/bcl/v2/balanceAccounts/balanceAccountId/transferLimits/current', + $this->requestUrl + ); + } }