Skip to content

[capital] Code generation: update services and models#354

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

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

Conversation

@AdyenAutomationBot
Copy link
Collaborator

This PR contains the automated changes for the capital 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 10, 2026 14:03
@sonarqubecloud
Copy link

@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 updates the Adyen Ruby client for the Capital service. It expands the API capabilities by adding a new service for managing dynamic offers and refines the terminology for existing grant offers, now referred to as static offers. This ensures the client library remains synchronized with the latest API specifications, providing developers with updated and clearer access to Capital service functionalities.

Highlights

  • New API Service: A new DynamicOffersApi has been introduced, providing functionalities to calculate preliminary offers, create static offers from dynamic offers, and retrieve all available dynamic offers.
  • API Clarification: The existing GrantOffersApi has been updated to clarify that its methods pertain to 'static offers' rather than 'grant offers', aligning with the introduction of dynamic offers.
  • Automated Code Generation: These changes are a result of automated code generation based on updates to the Adyen OpenAPI specification for the Capital service.

🧠 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
  • lib/adyen/services/capital.rb
    • Required the new capital/dynamic_offers_api file.
    • Added a dynamic_offers_api method to initialize and return an instance of Adyen::DynamicOffersApi.
  • lib/adyen/services/capital/dynamic_offers_api.rb
    • Created a new service class DynamicOffersApi.
    • Implemented calculate_preliminary_offer_from_dynamic_offer method.
    • Implemented create_static_offer_from_dynamic_offer method.
    • Implemented get_all_dynamic_offers method.
  • lib/adyen/services/capital/grant_offers_api.rb
    • Updated the comment for get_all_grant_offers to refer to 'static offers'.
    • Updated the comment for get_grant_offer to refer to 'static offers'.
Activity
  • This pull request was automatically generated by AdyenAutomationBot, reflecting updates from the adyen-openapi repository.
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 a new DynamicOffersApi service, integrating it into the Capital service, and clarifies comments in GrantOffersApi. However, it introduces potential path injection vulnerabilities in the calculate_preliminary_offer_from_dynamic_offer and create_static_offer_from_dynamic_offer methods, where the id parameter is used in the URL path without proper encoding. This could allow path traversal if the id is from untrusted input. Additionally, there's an opportunity to simplify string manipulation in the get_all_dynamic_offers method.

def calculate_preliminary_offer_from_dynamic_offer(request, id, headers: {})
endpoint = '/dynamicOffers/{id}/calculate'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The id parameter is directly formatted into the endpoint string without any URL encoding or validation. If an attacker can control the id value, they could potentially perform path traversal (e.g., using ../) to access other endpoints on the Adyen API host. It is recommended to URL encode the id parameter before formatting it into the endpoint string using URI.encode_www_form_component(id).

def create_static_offer_from_dynamic_offer(request, id, headers: {})
endpoint = '/dynamicOffers/{id}/grantOffer'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The id parameter is directly formatted into the endpoint string without any URL encoding or validation. If an attacker can control the id value, they could potentially perform path traversal (e.g., using ../) to access other endpoints on the Adyen API host. It is recommended to URL encode the id parameter before formatting it into the endpoint string using URI.encode_www_form_component(id).

Comment on lines +37 to +39
endpoint = '/dynamicOffers'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint)
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 gsub and format calls on these lines are redundant for the /dynamicOffers endpoint as it does not contain any path parameters that need to be replaced. Simplifying this will make the code cleaner and more efficient.

endpoint = 'dynamicOffers'
endpoint += create_query_string(query_params)

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