[ECP-9569] Removing deprecations from Version 10#2976
[ECP-9569] Removing deprecations from Version 10#2976khushboo-singhvi merged 18 commits intodevelop-10from
Conversation
# Conflicts: # Helper/Requests.php # Model/Api/AdyenDonations.php # Test/Unit/Model/Api/AdyenDonationCampaignsTest.php # Test/Unit/Model/Api/AdyenDonationsTest.php
# Conflicts: # Helper/Data.php
There was a problem hiding this comment.
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.phpandHelper/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 inHelper/Datahas been moved to these new helpers. - Refactored Dependencies: Classes that previously depended on the deprecated methods or constants, particularly those in the large
Helper/Dataclass, 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 fileweb/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
_adyenHelperproperty. - Added dependency on
PlatformInfohelper. - Updated calls to
getModuleVersionto usePlatformInfo.
- Removed deprecated
- Block/Adminhtml/System/Config/Field/Version.php
- Replaced dependency on
Helper/DatawithPlatformInfo. - Updated calls to
getModuleVersionto usePlatformInfo.
- Replaced dependency on
- Block/Checkout/Multishipping/Success.php
- Added dependency on
Localehelper. - Updated calls to
getCurrentLocaleCodeto useLocale.
- Added dependency on
- Block/Checkout/Success.php
- Removed deprecated property related to locale.
- Added dependency on
Localehelper. - Updated calls to
getCurrentLocaleCodeto useLocale.
- Block/Form/Moto.php
- Added dependency on
Localehelper. - Updated calls to
getStoreLocaleto useLocale. - Added
@throwstags togetCheckoutEnvironmentmethod.
- Added dependency on
- Gateway/Data/Order/OrderAdapter.php
- Removed deprecated
getQuoteId()method.
- Removed deprecated
- Gateway/Http/Client/TransactionCancel.php
- Added dependency on
PlatformInfohelper. - Updated calls to
buildApplicationInfoto usePlatformInfo.
- Added dependency on
- Gateway/Http/Client/TransactionCapture.php
- Added dependency on
PlatformInfohelper. - Updated calls to
buildApplicationInfoto usePlatformInfo.
- Added dependency on
- Gateway/Http/Client/TransactionDonate.php
- Added dependency on
PlatformInfohelper. - Updated calls to
buildRequestHeadersandbuildApplicationInfoto usePlatformInfo.
- Added dependency on
- Gateway/Http/Client/TransactionPayment.php
- Added dependency on
PlatformInfohelper. - Removed
@throws ConnectionExceptionfromplaceRequestmethod signature. - Updated calls to
buildApplicationInfoto usePlatformInfo.
- Added dependency on
- Gateway/Http/Client/TransactionPaymentLinks.php
- Added dependency on
PlatformInfohelper. - Updated calls to
buildApplicationInfoto usePlatformInfo.
- Added dependency on
- Gateway/Http/Client/TransactionRefund.php
- Added dependency on
PlatformInfohelper. - Updated calls to
buildApplicationInfoto usePlatformInfo.
- Added dependency on
- Gateway/Request/CheckoutDataBuilder.php
- Added
RATEPAYandKLARNAconstants. - Replaced calls to
isPaymentMethodOfTypewithstr_containschecks using new constants. - Removed deprecated
getOpenInvoiceData()method.
- Added
- Gateway/Request/Header/HeaderDataBuilder.php
- Replaced dependency on
Helper/DatawithPlatformInfo. - Updated calls to
buildRequestHeadersto usePlatformInfo.
- Replaced dependency on
- Helper/Config.php
- Removed deprecated
isAlternativePaymentMethodsEnabled()method.
- Removed deprecated
- Helper/Creditmemo.php
- Removed deprecated
getAdyenCreditmemoByPspreference()method.
- Removed deprecated
- 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
PlatformInfoandRequestInterface. - Moved
padShopperReferencemethod within the file.
- Helper/Locale.php
- New file created to house locale-related helper methods (
mapLocaleCode,getStoreLocale,getCurrentLocaleCode).
- New file created to house locale-related helper methods (
- Helper/OpenInvoice.php
- Removed deprecated
formatInvoiceDiscount()method.
- Removed deprecated
- Helper/PaymentMethods.php
- Removed dependency on
AdyenDataHelper. - Added dependencies on
LocaleandPlatformInfohelpers. - Updated calls to locale and platform methods to use the new helpers.
- Removed deprecated
isOpenInvoicelogic fromshowLogosPaymentMethods. - Moved
showLogos()method fromHelper/Datato this class.
- Removed dependency on
- Helper/PaymentResponseHandler.php
- Added dependency on
OrderService. - Moved
cancelOrder()method fromHelper/Datato this class.
- Added dependency on
- Helper/PaymentsDetails.php
- Added dependency on
PlatformInfohelper. - Updated calls to
buildRequestHeadersto usePlatformInfo.
- Added dependency on
- Helper/PlatformInfo.php
- New file created to house platform-related helper methods (
getModuleName,getModuleVersion,getMagentoDetails,buildApplicationInfo,buildRequestHeaders,padShopperReference).
- New file created to house platform-related helper methods (
- Helper/PointOfSale.php
- Added dependency on
PlatformInfohelper. - Updated calls to platform methods (
padShopperReference,getModuleVersion,getModuleName) to usePlatformInfo.
- Added dependency on
- Helper/SupportFormHelper.php
- Replaced dependency on
Helper/DatawithPlatformInfo. - Updated calls to
getModuleVersionto usePlatformInfo.
- Replaced dependency on
- Helper/Util/PaymentMethodUtil.php
- Removed deprecated
OPEN_INVOICE_PAYMENT_METHODSconstant. - Removed deprecated
isOpenInvoicePaymentMethod()method.
- Removed deprecated
- Model/AdyenAmountCurrency.php
- Removed deprecated properties (
$discountTaxCompensationAmount). - Removed deprecated methods (
getDiscountTaxCompensationAmount,getAmountIncludingTaxWithDiscount,getAmountWithDiscount,getCalculatedTaxPercentage).
- Removed deprecated properties (
- Model/Api/AdyenDonationCampaigns.php
- Replaced dependency on
Helper/DatawithLocale. - Updated calls to
getCurrentLocaleCodeto useLocale.
- Replaced dependency on
- Model/Api/PaymentRequest.php
- Added dependency on
PlatformInfohelper. - Updated calls to
padShopperReferenceto usePlatformInfo.
- Added dependency on
- Model/Config/Source/RecurringType.php
- Deleted deprecated file.
- Model/RecurringType.php
- Deleted deprecated file.
- Model/Resolver/StoreConfig/StoreLocale.php
- Replaced dependency on
Helper/DatawithLocale. - Updated calls to
getStoreLocaleto useLocale.
- Replaced dependency on
- Model/ResourceModel/Creditmemo/Collection.php
- Removed deprecated
getAdyenCreditMemosLinkedToMagentoInvoice()method.
- Removed deprecated
- Model/ResourceModel/Creditmemo/Creditmemo.php
- Removed deprecated
getAdyenCreditmemosByAdyenPaymentid()andgetAdyenCreditmemoByPspreference()methods.
- Removed deprecated
- Model/ResourceModel/Invoice/Invoice.php
- Removed deprecated
getAdyenInvoicesByAdyenPaymentId()andgetAdyenInvoiceByCaptureWebhook()methods.
- Removed deprecated
- Model/TransportBuilder.php
- Removed deprecated
setFrom()method.
- Removed deprecated
- Model/Ui/AdyenCcConfigProvider.php
- Added dependency on
Localehelper. - Updated calls to
getStoreLocaleto useLocale.
- Added dependency on
- Model/Ui/AdyenGenericConfigProvider.php
- Added dependencies on
LocaleandPaymentMethodshelpers. - Updated calls to locale and payment methods helper methods.
- Removed local
showLogos()method.
- Added dependencies on
- Observer/BeforeShipmentObserver.php
- Removed deprecated
AdyenHelperproperty and dependency. - Removed deprecated
isPaymentMethodAdyen()method.
- Removed deprecated
- 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
getAdyenCreditmemoByPspreferencemethod.
- Removed test for deprecated
- 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.
- Removed numerous tests corresponding to removed methods in
- Test/Unit/Helper/OpenInvoiceTest.php
- Changed visibility of
isVirtualDataProviderto public.
- Changed visibility of
- Test/Unit/Model/Ui/AdyenCcConfigProviderTest.php
- Added dependency on
Localehelper in tests. - Updated test to use
Localehelper for locale calls. - Minor test class formatting changes.
- Added dependency on
- Test/Unit/Model/Ui/AdyenGenericConfigProviderTest.php
- Added dependencies on
LocaleandPaymentMethodshelpers in tests. - Updated tests to use the new helper dependencies.
- Added dependencies on
- 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
-
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. ↩
There was a problem hiding this comment.
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, theusestatement forPlatformInfomight be incorrect, potentially leading to a class not found error. It's currentlyuse Helper\PlatformInfo;but the class isAdyen\Payment\Helper\PlatformInfo. - Redundant
padShopperReferenceMethod: The methodpadShopperReferencehas been refactored intoHelper\PlatformInfo.phpbut also re-appears at the end ofHelper\Data.php. This duplication should be resolved by removing the version inHelper\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
|



Description
This PR aims at removing the deprecations from V10
Following methods or constants have been deprecated:
is_open_invoicedefined in `Adyen\Payment\etc\config.xmladyen-facilypay-method.jsinstead.initializePaymentsApi, orinitializeModificationsApibased on your caseinitializeRecurringApi()Tested scenarios
Fixes