Skip to content

Conversation

@Kwok-he-Chu
Copy link
Member

@Kwok-he-Chu Kwok-he-Chu commented Nov 18, 2025

PR-4 of #1204 - Do not merge this branch - this is intended for review-only.

Description

This PR uses the new mustache to generate the new models and services.

This PR prepares the structure to be more in-line with the new library structure, grouping the APIs in one folder. Rather than having them separated across different folders.


  1. The new library structure (with the exception of TerminalAPi) will now have a structure of:

(After)

  • /Adyen/ + {{ApiName}} + /Models
  • /Adyen/ + {{ApiName}} + /Services
    Example: /Adyen/Checkout/Models or /Adyen/BalancePlatform/Services

(Before)

  • /Adyen/Model + {{ApiName}}
  • /Adyen/Service + {{ApiName}}
    Example: Adyen/Model/Checkout
  1. Migrated all tests to use the new models, added tests accordingly

  2. Added /docs in the /docs-folder for each {{ApiName}}

Fix #1211

@Kwok-he-Chu Kwok-he-Chu self-assigned this Nov 18, 2025
@Kwok-he-Chu Kwok-he-Chu requested a review from a team as a code owner November 18, 2025 17:01
@Kwok-he-Chu Kwok-he-Chu requested a review from a team as a code owner November 18, 2025 17:01
@gemini-code-assist
Copy link

Summary of Changes

Hello @Kwok-he-Chu, 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 focuses on a significant upgrade of the OpenAPI Generator to v7.16.0, which necessitated a complete regeneration and restructuring of Adyen's API models and services. The primary goal is to enhance the library's architecture by organizing generated code into more logical, API-specific folders. This change impacts numerous services, requiring extensive test migrations and the introduction of new clients and webhook handlers to support the updated structure and ensure full functionality and compatibility.

Highlights

  • OpenAPI Generator Upgrade: The OpenAPI Generator has been upgraded to version 7.16.0, ensuring the latest code generation capabilities and API specifications are utilized.
  • API Structure Reorganization: Generated models and services are now grouped into API-specific folders (e.g., /Adyen/Checkout/Models), improving code organization and maintainability compared to the previous flat structure.
  • Comprehensive Test Migration: All existing tests have been migrated to align with the new model and service structures, and new tests have been added to cover the updated functionalities across various Adyen APIs.
  • New API Clients and Webhook Handlers: New API clients and webhook handlers have been introduced for several Adyen services, including ACS Webhooks, Balance Control, Balance Platform, BinLookup, Checkout, Data Protection, Disputes, Legal Entity Management, Management, Payments App, Payout, POS Mobile, Recurring, Stored Value, and Transfers. This includes dedicated tests for each.
  • Core Library Enhancements: The core library now includes new utilities and converters, such as HmacValidatorUtility, ByteArrayConverter, DateOnlyJsonConverter, DateTimeJsonConverter, and improved IEnum handling, enhancing data serialization, deserialization, and security.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/release.yml
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

@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 a significant upgrade to the OpenAPI generator and refactors the project structure by generating new models and services. The changes include reorganizing API folders, migrating tests to use the new models, and adding extensive new test coverage. Overall, the changes are well-structured. However, I've identified a critical security issue in the HMAC signature validation logic where the HMAC key is not being used, which needs immediate attention. Additionally, there are a couple of medium-severity issues in the new test files related to code quality and best practices that should be addressed.

Comment on lines +72 to +75
public AcsWebhooksHandler(Adyen.AcsWebhooks.Client.JsonSerializerOptionsProvider jsonSerializerOptionsProvider, ITokenProvider<HmacKeyToken> hmacKeyProvider = null)
{
JsonSerializerOptionsProvider = jsonSerializerOptionsProvider;
}

Choose a reason for hiding this comment

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

critical

The hmacKeyProvider is injected into the constructor but is not used to initialize the _adyenHmacKey field. As a result, _adyenHmacKey will always be null, and the HMAC signature validation in IsValidHmacSignature will not work correctly. This is a critical security vulnerability as it bypasses webhook signature validation.

        public AcsWebhooksHandler(Adyen.AcsWebhooks.Client.JsonSerializerOptionsProvider jsonSerializerOptionsProvider, ITokenProvider<HmacKeyToken> hmacKeyProvider = null)
        {
            JsonSerializerOptionsProvider = jsonSerializerOptionsProvider;
            _adyenHmacKey = hmacKeyProvider?.Get()?.AdyenHmacKey;
        }

Copy link
Member Author

Choose a reason for hiding this comment

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

This is by design. The developer needs to call the function to validate the webhook public bool IsValidHmacSignature(string json, string hmacSignature)

If no HmacKey is provided, developers can still test this locally without having to validate the entire payload. If this was enforced, the class instantiation would throw an error on DI

A future improvement:

  • Adding a Middleware-class that takes the incoming webhook
      1. Checks username+password or use OAuth
      1. Validates the hmacSignature using IsValidHmacSignature
      1. Use the Deserialize{{WebhookName}}Request(string json) to get the object

The feedback above would then be applicable, but right now all generated WebhookHandler-classes are considered as a utility function that the developers need to know about. @gcatanese

@Kwok-he-Chu Kwok-he-Chu deleted the branch v7-generator/4-removed-old-Model-and-Service-folders November 26, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants