Skip to content

Commit 467fb24

Browse files
author
Alex Paliarush
committed
MAGETWO-61120: Tax and Order total not correct when discount is applied
- Added tests for AdminPriceExcludingTax Notification
1 parent 46b3f5c commit 467fb24

File tree

3 files changed

+369
-17
lines changed

3 files changed

+369
-17
lines changed

app/code/Magento/Tax/Model/Config.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class Config
7070

7171
const XML_PATH_DISPLAY_CART_SHIPPING = 'tax/cart_display/shipping';
7272

73+
/** @deprecated */
7374
const XML_PATH_DISPLAY_CART_DISCOUNT = 'tax/cart_display/discount';
7475

7576
const XML_PATH_DISPLAY_CART_GRANDTOTAL = 'tax/cart_display/grandtotal';
@@ -87,6 +88,7 @@ class Config
8788

8889
const XML_PATH_DISPLAY_SALES_SHIPPING = 'tax/sales_display/shipping';
8990

91+
/** @deprecated */
9092
const XML_PATH_DISPLAY_SALES_DISCOUNT = 'tax/sales_display/discount';
9193

9294
const XML_PATH_DISPLAY_SALES_GRANDTOTAL = 'tax/sales_display/grandtotal';
@@ -470,6 +472,7 @@ public function displayCartShippingBoth($store = null)
470472
/**
471473
* @param null|string|bool|int|Store $store
472474
* @return bool
475+
* @deprecated
473476
*/
474477
public function displayCartDiscountInclTax($store = null)
475478
{
@@ -483,6 +486,7 @@ public function displayCartDiscountInclTax($store = null)
483486
/**
484487
* @param null|string|bool|int|Store $store
485488
* @return bool
489+
* @deprecated
486490
*/
487491
public function displayCartDiscountExclTax($store = null)
488492
{
@@ -496,6 +500,7 @@ public function displayCartDiscountExclTax($store = null)
496500
/**
497501
* @param null|string|bool|int|Store $store
498502
* @return bool
503+
* @deprecated
499504
*/
500505
public function displayCartDiscountBoth($store = null)
501506
{
@@ -665,6 +670,7 @@ public function displaySalesShippingBoth($store = null)
665670
/**
666671
* @param null|string|bool|int|Store $store
667672
* @return bool
673+
* @deprecated
668674
*/
669675
public function displaySalesDiscountInclTax($store = null)
670676
{
@@ -678,6 +684,7 @@ public function displaySalesDiscountInclTax($store = null)
678684
/**
679685
* @param null|string|bool|int|Store $store
680686
* @return bool
687+
* @deprecated
681688
*/
682689
public function displaySalesDiscountExclTax($store = null)
683690
{
@@ -691,6 +698,7 @@ public function displaySalesDiscountExclTax($store = null)
691698
/**
692699
* @param null|string|bool|int|Store $store
693700
* @return bool
701+
* @deprecated
694702
*/
695703
public function displaySalesDiscountBoth($store = null)
696704
{

app/code/Magento/Tax/Model/System/Message/Notification/AdminPriceExcludingTax.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function __construct(
5454

5555
/**
5656
* {@inheritdoc}
57+
* @codeCoverageIgnore
5758
*/
5859
public function getIdentity()
5960
{
@@ -97,6 +98,7 @@ public function getText()
9798

9899
/**
99100
* {@inheritdoc}
101+
* @codeCoverageIgnore
100102
*/
101103
public function getSeverity()
102104
{
@@ -134,49 +136,47 @@ private function checkSettings($store = null)
134136
{
135137
$adminCatalogPricesExcludeTax = !$this->taxConfig->priceIncludesTax($store)
136138
|| !$this->taxConfig->shippingPriceIncludesTax($store);
137-
$displayPricesWhichIncludeTax = $this->hasCatalogDisplaySettingsNotIncludingTax($store)
138-
|| $this->hasCartDisplaySettingsNotIncludingTax($store)
139-
|| $this->hasSalesDisplaySettingsNotIncludingTax($store);
139+
$displayPricesWhichIncludeTax = $this->hasCatalogDisplaySettingsWhichIncludeTax($store)
140+
|| $this->hasCartDisplaySettingsWhichIncludeTax($store)
141+
|| $this->hasSalesDisplaySettingsWhichIncludeTax($store);
140142
return !($adminCatalogPricesExcludeTax && $displayPricesWhichIncludeTax);
141143
}
142144

143145
/**
144-
* Check if there are any price display settings for catalog with values other than "Including tax"
146+
* Check if there are any price display settings for catalog with values other than "Excluding tax"
145147
*
146148
* @param null|int|bool|string|\Magento\Store\Model\Store $store $store
147149
* @return bool
148150
*/
149-
private function hasCatalogDisplaySettingsNotIncludingTax($store = null)
151+
private function hasCatalogDisplaySettingsWhichIncludeTax($store = null)
150152
{
151153
return $this->taxConfig->getPriceDisplayType($store) !== Config::DISPLAY_TYPE_EXCLUDING_TAX
152154
|| $this->taxConfig->getShippingPriceDisplayType($store) !== Config::DISPLAY_TYPE_EXCLUDING_TAX;
153155
}
154156

155157
/**
156-
* Check if there are any price display settings for cart with values other than "Including tax"
158+
* Check if there are any price display settings for cart with values other than "Excluding tax"
157159
*
158160
* @param null|int|bool|string|\Magento\Store\Model\Store $store $store
159161
* @return bool
160162
*/
161-
private function hasCartDisplaySettingsNotIncludingTax($store = null)
163+
private function hasCartDisplaySettingsWhichIncludeTax($store = null)
162164
{
163-
return !$this->taxConfig->displayCartPricesInclTax($store)
164-
|| !$this->taxConfig->displayCartSubtotalInclTax($store)
165-
|| !$this->taxConfig->displayCartShippingInclTax($store)
166-
|| !$this->taxConfig->displayCartDiscountInclTax($store);
165+
return !$this->taxConfig->displayCartPricesExclTax($store)
166+
|| !$this->taxConfig->displayCartSubtotalExclTax($store)
167+
|| !$this->taxConfig->displayCartShippingExclTax($store);
167168
}
168169

169170
/**
170-
* Check if there are any price display settings for orders, invoices, credit memos with values not "Including tax"
171+
* Check if there are any price display settings for orders, invoices, credit memos with values not "Excluding tax"
171172
*
172173
* @param null|int|bool|string|\Magento\Store\Model\Store $store $store
173174
* @return bool
174175
*/
175-
private function hasSalesDisplaySettingsNotIncludingTax($store = null)
176+
private function hasSalesDisplaySettingsWhichIncludeTax($store = null)
176177
{
177-
return !$this->taxConfig->displaySalesPricesInclTax($store)
178-
|| !$this->taxConfig->displaySalesSubtotalInclTax($store)
179-
|| !$this->taxConfig->displaySalesShippingInclTax($store)
180-
|| !$this->taxConfig->displaySalesDiscountInclTax($store);
178+
return !$this->taxConfig->displaySalesPricesExclTax($store)
179+
|| !$this->taxConfig->displaySalesSubtotalExclTax($store)
180+
|| !$this->taxConfig->displaySalesShippingExclTax($store);
181181
}
182182
}

0 commit comments

Comments
 (0)