Skip to content

[ECP-9569] Removing deprecations from Version 10#2976

Merged
khushboo-singhvi merged 18 commits intodevelop-10from
ECP-9569
Jun 3, 2025
Merged

[ECP-9569] Removing deprecations from Version 10#2976
khushboo-singhvi merged 18 commits intodevelop-10from
ECP-9569

Conversation

@khushboo-singhvi
Copy link
Contributor

Description

This PR aims at removing the deprecations from V10
Following methods or constants have been deprecated:

Class Name Methods/constants Reason or Next Usage
OrderAdapter getQuoteId Use Magento\Sales\Api\Data\OrderInterface::getQuoteId() instead
CheckoutDataBuilder getOpenInvoiceData Use Adyen\Payment\Helper\OpenInvoice::getOpenInvoiceDataForOrder() instead.
CreditMemo getAdyenCreditmemoByPspreference Use AdyenCreditmemoRepositoryInterface::getByRefundWebhook() instead.
OpenInvoice formatInvoiceDiscount deprecated - no info
PaymentMethodUtil OPEN_INVOICE_PAYMENT_METHODS - constant Use payment method configuration field is_open_invoice defined in `Adyen\Payment\etc\config.xml
AdyenAmountCurrency getDiscountTaxCompensationAmount deprecated - no info
AdyenAmountCurrency getAmountIncludingTaxWithDiscount deprecated - no info
AdyenAmountCurrency getAmountWithDiscount deprecated - no info
AdyenAmountCurrency getCalculatedTaxPercentage deprecated - no info
Model/RecurringType   deprecated - no info
Model/Source/RecurringType   deprecated - no info
Data getRecurringTypes No usage
TransportBuilder setFrom 102.0.1 This function sets the from address but does not provide
CreditMemo/Collection getAdyenCreditMemosLinkedToMagentoInvoice deprecated - no info
ResourceModel/CreditMemo getAdyenCreditmemoByPspreference Use AdyenCreditmemoRepositoryInterface::getByRefundWebhook() instead.
ResourceModel/CreditMemo getAdyenCreditmemosByAdyenPaymentid Use AdyenCreditmemoRepositoryInterface::getByAdyenOrderPaymentId() instead.
ResourceModel/Invoice getAdyenInvoicesByAdyenPaymentId Use Adyen\Payment\Helper\Invoice::getAdyenInvoicesByAdyenPaymentId() method instead.
ResourceModel/Invoice getAdyenInvoiceByCaptureWebhook Use AdyenInvoiceRepositoryInterface::getByCaptureWebhook() instead.
BeforeShipmentObserver AdyenHelper Not being used
BeforeShipmentObserver isPaymentMethodAdyen Use isAdyenPayment() method from Adyen\Payment\Helper\PaymentMethods.
adyen-facilypay-3x-method.js   This file will be removed on V10. Use adyen-facilypay-method.js instead.
PaymentRequest   deprecated
Config isAlternativePaymentMethodsEnabled deprecated - no info
Data PSP_REFERENCE_REGEX constants not used
Data AFTERPAY constants not used
Data AFTERPAY_TOUCH constants not used
Data KLARNA constants not used
Data isDemoMode Use \Adyen\Payment\Helper\Config::isDemoMode
Data getHmac No usage found
Data RATEPAY constants not used
Data FACILYPAY constants not used
Data AFFIRM constants not used
Data CLEARPAY constants not used
Data ZIP constants not used
Data PAYBRIGHT constants not used
Data SEPA constants not used
Data MOLPAY constants not used
Data ATOME constants not used
Data WALLEYB2B constants not used
Data WALLEY constants not used
Data getPaymentRoutines No usage found
Data getMinorUnitTaxPercent No usage found
Data getAPIKey Use Adyen\Payment\Helper\Config::getApiKey instead
Data getClientKey Use getClientKey in Helper/Config
Data getWsUsername No usage found
Data getLiveEndpointPrefix No usage found
Data cancelOrder Use cancelOrder Helper/Order
Data getModuleName Use Helper/PlatfomInfo -> getModuleName
Data getModuleVersion Use Helper/PlatfomInfo -> getModuleVersion
Data isPaymentMethodOpenInvoiceMethod Use Adyen\Payment\Helper\PaymentMethods::isOpenInvoice() instead.
Data isPaymentMethodOfType No usage found
Data isVatCategoryHigh No usage found
Data showLogos Use showLogos in Helper/PaymentMethods
Data getStoreLocale Use getStoreLocale in Helper/Locale
Data formatLocaleCode No usage found
Data getMagentoDetails Use getMagentoDetails in Helper/PlatformInfo
Data buildRequestHeaders Use buildRequestHeaders in Helper/PlatformInfo
Data buildApplicationInfo Use buildApplicationInfo in Helper/PlatformInfo
Data getOrigin Deprecated
Data getOriginKeyForBaseUrl please use getClientKey instead
Data getOriginKeyForOrigin No usage found
Data getCustomerId No usage found
Data isHppVaultEnabled No usage found
Data createAdyenCheckoutService use initializePaymentsApi, or initializeModificationsApi based on your case
Data createAdyenRecurringService use initializeRecurringApi()
Data formatDate Deprecated
Data buildThreeDS2ProcessResponseJson No usage found
Data getCurrentLocaleCode Use getCurrentLocaleCode in Helper/Locale

Tested scenarios

Fixes

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.

Hello @khushboo-singhvi, 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!

Summary of Changes

Hello team,

Gemini here, providing a summary for this pull request. The primary objective of this PR is to clean up the codebase by removing various methods, constants, and files that were previously marked as deprecated. This is a significant step towards preparing the module for the upcoming V10 release, ensuring a leaner and more maintainable codebase by eliminating outdated functionalities and dependencies.

The changes involve removing deprecated code across numerous helper classes, gateway clients, models, and UI components. Functionality from some deprecated methods has been migrated to new or existing helper classes where appropriate, centralizing related logic. Several deprecated files have also been removed entirely.

Highlights

  • Deprecated Code Removal: Numerous methods and constants marked as deprecated in previous versions have been removed from various classes, including Helper/Data, Gateway/Data/Order/OrderAdapter, Helper/Creditmemo, Helper/OpenInvoice, Helper/Util/PaymentMethodUtil, Model/AdyenAmountCurrency, and others.
  • New Helper Classes: Two new helper classes, Helper/PlatformInfo.php and Helper/Locale.php, have been introduced to consolidate platform-specific information (like module version, Magento details, request headers) and locale-related functionalities, respectively. Code previously residing in Helper/Data has been moved to these new helpers.
  • Refactored Dependencies: Classes that previously depended on the deprecated methods or constants, particularly those in the large Helper/Data class, have been updated to use the new helper classes (PlatformInfo, Locale, PaymentMethods, PaymentResponseHandler) or the recommended alternative methods.
  • File Deletion: Several entire files that were marked as deprecated have been removed, including Model/Config/Source/RecurringType.php, Model/RecurringType.php, and the JavaScript file web/js/view/payment/method-renderer/adyen-facilypay-3x-method.js.
  • Unit Test Updates: Corresponding unit tests have been updated or removed to align with the code changes, ensuring test coverage remains relevant after the deprecation removals.

Changelog

Click here to see the changelog
  • AdminMessage/VersionMessage.php
    • Removed deprecated _adyenHelper property.
    • Added dependency on PlatformInfo helper.
    • Updated calls to getModuleVersion to use PlatformInfo.
  • Block/Adminhtml/System/Config/Field/Version.php
    • Replaced dependency on Helper/Data with PlatformInfo.
    • Updated calls to getModuleVersion to use PlatformInfo.
  • Block/Checkout/Multishipping/Success.php
    • Added dependency on Locale helper.
    • Updated calls to getCurrentLocaleCode to use Locale.
  • Block/Checkout/Success.php
    • Removed deprecated property related to locale.
    • Added dependency on Locale helper.
    • Updated calls to getCurrentLocaleCode to use Locale.
  • Block/Form/Moto.php
    • Added dependency on Locale helper.
    • Updated calls to getStoreLocale to use Locale.
    • Added @throws tags to getCheckoutEnvironment method.
  • Gateway/Data/Order/OrderAdapter.php
    • Removed deprecated getQuoteId() method.
  • Gateway/Http/Client/TransactionCancel.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to buildApplicationInfo to use PlatformInfo.
  • Gateway/Http/Client/TransactionCapture.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to buildApplicationInfo to use PlatformInfo.
  • Gateway/Http/Client/TransactionDonate.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to buildRequestHeaders and buildApplicationInfo to use PlatformInfo.
  • Gateway/Http/Client/TransactionPayment.php
    • Added dependency on PlatformInfo helper.
    • Removed @throws ConnectionException from placeRequest method signature.
    • Updated calls to buildApplicationInfo to use PlatformInfo.
  • Gateway/Http/Client/TransactionPaymentLinks.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to buildApplicationInfo to use PlatformInfo.
  • Gateway/Http/Client/TransactionRefund.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to buildApplicationInfo to use PlatformInfo.
  • Gateway/Request/CheckoutDataBuilder.php
    • Added RATEPAY and KLARNA constants.
    • Replaced calls to isPaymentMethodOfType with str_contains checks using new constants.
    • Removed deprecated getOpenInvoiceData() method.
  • Gateway/Request/Header/HeaderDataBuilder.php
    • Replaced dependency on Helper/Data with PlatformInfo.
    • Updated calls to buildRequestHeaders to use PlatformInfo.
  • Helper/Config.php
    • Removed deprecated isAlternativePaymentMethodsEnabled() method.
  • Helper/Creditmemo.php
    • Removed deprecated getAdyenCreditmemoByPspreference() method.
  • Helper/Data.php
    • Removed numerous deprecated methods and constants (see PR description for full list).
    • Removed dependencies on classes related to removed methods (e.g., ProductMetadataInterface, ResolverInterface, ComponentRegistrarInterface, OrderManagementInterface, HistoryFactory).
    • Added dependencies on PlatformInfo and RequestInterface.
    • Moved padShopperReference method within the file.
  • Helper/Locale.php
    • New file created to house locale-related helper methods (mapLocaleCode, getStoreLocale, getCurrentLocaleCode).
  • Helper/OpenInvoice.php
    • Removed deprecated formatInvoiceDiscount() method.
  • Helper/PaymentMethods.php
    • Removed dependency on AdyenDataHelper.
    • Added dependencies on Locale and PlatformInfo helpers.
    • Updated calls to locale and platform methods to use the new helpers.
    • Removed deprecated isOpenInvoice logic from showLogosPaymentMethods.
    • Moved showLogos() method from Helper/Data to this class.
  • Helper/PaymentResponseHandler.php
    • Added dependency on OrderService.
    • Moved cancelOrder() method from Helper/Data to this class.
  • Helper/PaymentsDetails.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to buildRequestHeaders to use PlatformInfo.
  • Helper/PlatformInfo.php
    • New file created to house platform-related helper methods (getModuleName, getModuleVersion, getMagentoDetails, buildApplicationInfo, buildRequestHeaders, padShopperReference).
  • Helper/PointOfSale.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to platform methods (padShopperReference, getModuleVersion, getModuleName) to use PlatformInfo.
  • Helper/SupportFormHelper.php
    • Replaced dependency on Helper/Data with PlatformInfo.
    • Updated calls to getModuleVersion to use PlatformInfo.
  • Helper/Util/PaymentMethodUtil.php
    • Removed deprecated OPEN_INVOICE_PAYMENT_METHODS constant.
    • Removed deprecated isOpenInvoicePaymentMethod() method.
  • Model/AdyenAmountCurrency.php
    • Removed deprecated properties ($discountTaxCompensationAmount).
    • Removed deprecated methods (getDiscountTaxCompensationAmount, getAmountIncludingTaxWithDiscount, getAmountWithDiscount, getCalculatedTaxPercentage).
  • Model/Api/AdyenDonationCampaigns.php
    • Replaced dependency on Helper/Data with Locale.
    • Updated calls to getCurrentLocaleCode to use Locale.
  • Model/Api/PaymentRequest.php
    • Added dependency on PlatformInfo helper.
    • Updated calls to padShopperReference to use PlatformInfo.
  • Model/Config/Source/RecurringType.php
    • Deleted deprecated file.
  • Model/RecurringType.php
    • Deleted deprecated file.
  • Model/Resolver/StoreConfig/StoreLocale.php
    • Replaced dependency on Helper/Data with Locale.
    • Updated calls to getStoreLocale to use Locale.
  • Model/ResourceModel/Creditmemo/Collection.php
    • Removed deprecated getAdyenCreditMemosLinkedToMagentoInvoice() method.
  • Model/ResourceModel/Creditmemo/Creditmemo.php
    • Removed deprecated getAdyenCreditmemosByAdyenPaymentid() and getAdyenCreditmemoByPspreference() methods.
  • Model/ResourceModel/Invoice/Invoice.php
    • Removed deprecated getAdyenInvoicesByAdyenPaymentId() and getAdyenInvoiceByCaptureWebhook() methods.
  • Model/TransportBuilder.php
    • Removed deprecated setFrom() method.
  • Model/Ui/AdyenCcConfigProvider.php
    • Added dependency on Locale helper.
    • Updated calls to getStoreLocale to use Locale.
  • Model/Ui/AdyenGenericConfigProvider.php
    • Added dependencies on Locale and PaymentMethods helpers.
    • Updated calls to locale and payment methods helper methods.
    • Removed local showLogos() method.
  • Observer/BeforeShipmentObserver.php
    • Removed deprecated AdyenHelper property and dependency.
    • Removed deprecated isPaymentMethodAdyen() method.
  • Test/Helper/Unit/Model/AdyenAmountCurrencyTest.php
    • Deleted deprecated test file.
  • Test/Unit/AbstractAdyenTestCase.php
    • Minor formatting change (added newline).
  • Test/Unit/Helper/CreditmemoTest.php
    • Removed test for deprecated getAdyenCreditmemoByPspreference method.
  • Test/Unit/Helper/DataTest.php
    • Removed numerous tests corresponding to removed methods in Helper/Data.
    • Updated test setup to reflect changes in dependencies.
    • Added tests for remaining methods.
  • Test/Unit/Helper/OpenInvoiceTest.php
    • Changed visibility of isVirtualDataProvider to public.
  • Test/Unit/Model/Ui/AdyenCcConfigProviderTest.php
    • Added dependency on Locale helper in tests.
    • Updated test to use Locale helper for locale calls.
    • Minor test class formatting changes.
  • Test/Unit/Model/Ui/AdyenGenericConfigProviderTest.php
    • Added dependencies on Locale and PaymentMethods helpers in tests.
    • Updated tests to use the new helper dependencies.
  • web/js/view/payment/method-renderer/adyen-facilypay-3x-method.js
    • Deleted deprecated file.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.


Old code, now retired,
From the module, desired,
Clean paths now appear,
As V10 draws near,
By good refactors inspired.

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 effectively removes a substantial amount of deprecated code and refactors functionalities into more specialized helper classes, which is a great improvement for maintainability. The introduction of PlatformInfo.php and the enhanced Locale.php are positive changes.

I've found a few potential issues, primarily related to a namespace and a possibly redundant method, which are detailed in the review comments. Addressing these will help ensure the robustness and clarity of the codebase.

Great work on this large-scale cleanup!

Summary of Findings

  • Namespace Mismatch for PlatformInfo: In AdminMessage/VersionMessage.php, the use statement for PlatformInfo might be incorrect, potentially leading to a class not found error. It's currently use Helper\PlatformInfo; but the class is Adyen\Payment\Helper\PlatformInfo.
  • Redundant padShopperReference Method: The method padShopperReference has been refactored into Helper\PlatformInfo.php but also re-appears at the end of Helper\Data.php. This duplication should be resolved by removing the version in Helper\Data.php.

Merge Readiness

The pull request makes significant strides in cleaning up deprecated code and improving the codebase structure. However, there are a few high and medium severity issues identified that should be addressed before merging to ensure stability and maintainability. Specifically, the namespace issue in AdminMessage/VersionMessage.php is critical. Once these points are resolved, the PR should be in good shape for merging. As an AI, I am not authorized to approve pull requests; please ensure further review and approval by team members.

# Conflicts:
#	AdminMessage/VersionMessage.php
#	Gateway/Request/CheckoutDataBuilder.php
#	Helper/PaymentMethods.php
#	Helper/PaymentResponseHandler.php
#	Helper/PlatformInfo.php
#	Model/Api/PaymentRequest.php
#	Test/Unit/Helper/DataTest.php
#	Test/Unit/Model/Ui/AdyenCcConfigProviderTest.php
#	Test/Unit/Model/Ui/AdyenGenericConfigProviderTest.php
# Conflicts:
#	Helper/Data.php
candemiralp
candemiralp previously approved these changes Jun 2, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 2, 2025

@khushboo-singhvi khushboo-singhvi merged commit 63122f9 into develop-10 Jun 3, 2025
12 of 14 checks passed
@khushboo-singhvi khushboo-singhvi deleted the ECP-9569 branch June 4, 2025 08:07
@khushboo-singhvi khushboo-singhvi added the Breaking change Indicates a change that has caused a major version update label Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking change Indicates a change that has caused a major version update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants