-
Notifications
You must be signed in to change notification settings - Fork 155
Sdk automation/configurationwebhooks balanceplatformwebhook tests #2017
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 |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "service": "configurationwebhooks", | ||
| "project": "java", | ||
| "generatedAt": "2026-06-02T15:30:09Z", | ||
| "openapiCommitSha": "f3894fd6b47d9076841b04852378251de3bba2de", | ||
| "automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284", | ||
| "libraryCommitSha": "9539e092f2160ca341916c804f01f0f699a64415" | ||
| "generatedAt": "2026-07-23T13:25:47Z", | ||
| "openapiCommitSha": "06d031500a5565d326553c6b0d14c3c79d13a1eb", | ||
| "automationCommitSha": "0c108bd8050cf480d2710b78b770afdfbdd89397", | ||
| "libraryCommitSha": "7f01d8c3c98591abf7cf85a4db7b7ff76aa7e66b" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -310,6 +310,53 @@ public Optional<ScoreNotificationRequest> getScoreNotificationRequest() { | |
| return Optional.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * Attempts to deserialize the webhook payload into a TopUpConfigurationEventRequest | ||
| * | ||
| * @return an Optional containing the deserialized object, or empty if deserialization fails | ||
| */ | ||
| public Optional<TopUpConfigurationEventRequest> getTopUpConfigurationEventRequest() { | ||
|
|
||
| var optionalTopUpConfigurationEventRequest = | ||
| getOptionalField(TopUpConfigurationEventRequest.class); | ||
|
|
||
| if (optionalTopUpConfigurationEventRequest.isPresent()) { | ||
| // verify event type | ||
| for (var value : TopUpConfigurationEventRequest.TypeEnum.values()) { | ||
| if (value.equals(optionalTopUpConfigurationEventRequest.get().getType())) { | ||
| // found matching event type | ||
| return optionalTopUpConfigurationEventRequest; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return Optional.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * Attempts to deserialize the webhook payload into a TopUpConfigurationUpdatedEventRequest | ||
| * | ||
| * @return an Optional containing the deserialized object, or empty if deserialization fails | ||
| */ | ||
| public Optional<TopUpConfigurationUpdatedEventRequest> | ||
| getTopUpConfigurationUpdatedEventRequest() { | ||
|
|
||
| var optionalTopUpConfigurationUpdatedEventRequest = | ||
| getOptionalField(TopUpConfigurationUpdatedEventRequest.class); | ||
|
|
||
| if (optionalTopUpConfigurationUpdatedEventRequest.isPresent()) { | ||
| // verify event type | ||
| for (var value : TopUpConfigurationUpdatedEventRequest.TypeEnum.values()) { | ||
| if (value.equals(optionalTopUpConfigurationUpdatedEventRequest.get().getType())) { | ||
| // found matching event type | ||
| return optionalTopUpConfigurationUpdatedEventRequest; | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+347
to
+355
Contributor
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 loop verifying the event type is redundant. Since if (optionalTopUpConfigurationUpdatedEventRequest.isPresent() && optionalTopUpConfigurationUpdatedEventRequest.get().getType() != null) {
return optionalTopUpConfigurationUpdatedEventRequest;
} |
||
|
|
||
| return Optional.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * Deserializes the payload into the specified class type. | ||
| * | ||
|
|
||
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 loop verifying the event type is redundant. Since
getType()returns aTopUpConfigurationEventRequest.TypeEnum, any non-null value is guaranteed to be a valid enum constant. Additionally, callingTypeEnum.values()clones the underlying array on every invocation, which introduces unnecessary memory allocation and garbage collection overhead. We can simplify this to a direct null check.