From 9c4f3350b2ea0c660cfdebbd42859a0991db1c09 Mon Sep 17 00:00:00 2001 From: beppe Date: Mon, 23 Jun 2025 09:29:37 +0200 Subject: [PATCH 1/2] Generate Checkout API --- .../Checkout/AdditionalDataSubMerchant.php | 2 +- .../Model/Checkout/CheckoutPaymentMethod.php | 4 +-- src/Adyen/Model/Checkout/MbwayDetails.php | 4 +-- src/Adyen/Model/Checkout/ObjectSerializer.php | 30 ++---------------- .../Model/Checkout/PaymentRefundRequest.php | 31 +++++++++++++++++++ src/Adyen/Model/Checkout/PixRecurring.php | 31 +++++++++++++++++++ .../Checkout/ResponseAdditionalDataCommon.php | 2 +- src/Adyen/Model/Checkout/SubMerchantInfo.php | 2 +- src/Adyen/Model/Checkout/VippsDetails.php | 2 +- src/Adyen/Service/Checkout/RecurringApi.php | 3 +- src/Adyen/Service/Checkout/UtilityApi.php | 2 +- 11 files changed, 75 insertions(+), 38 deletions(-) diff --git a/src/Adyen/Model/Checkout/AdditionalDataSubMerchant.php b/src/Adyen/Model/Checkout/AdditionalDataSubMerchant.php index b3bee1376..984d6d6a1 100644 --- a/src/Adyen/Model/Checkout/AdditionalDataSubMerchant.php +++ b/src/Adyen/Model/Checkout/AdditionalDataSubMerchant.php @@ -507,7 +507,7 @@ public function getSubMerchantSubSellerSubSellerNrName() /** * Sets subMerchantSubSellerSubSellerNrName * - * @param string|null $subMerchantSubSellerSubSellerNrName Required for transactions performed by registered payment facilitators. The name of the sub-merchant. Based on scheme specifications, this value will overwrite the shopper statement that will appear in the card statement. * Format: Alphanumeric * Maximum length: 22 characters + * @param string|null $subMerchantSubSellerSubSellerNrName Required for transactions performed by registered payment facilitators. The name of the sub-merchant. Based on scheme specifications, this value will overwrite the shopper statement that will appear in the card statement. Exception: for acquirers in Brazil, this value does not overwrite the shopper statement. * Format: Alphanumeric * Maximum length: 22 characters * * @return self */ diff --git a/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php b/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php index 20bd61a9e..c21881f37 100644 --- a/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php +++ b/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php @@ -2070,7 +2070,7 @@ public function getShopperEmail() /** * Sets shopperEmail * - * @param string $shopperEmail + * @param string $shopperEmail * * @return self */ @@ -2094,7 +2094,7 @@ public function getTelephoneNumber() /** * Sets telephoneNumber * - * @param string $telephoneNumber + * @param string $telephoneNumber * * @return self */ diff --git a/src/Adyen/Model/Checkout/MbwayDetails.php b/src/Adyen/Model/Checkout/MbwayDetails.php index 03bdeed1f..15620dd23 100644 --- a/src/Adyen/Model/Checkout/MbwayDetails.php +++ b/src/Adyen/Model/Checkout/MbwayDetails.php @@ -358,7 +358,7 @@ public function getShopperEmail() /** * Sets shopperEmail * - * @param string $shopperEmail + * @param string $shopperEmail * * @return self */ @@ -382,7 +382,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 1367ffe1b..1e8e6df61 100644 --- a/src/Adyen/Model/Checkout/ObjectSerializer.php +++ b/src/Adyen/Model/Checkout/ObjectSerializer.php @@ -82,7 +82,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); } } @@ -118,9 +118,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); } @@ -237,30 +235,6 @@ public static function deserialize($data, $class, $httpHeaders = null) } } - if ($class === '\SplFileObject') { - $data = Utils::streamFor($data); - - /** @var \Psr\Http\Message\StreamInterface $data */ - - // determine file name - if (is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) - && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) - ) { - $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); - } else { - $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); - } - - $file = fopen($filename, 'w'); - while ($chunk = $data->read(200)) { - fwrite($file, $chunk); - } - fclose($file); - - return new \SplFileObject($filename, 'r'); - } - /** @psalm-suppress ParadoxicalCondition */ if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); diff --git a/src/Adyen/Model/Checkout/PaymentRefundRequest.php b/src/Adyen/Model/Checkout/PaymentRefundRequest.php index a927964da..e4e9cd240 100644 --- a/src/Adyen/Model/Checkout/PaymentRefundRequest.php +++ b/src/Adyen/Model/Checkout/PaymentRefundRequest.php @@ -43,6 +43,7 @@ class PaymentRefundRequest implements ModelInterface, ArrayAccess, \JsonSerializ protected static $openAPITypes = [ 'amount' => '\Adyen\Model\Checkout\Amount', 'applicationInfo' => '\Adyen\Model\Checkout\ApplicationInfo', + 'capturePspReference' => 'string', 'lineItems' => '\Adyen\Model\Checkout\LineItem[]', 'merchantAccount' => 'string', 'merchantRefundReason' => 'string', @@ -61,6 +62,7 @@ class PaymentRefundRequest implements ModelInterface, ArrayAccess, \JsonSerializ protected static $openAPIFormats = [ 'amount' => null, 'applicationInfo' => null, + 'capturePspReference' => null, 'lineItems' => null, 'merchantAccount' => null, 'merchantRefundReason' => null, @@ -77,6 +79,7 @@ class PaymentRefundRequest implements ModelInterface, ArrayAccess, \JsonSerializ protected static $openAPINullables = [ 'amount' => false, 'applicationInfo' => false, + 'capturePspReference' => false, 'lineItems' => false, 'merchantAccount' => false, 'merchantRefundReason' => true, @@ -173,6 +176,7 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'amount' => 'amount', 'applicationInfo' => 'applicationInfo', + 'capturePspReference' => 'capturePspReference', 'lineItems' => 'lineItems', 'merchantAccount' => 'merchantAccount', 'merchantRefundReason' => 'merchantRefundReason', @@ -189,6 +193,7 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'amount' => 'setAmount', 'applicationInfo' => 'setApplicationInfo', + 'capturePspReference' => 'setCapturePspReference', 'lineItems' => 'setLineItems', 'merchantAccount' => 'setMerchantAccount', 'merchantRefundReason' => 'setMerchantRefundReason', @@ -205,6 +210,7 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'amount' => 'getAmount', 'applicationInfo' => 'getApplicationInfo', + 'capturePspReference' => 'getCapturePspReference', 'lineItems' => 'getLineItems', 'merchantAccount' => 'getMerchantAccount', 'merchantRefundReason' => 'getMerchantRefundReason', @@ -292,6 +298,7 @@ public function __construct(?array $data = null) { $this->setIfExists('amount', $data ?? [], null); $this->setIfExists('applicationInfo', $data ?? [], null); + $this->setIfExists('capturePspReference', $data ?? [], null); $this->setIfExists('lineItems', $data ?? [], null); $this->setIfExists('merchantAccount', $data ?? [], null); $this->setIfExists('merchantRefundReason', $data ?? [], null); @@ -405,6 +412,30 @@ public function setApplicationInfo($applicationInfo) return $this; } + /** + * Gets capturePspReference + * + * @return string|null + */ + public function getCapturePspReference() + { + return $this->container['capturePspReference']; + } + + /** + * Sets capturePspReference + * + * @param string|null $capturePspReference This is only available for PayPal refunds. The [`pspReference`](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__resParam_pspReference) of the specific capture to refund. + * + * @return self + */ + public function setCapturePspReference($capturePspReference) + { + $this->container['capturePspReference'] = $capturePspReference; + + return $this; + } + /** * Gets lineItems * diff --git a/src/Adyen/Model/Checkout/PixRecurring.php b/src/Adyen/Model/Checkout/PixRecurring.php index ad97cf0ba..240c356b0 100644 --- a/src/Adyen/Model/Checkout/PixRecurring.php +++ b/src/Adyen/Model/Checkout/PixRecurring.php @@ -42,6 +42,7 @@ class PixRecurring implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'billingDate' => 'string', + 'businessDayOnly' => 'bool', 'endsAt' => 'string', 'frequency' => 'string', 'minAmount' => '\Adyen\Model\Checkout\Amount', @@ -61,6 +62,7 @@ class PixRecurring implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'billingDate' => null, + 'businessDayOnly' => null, 'endsAt' => null, 'frequency' => null, 'minAmount' => null, @@ -78,6 +80,7 @@ class PixRecurring implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPINullables = [ 'billingDate' => false, + 'businessDayOnly' => false, 'endsAt' => false, 'frequency' => false, 'minAmount' => false, @@ -175,6 +178,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'billingDate' => 'billingDate', + 'businessDayOnly' => 'businessDayOnly', 'endsAt' => 'endsAt', 'frequency' => 'frequency', 'minAmount' => 'minAmount', @@ -192,6 +196,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'billingDate' => 'setBillingDate', + 'businessDayOnly' => 'setBusinessDayOnly', 'endsAt' => 'setEndsAt', 'frequency' => 'setFrequency', 'minAmount' => 'setMinAmount', @@ -209,6 +214,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'billingDate' => 'getBillingDate', + 'businessDayOnly' => 'getBusinessDayOnly', 'endsAt' => 'getEndsAt', 'frequency' => 'getFrequency', 'minAmount' => 'getMinAmount', @@ -297,6 +303,7 @@ public function getFrequencyAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('billingDate', $data ?? [], null); + $this->setIfExists('businessDayOnly', $data ?? [], null); $this->setIfExists('endsAt', $data ?? [], null); $this->setIfExists('frequency', $data ?? [], null); $this->setIfExists('minAmount', $data ?? [], null); @@ -382,6 +389,30 @@ public function setBillingDate($billingDate) return $this; } + /** + * Gets businessDayOnly + * + * @return bool|null + */ + public function getBusinessDayOnly() + { + return $this->container['businessDayOnly']; + } + + /** + * Sets businessDayOnly + * + * @param bool|null $businessDayOnly Flag used to define whether liquidation can happen only on business days + * + * @return self + */ + public function setBusinessDayOnly($businessDayOnly) + { + $this->container['businessDayOnly'] = $businessDayOnly; + + return $this; + } + /** * Gets endsAt * diff --git a/src/Adyen/Model/Checkout/ResponseAdditionalDataCommon.php b/src/Adyen/Model/Checkout/ResponseAdditionalDataCommon.php index e83a310a7..d1c36b1a2 100644 --- a/src/Adyen/Model/Checkout/ResponseAdditionalDataCommon.php +++ b/src/Adyen/Model/Checkout/ResponseAdditionalDataCommon.php @@ -1384,7 +1384,7 @@ public function getFraudRiskLevel() /** * Sets fraudRiskLevel * - * @param string|null $fraudRiskLevel The risk level of the transaction as classified by the [machine learning](https://docs.adyen.com/risk-management/configure-your-risk-profile/machine-learning-rules/) fraud risk rule. The risk level indicates the likelihood that a transaction will result in a fraudulent dispute. The possible return values are: * veryLow * low * medium * high * veryHigh > + * @param string|null $fraudRiskLevel The risk level of the transaction as classified by the [machine learning](https://docs.adyen.com/risk-management/configure-your-risk-profile/machine-learning-rules/) fraud risk rule. The risk level indicates the likelihood that a transaction will result in a fraudulent dispute. The possible return values are: * veryLow * low * medium * high * veryHigh * * @return self */ diff --git a/src/Adyen/Model/Checkout/SubMerchantInfo.php b/src/Adyen/Model/Checkout/SubMerchantInfo.php index 30eea24fe..b23462269 100644 --- a/src/Adyen/Model/Checkout/SubMerchantInfo.php +++ b/src/Adyen/Model/Checkout/SubMerchantInfo.php @@ -469,7 +469,7 @@ public function getName() /** * Sets name * - * @param string|null $name Required for transactions performed by registered payment facilitators. The name of the sub-merchant. Based on scheme specifications, this value will overwrite the shopper statement that will appear in the card statement. * Format: Alphanumeric * Maximum length: 22 characters + * @param string|null $name Required for transactions performed by registered payment facilitators. The name of the sub-merchant. Based on scheme specifications, this value will overwrite the shopper statement that will appear in the card statement. Exception: for acquirers in Brazil, this value does not overwrite the shopper statement. * Format: Alphanumeric * Maximum length: 22 characters * * @return self */ diff --git a/src/Adyen/Model/Checkout/VippsDetails.php b/src/Adyen/Model/Checkout/VippsDetails.php index bdee352d2..ffe4d1aab 100644 --- a/src/Adyen/Model/Checkout/VippsDetails.php +++ b/src/Adyen/Model/Checkout/VippsDetails.php @@ -412,7 +412,7 @@ public function getTelephoneNumber() /** * Sets telephoneNumber * - * @param string $telephoneNumber + * @param string $telephoneNumber * * @return self */ diff --git a/src/Adyen/Service/Checkout/RecurringApi.php b/src/Adyen/Service/Checkout/RecurringApi.php index 70f099ede..bc4c51cff 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/Checkout/UtilityApi.php b/src/Adyen/Service/Checkout/UtilityApi.php index e6cc3a105..f09ae3419 100644 --- a/src/Adyen/Service/Checkout/UtilityApi.php +++ b/src/Adyen/Service/Checkout/UtilityApi.php @@ -57,7 +57,7 @@ public function getApplePaySession(\Adyen\Model\Checkout\ApplePaySessionRequest /** * Create originKey values for domains * - * @deprecated since Adyen Checkout API v67. + * @deprecated since Adyen Checkout API v67. * @param \Adyen\Model\Checkout\UtilityRequest $utilityRequest * @param array|null $requestOptions * @return \Adyen\Model\Checkout\UtilityResponse From adc90006523b41310711a0758b64180f534efa9c Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Mon, 23 Jun 2025 08:19:56 +0000 Subject: [PATCH 2/2] Code format --- src/Adyen/Model/Checkout/CheckoutPaymentMethod.php | 4 ++-- src/Adyen/Model/Checkout/MbwayDetails.php | 4 ++-- src/Adyen/Model/Checkout/ObjectSerializer.php | 6 ++++-- src/Adyen/Model/Checkout/VippsDetails.php | 2 +- src/Adyen/Service/Checkout/RecurringApi.php | 3 +-- src/Adyen/Service/Checkout/UtilityApi.php | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php b/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php index c21881f37..20bd61a9e 100644 --- a/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php +++ b/src/Adyen/Model/Checkout/CheckoutPaymentMethod.php @@ -2070,7 +2070,7 @@ public function getShopperEmail() /** * Sets shopperEmail * - * @param string $shopperEmail + * @param string $shopperEmail * * @return self */ @@ -2094,7 +2094,7 @@ public function getTelephoneNumber() /** * Sets telephoneNumber * - * @param string $telephoneNumber + * @param string $telephoneNumber * * @return self */ diff --git a/src/Adyen/Model/Checkout/MbwayDetails.php b/src/Adyen/Model/Checkout/MbwayDetails.php index 15620dd23..03bdeed1f 100644 --- a/src/Adyen/Model/Checkout/MbwayDetails.php +++ b/src/Adyen/Model/Checkout/MbwayDetails.php @@ -358,7 +358,7 @@ public function getShopperEmail() /** * Sets shopperEmail * - * @param string $shopperEmail + * @param string $shopperEmail * * @return self */ @@ -382,7 +382,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 1e8e6df61..c9a8102b9 100644 --- a/src/Adyen/Model/Checkout/ObjectSerializer.php +++ b/src/Adyen/Model/Checkout/ObjectSerializer.php @@ -82,7 +82,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); } } @@ -118,7 +118,9 @@ 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); } diff --git a/src/Adyen/Model/Checkout/VippsDetails.php b/src/Adyen/Model/Checkout/VippsDetails.php index ffe4d1aab..bdee352d2 100644 --- a/src/Adyen/Model/Checkout/VippsDetails.php +++ b/src/Adyen/Model/Checkout/VippsDetails.php @@ -412,7 +412,7 @@ public function getTelephoneNumber() /** * Sets telephoneNumber * - * @param string $telephoneNumber + * @param string $telephoneNumber * * @return self */ diff --git a/src/Adyen/Service/Checkout/RecurringApi.php b/src/Adyen/Service/Checkout/RecurringApi.php index bc4c51cff..70f099ede 100644 --- a/src/Adyen/Service/Checkout/RecurringApi.php +++ b/src/Adyen/Service/Checkout/RecurringApi.php @@ -44,14 +44,13 @@ 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/Checkout/UtilityApi.php b/src/Adyen/Service/Checkout/UtilityApi.php index f09ae3419..e6cc3a105 100644 --- a/src/Adyen/Service/Checkout/UtilityApi.php +++ b/src/Adyen/Service/Checkout/UtilityApi.php @@ -57,7 +57,7 @@ public function getApplePaySession(\Adyen\Model\Checkout\ApplePaySessionRequest /** * Create originKey values for domains * - * @deprecated since Adyen Checkout API v67. + * @deprecated since Adyen Checkout API v67. * @param \Adyen\Model\Checkout\UtilityRequest $utilityRequest * @param array|null $requestOptions * @return \Adyen\Model\Checkout\UtilityResponse