Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Fix offline invoice capture (404) #39298

Open
m2-assistant bot opened this issue Oct 24, 2024 · 7 comments · May be fixed by #39297 or #39314
Open

[Issue] Fix offline invoice capture (404) #39298

m2-assistant bot opened this issue Oct 24, 2024 · 7 comments · May be fixed by #39297 or #39314
Assignees
Labels
Area: Payments Component: OfflinePayments Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: PR in progress Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@m2-assistant
Copy link

m2-assistant bot commented Oct 24, 2024

This issue is automatically created based on existing pull request: #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 3e63705#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 (*)

  1. create an order with an offline payment method
  2. create an invoice for the order (offline)
  3. capture the invoice
@m2-assistant m2-assistant bot linked a pull request Oct 24, 2024 that will close this issue
1 task
@github-project-automation github-project-automation bot moved this to Ready for Confirmation in Issue Confirmation and Triage Board Oct 24, 2024
@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Oct 24, 2024
@engcom-Bravo engcom-Bravo self-assigned this Oct 24, 2024
Copy link
Author

m2-assistant bot commented Oct 24, 2024

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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Oct 24, 2024
@engcom-Bravo
Copy link
Contributor

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.

Screenshot 2024-10-25 at 10 41 29

Thanks.

@engcom-Bravo engcom-Bravo added the Issue: needs update Additional information is require, waiting for response label Oct 25, 2024
@engcom-Bravo engcom-Bravo moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Oct 25, 2024
@nige-one
Copy link
Contributor

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:

'onclick' => 'setLocation(\'' . $this->getCaptureUrl() . '\')'

and
return $this->getUrl('sales/*/capture', ['invoice_id' => $this->getInvoice()->getId()]);

the mentioned commit 3e63705#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.

@Syamsg Syamsg linked a pull request Oct 31, 2024 that will close this issue
@engcom-Bravo engcom-Bravo added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Nov 7, 2024
Copy link
Author

m2-assistant bot commented Nov 7, 2024

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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel
Copy link
Contributor

Hello @nige-one,

Thanks for the detailed explanation!

We agree your point, hence confirming this issue after looking into the code changes.

Thanks

@engcom-Hotel engcom-Hotel added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: OfflinePayments Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Payments and removed Issue: needs update Additional information is require, waiting for response labels Nov 11, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-13336 is successfully created for this GitHub issue.

Copy link
Author

m2-assistant bot commented Nov 11, 2024

✅ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Payments Component: OfflinePayments Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: PR in progress Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
4 participants