Skip to content

[transferwebhooks] Code generation: update services and models#1726

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

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

Conversation

@AdyenAutomationBot
Copy link
Collaborator

This PR contains the automated changes for the transferwebhooks 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 February 16, 2026 13:06
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AdyenAutomationBot, 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 delivers an automated update to the transferwebhooks service, incorporating new data structures and extending existing enums. These changes enhance the webhook capabilities by introducing detailed interchange fee data and new event statuses and types, ensuring the API models remain synchronized with the latest specifications.

Highlights

  • New InterchangeData Model: A new Java model, InterchangeData, has been introduced to represent information about interchange fees, including the amount, rate indicator, and type.
  • New Status and Type Enums: The INTERCHANGEADJUSTED status has been added to Modification, TransferData, and TransferEvent models. Additionally, a TRACING type has been added to the TypeEnum in TransferEvent.
  • Deserialization Logic Update: The TransferEventEventsDataInner class has been updated to correctly handle the deserialization of the new InterchangeData type within its oneOf schema.

🧠 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.

Changelog
  • src/main/java/com/adyen/model/transferwebhooks/InterchangeData.java
    • Added a new model InterchangeData with fields for interchangeAmount, interchangeRateIndicator, and type.
  • src/main/java/com/adyen/model/transferwebhooks/Modification.java
    • Added the INTERCHANGEADJUSTED value to the StatusEnum.
  • src/main/java/com/adyen/model/transferwebhooks/TransferData.java
    • Added the INTERCHANGEADJUSTED value to the StatusEnum.
  • src/main/java/com/adyen/model/transferwebhooks/TransferEvent.java
    • Added the INTERCHANGEADJUSTED value to the StatusEnum.
    • Added the TRACING value to the TypeEnum.
  • src/main/java/com/adyen/model/transferwebhooks/TransferEventEventsDataInner.java
    • Updated the deserialization logic to recognize and process InterchangeData.
    • Added a constructor for InterchangeData.
    • Included InterchangeData in the schemas map.
    • Modified setActualInstance and getActualInstance to support InterchangeData.
    • Introduced getInterchangeData() for direct access to the InterchangeData instance.
Activity
  • This pull request was automatically generated by AdyenAutomationBot.
  • The changes reflect an automated update for the transferwebhooks service, aligning with recent adyen-openapi commits.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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 appears to be auto-generated, updating services and models for transferwebhooks. The changes introduce a new InterchangeData model, update several enums, and modify deserialization logic to support the new model. My review identifies a few areas for improvement in the generated code, focusing on robustness, correctness, and maintainability. These suggestions might be best addressed by updating the underlying generator templates.

Comment on lines +63 to +75
public static TypeEnum fromValue(String value) {
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

Returning null for an unknown enum value can lead to NullPointerExceptions in consuming code if not handled carefully. It's generally safer to fail fast by throwing an exception for unknown values. Consider throwing an IllegalArgumentException instead.

    public static TypeEnum fromValue(String value) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "' for TypeEnum");
    }

public enum TypeEnum {
ACCOUNTING(String.valueOf("accounting")),

TRACING(String.valueOf("tracing")),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

With the addition of the TRACING enum member, the Javadoc for TypeEnum on line 475 is now outdated and could mislead developers. Please update it to include tracing as a possible value.

Suggested Javadoc:

/** The type of the transfer event. Possible values: **accounting**, **tracing**, **tracking**. */

Comment on lines +80 to +98
boolean attemptParsing = true;
if (attemptParsing) {
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
boolean typeMatch = false;
if (tree.findValue("type") != null) {
typeMatch =
Arrays.stream(InterchangeData.TypeEnum.values())
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
}

if (typeMatch) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(InterchangeData.class);
// 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++;
log.log(Level.FINER, "Input data matches schema 'InterchangeData'");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This deserialization logic can be made more robust and efficient.

  1. The attemptParsing variable and its if check are redundant and can be removed.
  2. tree.findValue("type") is called twice and searches recursively, which can be inefficient and may not be what is intended for a discriminator field. Using tree.get("type") is safer as it only looks at the top level of the JSON object.
  3. It's good practice to check if the node is textual before calling asText().

Since this code is likely auto-generated, this feedback may be best applied to the generator template. Here is a suggested improvement:

        // Checks if the unique type of the oneOf json matches any of the object TypeEnum values
        JsonNode typeNode = tree.get("type");
        if (typeNode != null && typeNode.isTextual()) {
          String typeValue = typeNode.asText();
          boolean typeMatch =
              Arrays.stream(InterchangeData.TypeEnum.values())
                  .anyMatch((t) -> t.getValue().equals(typeValue));

          if (typeMatch) {
            deserialized = tree.traverse(jp.getCodec()).readValueAs(InterchangeData.class);
            // 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++;
            log.log(Level.FINER, "Input data matches schema 'InterchangeData'");
          }
        }

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