-
Notifications
You must be signed in to change notification settings - Fork 116
Generate Webhooks models #808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| { | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'challengeIndicator', must be one of '%s'",
$challengeIndicator,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'deviceChannel', must be one of '%s'",
$deviceChannel,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'exemptionIndicator', must be one of '%s'",
$exemptionIndicator,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'messageCategory', must be one of '%s'",
$messageCategory,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'transStatus', must be one of '%s'",
$transStatus,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'transStatusReason', must be one of '%s'",
$transStatusReason,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
$type,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| { | ||
|
|
@@ -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 | ||
| */ | ||
|
|
@@ -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 | ||
| */ | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| { | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
$type,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| { | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'challengeCancel', must be one of '%s'",
$challengeCancel,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling for invalid enum values in throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'flow', must be one of '%s'",
$flow,
implode("', '", $allowedValues)
)
); |
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling for invalid enum values in
setStatus()has been changed from throwing anInvalidArgumentExceptionto logging an error witherror_log. This is a significant change that can lead to issues. By not throwing an exception, the application will continue to run with an invalidstatusvalue, which can cause unpredictable behavior and hard-to-debug issues later on. It's better to fail fast. Please consider reverting this to throw anInvalidArgumentException.There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.