Skip to content

[configurationwebhooks] Code generation: update services and models#1799

Open
AdyenAutomationBot wants to merge 1 commit intomainfrom
sdk-automation/configurationwebhooks
Open

[configurationwebhooks] Code generation: update services and models#1799
AdyenAutomationBot wants to merge 1 commit intomainfrom
sdk-automation/configurationwebhooks

Conversation

@AdyenAutomationBot
Copy link
Collaborator

This PR contains the automated changes for the configurationwebhooks service.

The commit history of this PR reflects the adyen-openapi commits that have been applied.

@AdyenAutomationBot AdyenAutomationBot requested review from a team as code owners March 18, 2026 16:00
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces new data models and webhook handling logic to support mandate notifications, specifically focusing on BACS Direct Debit. It also updates the description of the settlementDelayDays field in PlatformPaymentConfiguration to provide more clarity.

Highlights

  • Mandate Webhook Handling: Introduced new models and webhook handler logic for processing mandate-related notifications.
  • BACS Direct Debit Support: Added specific support for BACS Direct Debit mandates, including new data models and webhook types.
  • Settlement Delay Days Update: Updated the description for settlementDelayDays in PlatformPaymentConfiguration to clarify the requirement of enabling Custom Sales Day Payout.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 new models and webhook handling for Mandate notifications. The changes include adding MandateNotificationRequest, Mandate, MandateBankAccount, MandateBankAccountAccountIdentification, MandateNotificationData, MandatePartyIdentification, and UKLocalMandateAccountIdentification classes. Additionally, the ConfigurationWebhooksHandler has been updated to include a method for processing MandateNotificationRequest.

My review identified several areas for improvement related to error handling consistency and code efficiency, particularly in how enum values are validated and how null values are managed during deserialization. Addressing these points will enhance the robustness and maintainability of the new code.

Comment on lines +102 to +105
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The TODO comment highlights a significant limitation: strict JSON schema constraints (e.g., min, max, enum, pattern) are not validated during deserialization. This can lead to incorrect data interpretation or unexpected behavior if the input JSON partially matches multiple oneOf schemas. Implementing more robust validation is crucial for data integrity.

Comment on lines +116 to +121
for (var value : MandateNotificationRequest.TypeEnum.values()) {
if (value.equals(optionalMandateNotificationRequest.get().getType())) {
// found matching event type
return optionalMandateNotificationRequest;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The explicit loop to verify the event type is redundant. If optionalMandateNotificationRequest.get().getType() is not null, it means the deserialization was successful and the type is a valid enum value. The fromValue method within the enum itself handles the validation of the string value. A simpler check for null is sufficient here.

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

Comment on lines +78 to +91
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
// handling unexpected value
LOG.warning(
"StatusEnum: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(StatusEnum.values()));
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Returning null from the fromValue method for an unexpected enum value can lead to NullPointerException at the call site if not explicitly handled. It is generally safer and clearer to throw an IllegalArgumentException to indicate an invalid input. This makes the contract of the method more explicit and prevents silent failures.

Suggested change
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
// handling unexpected value
LOG.warning(
"StatusEnum: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(StatusEnum.values()));
return null;
}
@JsonCreator
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
LOG.warning(
"StatusEnum: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(StatusEnum.values()));
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}

Comment on lines +121 to +134
for (TypeEnum b : TypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
// handling unexpected value
LOG.warning(
"TypeEnum: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(TypeEnum.values()));
return null;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the StatusEnum, returning null from the fromValue method for an unexpected enum value can lead to NullPointerException. Throwing an IllegalArgumentException is a more robust approach to signal invalid input.

    @JsonCreator
    public static TypeEnum fromValue(String value) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      LOG.warning(
          "TypeEnum: unexpected enum value '"
              + value
              + "' - Supported values are "
              + Arrays.toString(TypeEnum.values()));
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

Comment on lines +122 to +125
throw new IOException(
String.format(
"Failed deserialization for MandateBankAccountAccountIdentification: %d classes match result, expected 1",
match));
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's an inconsistency in how null values are handled. The getNullValue method explicitly throws a JsonMappingException if null is encountered, suggesting null is an invalid state. However, the deserialize method returns null if no matching schema is found. This discrepancy can lead to confusing error handling paths. Consider aligning the strategy for null values to ensure consistent behavior.

Comment on lines +74 to +80
LOG.warning(
"TypeEnum: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(TypeEnum.values()));
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to other enums, returning null from the fromValue method for an unexpected enum value can lead to NullPointerException. Throwing an IllegalArgumentException is a more robust approach to signal invalid input.

    @JsonCreator
    public static TypeEnum fromValue(String value) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      LOG.warning(
          "TypeEnum: unexpected enum value '"
              + value
              + "' - Supported values are "
              + Arrays.toString(TypeEnum.values()));
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

Comment on lines +67 to +73
LOG.warning(
"TypeEnum: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(TypeEnum.values()));
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to other enums, returning null from the fromValue method for an unexpected enum value can lead to NullPointerException. Throwing an IllegalArgumentException is a more robust approach to signal invalid input.

    @JsonCreator
    public static TypeEnum fromValue(String value) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      LOG.warning(
          "TypeEnum: unexpected enum value '"
              + value
              + "' - Supported values are "
              + Arrays.toString(TypeEnum.values()));
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

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.

1 participant