Description
This issue is automatically created based on existing pull request: #33003: add missing PaymentMethodInterface
Description (*)
During checkout payment information details can be requested via
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Checkout/Model/PaymentInformationManagement.php#L185
which uses
$paymentDetails->setPaymentMethods($this->paymentMethodManagement->getList($cartId));
According to https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Checkout/Api/Data/PaymentDetailsInterface.php#L25 this should be an array of \Magento\Quote\Api\Data\PaymentMethodInterface
Any Payment Methods based on https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Payment/Model/Method/Adapter.php would technically not be valid due to the missing interface. The interface methods are already implemented. As the Adapter class already includes these methods this should not be a breaking change.
Related Pull Requests
Fixed Issues (if relevant)
- Fixes N/A
Manual testing scenarios (*)
- Test checkout with different payment methods
Additional Information to reproduce the issue
we have tried to debug the code. According to the interface app/code/Magento/Checkout/Api/Data/PaymentDetailsInterface.php
:
The overriding/implemented method should return the object of the class \Magento\Quote\Api\Data\PaymentMethodInterface[]
. And we can see it is implemented in the below class:
magento2/app/code/Magento/Checkout/Model/PaymentDetails.php
Lines 17 to 20 in 84e7dfa
Which internally calls the $this->getData(self::PAYMENT_METHODS);
:
magento2/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
Lines 276 to 305 in 84e7dfa
Which is returning the mixed array as shown in the below screenshot:
I think you are talking about the same thing it should return the object of \Magento\Quote\Api\Data\PaymentMethodInterface[]
but it is returning the mixed array.
Questions or comments
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- All automated tests passed successfully (all builds are green)