Skip to content

SL-347: API version increase, added new payment method, removed deprecated#313

Open
justelis22 wants to merge 2 commits intomasterfrom
SL-347/api-version-update
Open

SL-347: API version increase, added new payment method, removed deprecated#313
justelis22 wants to merge 2 commits intomasterfrom
SL-347/api-version-update

Conversation

@justelis22
Copy link
Copy Markdown
Collaborator

@justelis22 justelis22 commented Mar 4, 2026

Self-Checks

  • I have performed a self-review of my code.
  • I have updated/added necessary technical documentation in the README file.

JIRA task link

https://invertus.atlassian.net/browse/SL-347

Summary

QA Checklist Labels

  • Bug fix?
  • New feature?
  • Improvement?
  • Technical debt?
  • Reusable?
  • Covered by tests?

QA Checklist

Additional Context

Frontend Changes

@gemini-code-assist
Copy link
Copy Markdown
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 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

  • API Version Update: The Saferpay module's API version has been increased from 1.45 to 1.50 to align with the latest specifications.
  • New Payment Methods Added: Support for new payment methods, WERO and Giftcard, has been introduced, expanding the module's capabilities.
  • Deprecated Payment Methods Removed: The deprecated payment methods Giropay, Paydirekt, and Sofort have been removed from the module's configuration and translation.
  • Code Readability Improvements: Several multi-condition if statements across the codebase have been reformatted with newlines to enhance readability.
  • Robust Card Data Handling: The processing of card expiration year and month has been made more robust by conditionally setting these values only if they are present in the response.

🧠 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
  • saferpayofficial.php
    • Updated the module version from '2.0.2' to '2.1.0'.
    • Refactored conditional statements by adding newlines for improved readability.
  • src/Config/SaferPayConfig.php
    • Increased the API version constant from '1.45' to '1.50'.
    • Removed constants and references for 'PAYMENT_GIROPAY', 'PAYMENT_PAYDIREKT', and 'PAYMENT_SOFORT'.
    • Added new constants and references for 'PAYMENT_WERO' and 'PAYMENT_GIFTCARD'.
    • Adjusted line breaks for 'getConfigSuffix()' calls for better formatting.
  • src/Service/LegacyTranslator.php
    • Removed translation entries for 'PAYMENT_GIROPAY', 'PAYMENT_PAYDIREKT', and 'PAYMENT_SOFORT'.
    • Added translation entries for 'PAYMENT_WERO' and 'PAYMENT_GIFTCARD'.
  • src/Service/Response/ResponseObjectCreator.php
    • Modified the 'createPaymentMeans' method to conditionally set 'ExpYear' and 'ExpMonth' for card objects only if they exist in the response.
  • src/Service/SaferPayOrderStatusService.php
    • Removed the specific pending notification logic that was previously tied to the 'PAYMENT_PAYDIREKT' method.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request since its creation.
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
Copy Markdown
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 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)

critical

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)

high

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)

medium

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);

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