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

Capture amount is invalid when discount is higher than subtotal without tax #34181

Closed
1 of 5 tasks
MeCapron opened this issue Sep 28, 2021 · 9 comments
Closed
1 of 5 tasks
Assignees
Labels
Area: Payments Component: Payment Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report.

Comments

@MeCapron
Copy link
Contributor

Preconditions (*)

  1. 2.4.2-p2

Steps to reproduce (*)

  1. Add to your cart a product with a tax class
  2. Add a discount that is for example 95% of the order
  3. Try to capture it

Expected result (*)

  1. Order should be capturable

Actual result (*)

  1. Order is not capturable

Example

Before this commit, the calculation would be the following :

  • Ordering for a total amount of 45€, with 20% tax resulting to a subtotal of 37.5€
  • Adding a discount for 40€
  • During the calculation, Magento would do subtotal - discount = result -> 37.5 - 40 = -2.5
  • Before 2.4.1, Magento will set to the Invoice grand total
  • After 2.4.1, Magento sets 0 to the Invoice grand total
  • During discount tax compensation of 40€, Magento will do grand_total + tax + discount_tax
  • Before 2.4.1, Magento would calculate (-2.5) + 0.83 + 6.67 = 5.00
  • After 2.4.1, Magento calculate 0 + 0.83 + 6.67 = 7.5
  • Result : bad amount for the capture

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Sep 28, 2021

Hi @MeCapron. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@MeCapron
Copy link
Contributor Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @MeCapron. Thank you for your request. I'm working on Magento instance for you.

@hostep
Copy link
Contributor

hostep commented Sep 28, 2021

This sounds similar to #32270 & #30853. Does MC-41438: 100% Discount cart rule results in Tax invoiced fix your issue? This fix is included in Magento 2.4.3 btw.

@engcom-November engcom-November self-assigned this Sep 29, 2021
@m2-assistant
Copy link

m2-assistant bot commented Sep 29, 2021

Hi @engcom-November. 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).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - 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-November
Copy link
Contributor

engcom-November commented Sep 29, 2021

Verified the issue on Magento 2.4-develop branch and the issue is not reproducible. Capture online and Capture Offline both are working fine with above Tax and discount configuration.
Steps performed:
Created Tax rate of 20%
Created Cart Price Rule of $40 - Fixed amount for whole cart
Tax calculation as per below screenshot:
image

Created Product with price including tax - $45
Front-end - Add Product to cart - Apply discount - Grand Total = 5 - No issue
Placed Order using Paypal Express Checkout
Admin - Sales - Orders - View Order - Invoice - Capture Online - No issue - Captured successfully.

image
image

@MeCapron, kindly recheck the issue on Magento 2.4-develop branch as it has the latest code base and provide missing steps if any if the issue is still reproducible:

@engcom-November engcom-November added Area: Payments Component: Payment Reported on 2.4.x Indicates original Magento version for the Issue report. Issue: needs update Additional information is require, waiting for response labels Sep 29, 2021
@MeCapron
Copy link
Contributor Author

This sounds similar to #32270 & #30853. Does MC-41438: 100% Discount cart rule results in Tax invoiced fix your issue? This fix is included in Magento 2.4.3 btw.

Thanks. I just tried this patch and it fixed my issue. No more problem here, thanks.

@MeCapron
Copy link
Contributor Author

@engcom-November Thank you for working on this issue, as @hostep said this issue is resolved in 2.4.3 through 533ec2e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Payments Component: Payment Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

3 participants