Open m2-assistant[bot] opened 4 weeks ago
Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hi @nige-one,
Thanks for your reporting and collaboration.
We have tried to reproduce the issue in Latest 2.4-develop instance and we are not able to proceed further.Could you please elaborate the steps regarding Capture the invoice in Magento Backend.
Thanks.
Hi @engcom-Bravo thanks for checking. I missed that Magento's default offline payment methods do not allow to capture. We implemented a simple custom offline payment method with:
protected $_canCapture = true;
This allows our merchant to track payments for manually managed payments (bank transfer).
I see that \Magento\Payment\Model\Method\AbstractMethod
is marked as deprecated, propably based on the decision to move towards \Magento\Payment\Model\MethodInterface
and its Adapter
abstract implementation. But most (?) of the vanilla payment methods still rely on the AbstractMethod
heavily.
Nonetheless, since the rendered 'Capture' button in the backend will always be a GET request: https://github.com/magento/magento2/blob/5a2037c35de89ce2c50e230164ff3ea7b67ac127/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php#L135 and https://github.com/magento/magento2/blob/5a2037c35de89ce2c50e230164ff3ea7b67ac127/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php#L232
the mentioned commit https://github.com/magento/magento2/commit/3e637056d1031185c7c8989f7a24302cecb5b27b#diff-f55a86b611d11bb9a801c4b16ba9ac4b17dab4c325d252b86d5d3a8b8275c291 will always break the button functionality.
One could argue to implement a "Paid" button for a custom offline payment method instead of the "Capture" one, but this will still render the "Capture" button useless anyway.
So, from my perspective this is a breaking change.
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @nige-one,
Thanks for the detailed explanation!
We agree your point, hence confirming this issue after looking into the code changes.
Thanks
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-13336 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
This issue is automatically created based on existing pull request: magento/magento2#39297: Fix offline invoice capture (404)
Description (*)
It's not possible to capture offline payment method invoices via the backend ('Capture' button). Trying it will lead to a 404.
Related Pull Requests
The issue comes from https://github.com/magento/magento2/commit/3e637056d1031185c7c8989f7a24302cecb5b27b#diff-f55a86b611d11bb9a801c4b16ba9ac4b17dab4c325d252b86d5d3a8b8275c291
The class has been changed to be implementing
HttpPostActionInterface
. Clicking the 'Capture' button will send a GET request. Magento's request validator\Magento\Framework\App\Request\HttpMethodValidator
will throw an exception leading to a 404 because it expects a POST request.Manual testing scenarios (*)