Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Adyen/Model/AcsWebhooks/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* Amount Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Amount implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down
10 changes: 5 additions & 5 deletions src/Adyen/Model/AcsWebhooks/AuthenticationDecision.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* AuthenticationDecision Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class AuthenticationDecision implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down Expand Up @@ -320,11 +320,11 @@ public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
"status: unexpected enum value '%s' - Supported values are [%s]",
$status,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +323 to 329

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setStatus() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid status value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'status', must be one of '%s'",
                    $status,
                    implode("', '", $allowedValues)
                )
            );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gemini-code-assist This is done by design: the goal is not to throw an exception when an unknown value is encountered, but rather just log a warning and use the value as-is (this is a valid value as it is defined by the API). Revise and close all your comments related to this issue.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for clarifying the design decision. I understand that the intention is to log unexpected enum values as warnings and proceed, as these are considered valid by the API. I will revise and close all related comments accordingly.

}
Expand Down
46 changes: 23 additions & 23 deletions src/Adyen/Model/AcsWebhooks/AuthenticationInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* AuthenticationInfo Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class AuthenticationInfo implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down Expand Up @@ -734,11 +734,11 @@ public function setChallengeIndicator($challengeIndicator)
{
$allowedValues = $this->getChallengeIndicatorAllowableValues();
if (!in_array($challengeIndicator, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'challengeIndicator', must be one of '%s'",
"challengeIndicator: unexpected enum value '%s' - Supported values are [%s]",
$challengeIndicator,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +737 to 743

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setChallengeIndicator() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid challengeIndicator value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'challengeIndicator', must be one of '%s'",
                    $challengeIndicator,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down Expand Up @@ -792,11 +792,11 @@ public function setDeviceChannel($deviceChannel)
{
$allowedValues = $this->getDeviceChannelAllowableValues();
if (!in_array($deviceChannel, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'deviceChannel', must be one of '%s'",
"deviceChannel: unexpected enum value '%s' - Supported values are [%s]",
$deviceChannel,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +795 to 801

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setDeviceChannel() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid deviceChannel value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'deviceChannel', must be one of '%s'",
                    $deviceChannel,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down Expand Up @@ -850,11 +850,11 @@ public function setExemptionIndicator($exemptionIndicator)
{
$allowedValues = $this->getExemptionIndicatorAllowableValues();
if (!in_array($exemptionIndicator, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'exemptionIndicator', must be one of '%s'",
"exemptionIndicator: unexpected enum value '%s' - Supported values are [%s]",
$exemptionIndicator,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +853 to 859

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setExemptionIndicator() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid exemptionIndicator value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'exemptionIndicator', must be one of '%s'",
                    $exemptionIndicator,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down Expand Up @@ -908,11 +908,11 @@ public function setMessageCategory($messageCategory)
{
$allowedValues = $this->getMessageCategoryAllowableValues();
if (!in_array($messageCategory, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'messageCategory', must be one of '%s'",
"messageCategory: unexpected enum value '%s' - Supported values are [%s]",
$messageCategory,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +911 to 917

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setMessageCategory() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid messageCategory value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'messageCategory', must be one of '%s'",
                    $messageCategory,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down Expand Up @@ -1014,11 +1014,11 @@ public function setTransStatus($transStatus)
{
$allowedValues = $this->getTransStatusAllowableValues();
if (!in_array($transStatus, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'transStatus', must be one of '%s'",
"transStatus: unexpected enum value '%s' - Supported values are [%s]",
$transStatus,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +1017 to 1023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setTransStatus() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid transStatus value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'transStatus', must be one of '%s'",
                    $transStatus,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down Expand Up @@ -1048,11 +1048,11 @@ public function setTransStatusReason($transStatusReason)
{
$allowedValues = $this->getTransStatusReasonAllowableValues();
if (!in_array($transStatusReason, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'transStatusReason', must be one of '%s'",
"transStatusReason: unexpected enum value '%s' - Supported values are [%s]",
$transStatusReason,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +1051 to 1057

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setTransStatusReason() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid transStatusReason value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'transStatusReason', must be one of '%s'",
                    $transStatusReason,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down Expand Up @@ -1082,11 +1082,11 @@ public function setType($type)
{
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($type, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
"type: unexpected enum value '%s' - Supported values are [%s]",
$type,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +1085 to 1091

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setType() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid type value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'type', must be one of '%s'",
                    $type,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down
14 changes: 7 additions & 7 deletions src/Adyen/Model/AcsWebhooks/AuthenticationNotificationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* AuthenticationNotificationData Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class AuthenticationNotificationData implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down Expand Up @@ -409,7 +409,7 @@ public function getId()
/**
* Sets id
*
* @param string $id Unique identifier of the authentication.
* @param string $id The unique identifier of the authentication.
*
* @return self
*/
Expand All @@ -433,7 +433,7 @@ public function getPaymentInstrumentId()
/**
* Sets paymentInstrumentId
*
* @param string $paymentInstrumentId Unique identifier of the payment instrument that was used for the authentication.
* @param string $paymentInstrumentId The unique identifier of the payment instrument that was used for the authentication.
*
* @return self
*/
Expand Down Expand Up @@ -489,11 +489,11 @@ public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
"status: unexpected enum value '%s' - Supported values are [%s]",
$status,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +492 to 498

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setStatus() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid status value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'status', must be one of '%s'",
                    $status,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* AuthenticationNotificationRequest Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class AuthenticationNotificationRequest implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down Expand Up @@ -417,11 +417,11 @@ public function setType($type)
{
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($type, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
"type: unexpected enum value '%s' - Supported values are [%s]",
$type,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +420 to 426

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setType() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid type value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'type', must be one of '%s'",
                    $type,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* BalancePlatformNotificationResponse Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class BalancePlatformNotificationResponse implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down Expand Up @@ -286,7 +286,7 @@ public function getNotificationResponse()
/**
* Sets notificationResponse
*
* @param string|null $notificationResponse Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications).
* @param string|null $notificationResponse Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks/#accept-webhooks).
*
* @return self
*/
Expand Down
16 changes: 8 additions & 8 deletions src/Adyen/Model/AcsWebhooks/ChallengeInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* ChallengeInfo Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ChallengeInfo implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down Expand Up @@ -397,11 +397,11 @@ public function setChallengeCancel($challengeCancel)
{
$allowedValues = $this->getChallengeCancelAllowableValues();
if (!in_array($challengeCancel, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'challengeCancel', must be one of '%s'",
"challengeCancel: unexpected enum value '%s' - Supported values are [%s]",
$challengeCancel,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +400 to 406

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setChallengeCancel() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid challengeCancel value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'challengeCancel', must be one of '%s'",
                    $challengeCancel,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down Expand Up @@ -431,11 +431,11 @@ public function setFlow($flow)
{
$allowedValues = $this->getFlowAllowableValues();
if (!in_array($flow, $allowedValues, true)) {
throw new \InvalidArgumentException(
error_log(
sprintf(
"Invalid value '%s' for 'flow', must be one of '%s'",
"flow: unexpected enum value '%s' - Supported values are [%s]",
$flow,
implode("', '", $allowedValues)
implode(', ', $allowedValues)
)
);
Comment on lines +434 to 440

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling for invalid enum values in setFlow() has been changed from throwing an InvalidArgumentException to logging an error with error_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalid flow value, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw an InvalidArgumentException.

            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'flow', must be one of '%s'",
                    $flow,
                    implode("', '", $allowedValues)
                )
            );

}
Expand Down
24 changes: 0 additions & 24 deletions src/Adyen/Model/AcsWebhooks/ObjectSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,30 +237,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);
Expand Down
4 changes: 2 additions & 2 deletions src/Adyen/Model/AcsWebhooks/Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace Adyen\Model\AcsWebhooks;

use \ArrayAccess;
use ArrayAccess;
use Adyen\Model\AcsWebhooks\ObjectSerializer;

/**
* Purchase Class Doc Comment
*
* @package Adyen
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Purchase implements ModelInterface, ArrayAccess, \JsonSerializable
{
Expand Down
Loading