SL-347: API version increase, added new payment method, removed deprecated#313
SL-347: API version increase, added new payment method, removed deprecated#313justelis22 wants to merge 2 commits intomasterfrom
Conversation
Summary of ChangesHello, 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 Saferpay module to a newer API version, enhancing its payment processing capabilities by integrating new payment methods (WERO and Giftcard) and removing support for outdated ones (Giropay, Paydirekt, and Sofort). Additionally, it includes minor code formatting adjustments and improves the resilience of card data handling, ensuring the module remains current and stable. 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. Changelog
Activity
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.
Code Review
This pull request updates the Saferpay API version, adds new payment methods (WERO, GIFTCARD), and removes deprecated ones. While no significant security vulnerabilities were identified during the audit, a critical issue was found regarding the removal of refund notification logic, which could disrupt asynchronous refund status updates. Additionally, there's a potential configuration issue with the new payment methods concerning their support for capture and cancellation, and a minor suggestion for code conciseness.
I am having trouble creating individual review comments. Click here to see my feedback.
src/Service/SaferPayOrderStatusService.php (269-283)
The removed block was responsible for setting up pending notifications for refunds, specifically for PAYDIREKT. By removing it, the $pendingNotification object is no longer created, and thus no NotifyUrl will be sent to Saferpay for refund requests. This will break asynchronous updates for pending refunds for any payment method that supports them, as the pendingNotify controller will never be called. This logic should be preserved and likely generalized for all payment methods that can have a pending refund status, including potentially the new WERO and GIFTCARD methods.
$paymentMethodsWithPendingRefund = [
// TODO: Add all payment methods that can have a pending refund status.
];
if (in_array($saferPayAssert->payment_method, $paymentMethodsWithPendingRefund)) {
$pendingNotify = $this->context->getLink()->getModuleLink(
$this->module->name,
ControllerName::PENDING_NOTIFY,
[
'success' => 1,
'cartId' => $cart->id,
'orderId' => Order::getOrderByCartId($cart->id),
'secureKey' => $cart->secure_key,
],
true
);
$customer = new Customer($order->id_customer);
$pendingNotification = new PendingNotification($pendingNotify, [$customer->email]);
}src/Config/SaferPayConfig.php (94-95)
The new payment methods WERO and GIFTCARD are not added to the exclusion lists in supportsOrderCapture() and supportsOrderCancel(). This implies they support capture and cancellation. If they do not, this could lead to errors when performing these actions on orders paid with these methods. Please verify if these payment methods support capture and cancellation and add them to the respective exclusion lists if they don't.
src/Service/Response/ResponseObjectCreator.php (80-85)
For better conciseness, you can use the null coalescing operator (??) which is available in PHP 7.0+ to achieve the same result in fewer lines of code.
$cardObj->setExpYear($card->ExpYear ?? null);
$cardObj->setExpMonth($card->ExpMonth ?? null);
Self-Checks
JIRA task link
https://invertus.atlassian.net/browse/SL-347
Summary
QA Checklist Labels
QA Checklist
Additional Context
Frontend Changes