Repository navigation
[configurationwebhooks] Code generation: update services and models - #2094
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for sweep execution notifications within the configuration webhooks. It adds new model classes (SweepExecutionNotificationData, SweepExecutionNotificationRequest, and SweepResultDetails) and updates the ConfigurationWebhooksHandler with a new method to deserialize these notifications. The review feedback suggests simplifying the getSweepExecutionNotificationRequest method by removing redundant enum verification loops and defensive null checks, as the deserialized request already contains the mapped enum type.
| public Optional<SweepExecutionNotificationRequest> getSweepExecutionNotificationRequest() { | ||
|
|
||
| var optionalSweepExecutionNotificationRequest = | ||
| getOptionalField(SweepExecutionNotificationRequest.class); | ||
|
|
||
| if (optionalSweepExecutionNotificationRequest.isPresent()) { | ||
| // verify event type | ||
| for (var value : SweepExecutionNotificationRequest.TypeEnum.values()) { | ||
| if (value.equals(optionalSweepExecutionNotificationRequest.get().getType())) { | ||
| // found matching event type | ||
| return optionalSweepExecutionNotificationRequest; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return Optional.empty(); | ||
| } |
There was a problem hiding this comment.
The deserialization and event type verification can be simplified significantly. Since getType() already returns a TypeEnum, looping through all enum values is redundant. Additionally, we should avoid adding defensive null checks (such as filtering for a non-null type) that silently ignore null values, as an immediate NullPointerException is a clearer failure signal than silently ignoring the null value which could lead to obscure downstream errors.
public Optional<SweepExecutionNotificationRequest> getSweepExecutionNotificationRequest() {
return getOptionalField(SweepExecutionNotificationRequest.class);
}References
- Avoid adding defensive null checks if a parameter is guaranteed to be non-null by design, and where an immediate NullPointerException is a clearer failure signal than silently ignoring the null value, which could lead to obscure downstream errors like an opaque server rejection.
39a4bdb to
5874c0e
Compare
2822e71 to
dedfcbc
Compare
|



This PR contains the automated changes for the
configurationwebhooksservice.Adyen/adyen-openapi@aad1cc0
The commit history of this PR reflects the
adyen-openapicommits that have been applied.