-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
100% Discount cart rule results in Tax invoiced #30853 #31556
Closed
engcom-Hotel
wants to merge
4
commits into
magento:2.4-develop
from
engcom-Hotel:100%_Discount_cart_rule_results_in_Tax_invoiced_#30853
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
34ecd22
Fix and test coverage
engcom-Hotel 034a07d
Merge branch '2.4-develop' into 100%_Discount_cart_rule_results_in_Ta…
engcom-Hotel 3d100eb
Set discount as last totals collector
0afb9dd
Merge branch '2.4-develop' into 100%_Discount_cart_rule_results_in_Ta…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroGrandTotalCheckoutTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="CreateInvoiceWithZeroGrandTotalCheckoutTest"> | ||
<annotations> | ||
<stories value="Create Invoice for Offline Payment Methods"/> | ||
<title value="Create invoice with zero grandTotal checkout test"/> | ||
<description value="Create invoice with with zero grandTotal checkout"/> | ||
<severity value="CRITICAL"/> | ||
<testCaseId value="MC-*"/> | ||
<group value="sales"/> | ||
<group value="mtf_migrated"/> | ||
</annotations> | ||
<before> | ||
<createData entity="Simple_US_Customer_CA" stepKey="createCustomer"/> | ||
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"> | ||
<field key="price">10</field> | ||
</createData> | ||
<!-- Create sales rule discount 100% with coupon --> | ||
<createData entity="SalesRuleSpecificCouponWithHundredPercentDiscount" stepKey="createCartPriceRule"/> | ||
<createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule"> | ||
<requiredEntity createDataKey="createCartPriceRule"/> | ||
</createData> | ||
<createData entity="FreeShippinMethodConfig" stepKey="enableFreeShippingMethod"/> | ||
<!-- Catalog Prices and Apply Discount On Prices switched to Including Tax --> | ||
<magentoCLI command="config:set tax/calculation/price_includes_tax 1" stepKey="setCatalogPriceConfigToIncludingTax"/> | ||
<magentoCLI command="config:set tax/calculation/discount_tax 1" stepKey="setApplyDiscountOnPricesConfigToIncludingTax"/> | ||
<!--Create tax rate for US-CA-*--> | ||
<createData entity="defaultTaxRate" stepKey="taxRate"/> | ||
<!-- Login as admin --> | ||
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> | ||
<!--Create tax rule--> | ||
<actionGroup ref="AdminCreateTaxRuleActionGroup" stepKey="createTaxRule"> | ||
<argument name="taxRate" value="$$taxRate$$"/> | ||
<argument name="taxRule" value="SimpleTaxRule"/> | ||
</actionGroup> | ||
</before> | ||
<after> | ||
<actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule"> | ||
<argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" /> | ||
</actionGroup> | ||
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> | ||
<deleteData createDataKey="taxRate" stepKey="deleteTaxRate"/> | ||
<createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/> | ||
<deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> | ||
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> | ||
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> | ||
<!-- Catalog Prices and Apply Discount On Prices switched to Excluding Tax --> | ||
<magentoCLI command="config:set tax/calculation/price_includes_tax 0" stepKey="setCatalogPriceConfigToExcludingTax"/> | ||
<magentoCLI command="config:set tax/calculation/discount_tax 0" stepKey="setApplyDiscountOnPricesConfigToExcludingTax"/> | ||
</after> | ||
<!-- Create order --> | ||
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage"> | ||
<argument name="customer" value="$$createCustomer$$"/> | ||
</actionGroup> | ||
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> | ||
<argument name="product" value="$$createSimpleProduct$$"/> | ||
</actionGroup> | ||
<actionGroup ref="AdminApplyCouponToOrderActionGroup" stepKey="applyCoupon"> | ||
<argument name="couponCode" value="$$createCouponForCartPriceRule.code$$"/> | ||
</actionGroup> | ||
<actionGroup ref="OrderSelectFreeShippingActionGroup" stepKey="selectFreeShippingOption"/> | ||
<actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> | ||
<grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/> | ||
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrdersPage"/> | ||
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridById"> | ||
<argument name="orderId" value="$getOrderId"/> | ||
</actionGroup> | ||
<click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="openFilteredOrder"/> | ||
<actionGroup ref="AdminClickInvoiceButtonOrderViewActionGroup" stepKey="clickInvoiceTab"/> | ||
<!-- Check that invoice item row total and order grand total are equal zero --> | ||
<see selector="{{AdminInvoiceTotalSection.itemTotalPrice}}" userInput="$0.00" stepKey="seeCorrectItemRowTotal"/> | ||
<see selector="{{AdminInvoiceTotalSection.grandTotal}}" userInput="$0.00" stepKey="seeCorrectOrderGrandTotal"/> | ||
</test> | ||
</tests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such a solution would just work if the Tax totals is the last to run, but depending on sort order is not great, I recommend looking at
\Magento\Sales\Model\Order\Invoice\Total\Shipping
line 41 and 42, that is where the shipping cost is bein added to the grand total.