Skip to content

Conversation

@candemiralp
Copy link
Contributor

@candemiralp candemiralp commented Dec 31, 2025

Description

This PR adds the missing required capturePspReference field for the refunds of partially captured payments for Scalapay.

@candemiralp candemiralp requested a review from a team as a code owner December 31, 2025 12:28
@candemiralp candemiralp changed the base branch from main to main-9 December 31, 2025 12:28
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @candemiralp, 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 expands the Adyen payment module by integrating new payment methods like Scalapay and PayNow, and introduces a GraphQL endpoint for POS payment initiation. A major focus was on enhancing the robustness of the system through a comprehensive refactoring of error handling during checkout, moving towards a more flexible error code collection approach. Additionally, logging mechanisms have been upgraded to improve data security and clarity, and various internal processes, such as webhook handling and frontend component rendering, have been optimized for better performance and maintainability.

Highlights

  • New Payment Methods: Introduced support for Scalapay (3x and 4x installments) and PayNow payment methods, including their configurations, frontend rendering, and GraphQL integration.
  • GraphQL POS Payment Initiation: Added a new GraphQL resolver to facilitate the initiation of Point-of-Sale (POS) payments, enhancing integration capabilities.
  • Refactored Error Handling: The checkout response validation mechanism has been significantly refactored to collect error codes rather than immediately throwing exceptions, providing more granular error reporting and a dedicated error mapping XML file.
  • Enhanced Logging: Improved logging for API requests and responses now filters sensitive data in live mode and includes whitelisted keys, enhancing security and log clarity. The adyenLogger->info calls have been updated to adyenLogger->addAdyenInfoLog.
  • Webhook Processing Improvements: The AuthorisationWebhookHandler has been refactored into smaller, more focused private methods, improving readability and maintainability. Quote deactivation logic during webhook processing now handles exceptions gracefully by logging them.
  • Dynamic Component Rebuilding: Frontend payment method components now dynamically rebuild when the grand total changes, ensuring accurate payment options and installment calculations.
  • Combo Card Logic Refinement: The logic for handling combo cards (debit/credit) has been refined, specifically for debit cards in Brazil, where installments are now conditionally removed from the request.
  • Refund capturePspReference Logic: Generalized the logic for including capturePspReference in refund requests based on a new payment method configuration, removing PayPal-specific checks.
  • Development Environment Updates: Updated Docker configurations, including adding libicu-dev to the Dockerfile and updating the OpenSearch image, along with minor adjustments to the install_magento.sh script.

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

Ignored Files
  • Ignored by pattern: .github/workflows/** (6)
    • .github/workflows/create-release.yml
    • .github/workflows/e2e-test.yml
    • .github/workflows/graphql-test.yml
    • .github/workflows/main.yml
    • .github/workflows/mftf-test.yml
    • .github/workflows/restapi-test.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
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 refactors the logic for adding capturePspReference to refund requests, making it more generic to support payment methods like Scalapay in addition to PayPal. The changes are well-structured, introducing a new configuration flag and a helper method, with corresponding updates to tests. My review includes a suggestion to correct a typo in the naming of new constants, methods, and variables for better code consistency and clarity.

Comment on lines +174 to +184
$requiresCapturePspreference = $this->paymentMethodsHelper->getRefundRequiresCapturePspreference(
$paymentMethodInstance
);

/*
* Following section adds `capturePspReference` to the refund request if the payment method requires it.
* This is used to link the refund to the capture on Adyen on multiple partial capture cases. Note that,
* AdyenInvoice only exists if the capture mode is manual. Hence, checking the existence of AdyenInvoice
* is sufficient to determine the capture mode.
*/
if ($requiresCapturePspreference) {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's a typo in the new variable, method, constant, and config names. Pspreference should be PspReference to be consistent with the Adyen API field name capturePspReference. This will improve code clarity and maintainability.

Please apply the following changes across the relevant files:

  1. In Gateway/Request/RefundDataBuilder.php:
    • Rename variable $requiresCapturePspreference to $requiresCapturePspReference.
    • Update method call to getRefundRequiresCapturePspReference.
  2. In Helper/PaymentMethods.php:
    • Rename constant CONFIG_FIELD_REFUND_REQUIRES_CAPTURE_PSPREFERENCE to CONFIG_FIELD_REFUND_REQUIRES_CAPTURE_PSP_REFERENCE.
    • Rename method getRefundRequiresCapturePspreference to getRefundRequiresCapturePspReference.
  3. In etc/config.xml:
    • Rename XML tag <refund_requires_capture_pspreference> to <refund_requires_capture_psp_reference>.
  4. In Test/Unit/Gateway/Request/RefundDataBuilderTest.php:
    • Update mocked method name to getRefundRequiresCapturePspReference.
  5. In Test/Unit/Helper/PaymentMethodsTest.php:
    • Update test method name to testGetRefundRequiresCapturePspReference and update constant/method names used in the test.
            $requiresCapturePspReference = $this->paymentMethodsHelper->getRefundRequiresCapturePspReference(
                $paymentMethodInstance
            );

            /*
             * Following section adds `capturePspReference` to the refund request if the payment method requires it.
             * This is used to link the refund to the capture on Adyen on multiple partial capture cases. Note that,
             * AdyenInvoice only exists if the capture mode is manual. Hence, checking the existence of AdyenInvoice
             * is sufficient to determine the capture mode.
             */
            if ($requiresCapturePspReference) {

@candemiralp candemiralp merged commit 50e21c9 into main-9 Jan 6, 2026
3 checks passed
@candemiralp candemiralp deleted the ECP-9871-v9 branch January 6, 2026 13:19
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.

3 participants