-
Notifications
You must be signed in to change notification settings - Fork 222
[ECP-9871-v9] Add capturePspReference to Scalapay refund requests #3203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @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 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
| $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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
- In
Gateway/Request/RefundDataBuilder.php:- Rename variable
$requiresCapturePspreferenceto$requiresCapturePspReference. - Update method call to
getRefundRequiresCapturePspReference.
- Rename variable
- In
Helper/PaymentMethods.php:- Rename constant
CONFIG_FIELD_REFUND_REQUIRES_CAPTURE_PSPREFERENCEtoCONFIG_FIELD_REFUND_REQUIRES_CAPTURE_PSP_REFERENCE. - Rename method
getRefundRequiresCapturePspreferencetogetRefundRequiresCapturePspReference.
- Rename constant
- In
etc/config.xml:- Rename XML tag
<refund_requires_capture_pspreference>to<refund_requires_capture_psp_reference>.
- Rename XML tag
- In
Test/Unit/Gateway/Request/RefundDataBuilderTest.php:- Update mocked method name to
getRefundRequiresCapturePspReference.
- Update mocked method name to
- In
Test/Unit/Helper/PaymentMethodsTest.php:- Update test method name to
testGetRefundRequiresCapturePspReferenceand update constant/method names used in the test.
- Update test method name to
$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) {
Description
This PR adds the missing required
capturePspReferencefield for the refunds of partially captured payments for Scalapay.