Skip to content

Conversation

@gcatanese
Copy link
Contributor

@gcatanese gcatanese commented Dec 8, 2025

PR to generate the BalanceWebhooks models.

Transfer Webhooks

  • Add new event balancePlatform.balanceAccount.balance.block.released

@gcatanese gcatanese requested review from a team as code owners December 8, 2025 14:11
@gcatanese gcatanese requested a review from galesky-a December 8, 2025 14:11
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gcatanese, 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 significantly expands the Adyen Java API library's capabilities by integrating new Balance Webhook models. It specifically introduces support for the balancePlatform.balanceAccount.balance.block.released event, enabling the library to accurately parse and handle notifications related to the release of blocked balances. Furthermore, it enhances the robustness of existing models by implementing explicit null value handling, ensuring more reliable data processing.

Highlights

  • New Balance Webhook Models: Introduced several new Java models, including Amount, ReleaseBlockedBalanceNotificationData, ReleasedBlockedBalanceNotificationRequest, and ResourceReference, to support the latest Balance Webhooks.
  • New Webhook Event Supported: Added explicit support for the balancePlatform.balanceAccount.balance.block.released event, enabling the library to process notifications when a blocked balance is released.
  • Enhanced Null Value Handling: Updated existing Balance Webhook models (BalanceAccountBalanceNotificationRequest, BalanceNotificationData, BalancePlatformNotificationResponse, Balances) to include explicit null serialization logic, ensuring robust handling of nullable fields as per recent template updates.
  • Webhook Handler Extension: The BalanceWebhooksHandler now includes a new method, getReleasedBlockedBalanceNotificationRequest(), specifically designed to deserialize the new balancePlatform.balanceAccount.balance.block.released webhook type.
  • Comprehensive Testing: New test cases and mock JSON data have been added to validate the correct functionality and deserialization of the newly introduced balancePlatform.balanceAccount.balance.block.released webhook.
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 introduces new models for Balance Webhooks, specifically for the balancePlatform.balanceAccount.balance.block.released event, and updates existing models to better handle nullable values. The changes, mostly auto-generated, are consistent and well-structured. The inclusion of a new handler method and a corresponding test case for the new webhook type is a great addition. I've identified a couple of minor areas for improvement in the generated code to enhance readability and efficiency.

@gcatanese gcatanese added the Feature Indicates a new feature addition label Dec 8, 2025
Copy link

@galesky-a galesky-a left a comment

Choose a reason for hiding this comment

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

Overall LGTM but similar concern as here: #1605 (comment)

@gcatanese gcatanese force-pushed the generate-balancewebhooks-models branch from d23a6e9 to b379579 Compare December 10, 2025 10:07
@gcatanese
Copy link
Contributor Author

/gemini review

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 for Balance Webhooks, specifically for the balancePlatform.balanceAccount.balance.block.released event. The changes include new auto-generated model classes, a new handler method in BalanceWebhooksHandler, and a corresponding test case with mock data. The code generation seems to be working correctly, and the new functionality is well-tested. I have one suggestion regarding the implementation of the new handler method to improve code conciseness and maintainability.

Comment on lines +66 to +83
public Optional<ReleasedBlockedBalanceNotificationRequest>
getReleasedBlockedBalanceNotificationRequest() {

var optionalReleasedBlockedBalanceNotificationRequest =
getOptionalField(ReleasedBlockedBalanceNotificationRequest.class);

if (optionalReleasedBlockedBalanceNotificationRequest.isPresent()) {
// verify event type
for (var value : ReleasedBlockedBalanceNotificationRequest.TypeEnum.values()) {
if (value.equals(optionalReleasedBlockedBalanceNotificationRequest.get().getType())) {
// found matching event type
return optionalReleasedBlockedBalanceNotificationRequest;
}
}
}

return Optional.empty();
}
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 logic in this new method getReleasedBlockedBalanceNotificationRequest is a bit verbose and includes a redundant loop to verify the event type. During deserialization, Jackson uses the fromValue method in the TypeEnum, which returns null for an invalid type from the JSON payload. Therefore, a simple null check on getType() is sufficient.

This can be simplified significantly using Optional.filter. Since this code is likely auto-generated from a template (webhook_handler.mustache), I recommend updating the template to generate more concise and efficient code for all such handler methods. This would also help reduce code duplication with getBalanceAccountBalanceNotificationRequest.

  public Optional<ReleasedBlockedBalanceNotificationRequest>
      getReleasedBlockedBalanceNotificationRequest() {
    return getOptionalField(ReleasedBlockedBalanceNotificationRequest.class)
        .filter(req -> req.getType() != null);
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to the backlog

@gcatanese
Copy link
Contributor Author

@galesky-a I have rebased with main to confirm webhook models are no longer updated.

@gcatanese gcatanese merged commit bab80c7 into main Dec 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Indicates a new feature addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants