Skip to content

Sdk automation/configurationwebhooks balanceplatformwebhook tests#2017

Closed
poojah-adyen wants to merge 2 commits into
mainfrom
sdk-automation/configurationwebhooks-balanceplatformwebhook-tests
Closed

Sdk automation/configurationwebhooks balanceplatformwebhook tests#2017
poojah-adyen wants to merge 2 commits into
mainfrom
sdk-automation/configurationwebhooks-balanceplatformwebhook-tests

Conversation

@poojah-adyen

Copy link
Copy Markdown
Contributor

Description

Tested scenarios

Fixed issue:

@poojah-adyen
poojah-adyen requested a review from a team as a code owner July 23, 2026 19:35

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for recurring top-up configuration webhooks by adding several new model classes (such as TopUpConfigurationEventRequest and TopUpConfigurationUpdatedEventRequest) and updating ConfigurationWebhooksHandler with deserialization helpers. Additionally, Mandate date fields were updated to use OffsetDateTime, and discriminator mappings were registered for polymorphic deserialization. Feedback on the changes points out redundant and inefficient loops in ConfigurationWebhooksHandler that verify event types; since the type is already represented as an enum, these loops can be simplified to direct null checks to avoid unnecessary array cloning overhead.

Comment on lines +323 to +331
if (optionalTopUpConfigurationEventRequest.isPresent()) {
// verify event type
for (var value : TopUpConfigurationEventRequest.TypeEnum.values()) {
if (value.equals(optionalTopUpConfigurationEventRequest.get().getType())) {
// found matching event type
return optionalTopUpConfigurationEventRequest;
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The loop verifying the event type is redundant. Since getType() returns a TopUpConfigurationEventRequest.TypeEnum, any non-null value is guaranteed to be a valid enum constant. Additionally, calling TypeEnum.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.

    if (optionalTopUpConfigurationEventRequest.isPresent() && optionalTopUpConfigurationEventRequest.get().getType() != null) {
      return optionalTopUpConfigurationEventRequest;
    }

Comment on lines +347 to +355
if (optionalTopUpConfigurationUpdatedEventRequest.isPresent()) {
// verify event type
for (var value : TopUpConfigurationUpdatedEventRequest.TypeEnum.values()) {
if (value.equals(optionalTopUpConfigurationUpdatedEventRequest.get().getType())) {
// found matching event type
return optionalTopUpConfigurationUpdatedEventRequest;
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The loop verifying the event type is redundant. Since getType() returns a TopUpConfigurationUpdatedEventRequest.TypeEnum, any non-null value is guaranteed to be a valid enum constant. Additionally, calling TypeEnum.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.

    if (optionalTopUpConfigurationUpdatedEventRequest.isPresent() && optionalTopUpConfigurationUpdatedEventRequest.get().getType() != null) {
      return optionalTopUpConfigurationUpdatedEventRequest;
    }

@poojah-adyen
poojah-adyen deleted the sdk-automation/configurationwebhooks-balanceplatformwebhook-tests branch July 23, 2026 19:38
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants