Skip to content

[ECP-9885] Refactor sortAndFilterPaymentMethods return value#3274

Open
shubhamk67 wants to merge 1 commit intodevelop-11from
ECP-9885
Open

[ECP-9885] Refactor sortAndFilterPaymentMethods return value#3274
shubhamk67 wants to merge 1 commit intodevelop-11from
ECP-9885

Conversation

@shubhamk67
Copy link
Contributor

Description
This PR simplifies the payment method filtering return structure by removing the obsolete adyenPaymentMethodsResponse return value from PaymentMethodsFilter::sortAndFilterPaymentMethods().

@shubhamk67 shubhamk67 requested a review from a team as a code owner March 12, 2026 09:47
@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 refactors the sortAndFilterPaymentMethods method to streamline its return value. It removes an obsolete adyenPaymentMethodsResponse from the method's output, simplifying its interface and usage across the codebase.

Highlights

  • Simplified Method Return: The sortAndFilterPaymentMethods method in Helper/PaymentMethodsFilter.php now returns only the filtered Magento payment methods, eliminating an unused Adyen API response.
  • Code Readability Improvement: The json_decode call within sortAndFilterPaymentMethods was refactored for better clarity by directly processing the result of getApiResponse.
  • Plugin Adaptations: Dependent plugins (Plugin/MultishippingPaymentMethods.php and Plugin/SortAndFilterAdyenPaymentMethods.php) have been updated to correctly handle the simplified return structure of sortAndFilterPaymentMethods.
  • Unit Test Updates: Corresponding unit tests were adjusted to reflect the changes in the method's return signature, ensuring continued test coverage.

🧠 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
  • Helper/PaymentMethodsFilter.php
    • Removed the adyenPaymentMethodsResponse variable from the return statement of sortAndFilterPaymentMethods.
    • Refactored the json_decode call to directly process the result of getApiResponse.
  • Plugin/MultishippingPaymentMethods.php
    • Updated the assignment of the return value from sortAndFilterPaymentMethods to directly assign to $result instead of using list().
  • Plugin/SortAndFilterAdyenPaymentMethods.php
    • Updated the assignment of the return value from sortAndFilterPaymentMethods to directly return the result instead of using list().
  • Test/Unit/Helper/PaymentMethodsFilterTest.php
    • Adjusted the test assertion to expect a direct return of the sorted payment methods, removing the array index [0].
  • Test/Unit/Plugin/MultishippingPaymentMethodsTest.php
    • Modified the mock return value for sortAndFilterPaymentMethods to return a single array instead of an array containing another array.
  • Test/Unit/Plugin/SortAndFilterAdyenPaymentMethodsTest.php
    • Modified the mock return value for sortAndFilterPaymentMethods to return a single array instead of an array containing an array and an ignored value.
Activity
  • No human activity has been recorded on this pull request yet.
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

The pull request refactors the sortAndFilterPaymentMethods method in Helper/PaymentMethodsFilter.php to return only the filtered Magento payment methods, removing the previously returned adyenPaymentMethodsResponse and an associated TODO comment. This change also includes a minor refactoring to directly pass the API response to json_decode. Consequential updates were made across Plugin/MultishippingPaymentMethods.php and Plugin/SortAndFilterAdyenPaymentMethods.php to align with the updated return signature, removing list() assignments and simplifying return statements. Corresponding unit tests in Test/Unit/Helper/PaymentMethodsFilterTest.php, Test/Unit/Plugin/MultishippingPaymentMethodsTest.php, and Test/Unit/Plugin/SortAndFilterAdyenPaymentMethodsTest.php were also adjusted to reflect the single return value from sortAndFilterPaymentMethods.

@sonarqubecloud
Copy link

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