Skip to content

Conversation

@Korri
Copy link

@Korri Korri commented Oct 28, 2025

Description

This introduces the Client#call_adyen_api_url method, that can be used to make an API call by specifying a full URL and HTTP method, while still taking care of authentication & basic error handling.

Tested scenarios

I added test coverage for both the existing Client#call_adyen_api method as this modifies it, and the new Client#call_adyen_api_url, I tried to stick to mocking practices uses in the rest of the repository.

@Korri Korri requested review from a team as code owners October 28, 2025 14:47
@gemini-code-assist
Copy link

Summary of Changes

Hello @Korri, 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 enhances the Adyen client's API interaction capabilities by introducing a new, more flexible method for making API calls. The new call_adyen_api_url method allows developers to specify a full URL and HTTP method directly, abstracting away the underlying authentication and basic error handling. This change also involves refactoring the existing call_adyen_api to leverage this new method, leading to a more modular and maintainable codebase without altering its external behavior for existing use cases.

Highlights

  • New API Call Method: Introduced Client#call_adyen_api_url which allows making API calls by directly providing a full URL and HTTP method, offering greater flexibility.
  • Refactored Existing API Call: The existing Client#call_adyen_api method has been refactored to internally utilize the new call_adyen_api_url, streamlining the API call logic and reducing redundancy.
  • Simplified HTTP Method Handling: The internal logic for handling different HTTP methods (GET, POST, PATCH, DELETE) within API calls has been simplified and consolidated using a case statement.
  • Enhanced Test Coverage: Comprehensive test cases have been added for both the new call_adyen_api_url method and the refactored call_adyen_api to ensure correct functionality, header handling, and error management across various scenarios.
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.

@Korri Korri force-pushed the add-call_adyen_api_url-method branch 2 times, most recently from f80b73d to cacb867 Compare October 28, 2025 14:49
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 flexible call_adyen_api_url method and refactors the existing call_adyen_api to use it, which is a great improvement. The refactoring of the request logic using a case statement significantly enhances readability and robustness. The test coverage for the new functionality is comprehensive. I've provided a couple of suggestions: one critical fix to ensure the new public method validates authentication correctly, and another to improve the maintainability of the new tests by reducing code duplication.

@Korri Korri force-pushed the add-call_adyen_api_url-method branch 3 times, most recently from d56ffaf to a071925 Compare October 28, 2025 16:23
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 new Client#call_adyen_api_url method for making API calls with a full URL, and refactors the existing Client#call_adyen_api to use it. The changes are well-structured, significantly reduce code duplication, and include comprehensive test coverage for both the new and modified methods. My main feedback is to address a redundant authentication check that occurs when call_adyen_api calls call_adyen_api_url. I've provided suggestions to centralize the validation logic, which should improve clarity and efficiency.

@Korri
Copy link
Author

Korri commented Oct 28, 2025

/gemini review

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 new call_adyen_api_url method, which is a great addition for flexibility. The existing call_adyen_api method has been nicely refactored to use this new method, and other parts of the client, like the HTTP request dispatching and authentication logic, have been cleaned up and simplified. The test coverage added for these changes is excellent and thorough. I have one suggestion regarding an inefficient and commented part of the code that seems to be a leftover from a previous implementation.

@Korri Korri force-pushed the add-call_adyen_api_url-method branch from 5a0d71e to 9696c00 Compare October 28, 2025 17:40
@gcatanese gcatanese added the enhancement New feature or request label Oct 28, 2025
Korri added 3 commits October 29, 2025 14:41
This method allows passing in a full URL for users that do not want to
use the whole concept of services and actions.
The service specific validation for `PaymentSetupAndVerification` was
useless as this service is not a valid service in `service_url_base`.

Removing it means that we where able to simplify the validation as it is
not service dependent anymore.
@Korri Korri force-pushed the add-call_adyen_api_url-method branch from 9696c00 to 4b03d8f Compare October 29, 2025 18:42
@sonarqubecloud
Copy link

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants