From 6f700664cb439eeb64c6cbb97abf479cdb696fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Mart=C3=ADnez?= Date: Sat, 14 Oct 2017 01:41:05 +0200 Subject: [PATCH] Full tax summary display, tests adapted --- .../Tax/Api/Data/AppliedTaxRateInterface.php | 40 ++++++---- .../Tax/Api/Data/GrandTotalRatesInterface.php | 42 ++++++++-- .../AbstractAggregateCalculator.php | 4 +- .../Model/Calculation/AbstractCalculator.php | 33 ++++++++ .../Tax/Model/Calculation/GrandTotalRates.php | 51 ++++++++++-- .../Model/Calculation/UnitBaseCalculator.php | 2 + .../Model/Quote/GrandTotalDetailsPlugin.php | 6 +- .../Sales/Total/Quote/CommonTaxCollector.php | 30 ++++--- app/code/Magento/Tax/Model/TaxCalculation.php | 16 ++-- .../Tax/Model/TaxDetails/AppliedTaxRate.php | 37 +++++---- .../Quote/GrandTotalDetailsPluginTest.php | 9 ++- .../template/checkout/cart/totals/tax.html | 22 +++--- .../web/template/checkout/summary/tax.html | 22 +++--- .../Magento/Tax/Model/TaxCalculationTest.php | 79 ++++++++++++++++++- ...i_tax_rule_total_calculate_subtotal_no.php | 2 + ..._tax_rule_total_calculate_subtotal_yes.php | 2 + ...ule_two_row_calculate_subtotal_yes_row.php | 6 ++ ...e_two_row_calculate_subtotal_yes_total.php | 6 ++ ...ti_tax_rule_unit_calculate_subtotal_no.php | 2 + ...i_tax_rule_unit_calculate_subtotal_yes.php | 2 + 20 files changed, 322 insertions(+), 91 deletions(-) diff --git a/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php b/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php index 17814c2c9c6ba..be33a70f188a5 100644 --- a/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php +++ b/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php @@ -3,7 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Tax\Api\Data; /** @@ -21,34 +20,41 @@ interface AppliedTaxRateInterface extends \Magento\Framework\Api\ExtensibleDataI public function getCode(); /** - * Set code + * Get Title * - * @param string $code - * @return $this + * @return string|null */ - public function setCode($code); + public function getTitle(); /** - * Get Title + * Get Tax Percent * - * @return string|null + * @return float|null */ - public function getTitle(); + public function getPercent(); /** - * Set Title + * Get tax amount value * - * @param string $title + * @return float|string + */ + public function getAmount(); + + /** + * Set code + * + * @param string $code * @return $this */ - public function setTitle($title); + public function setCode($code); /** - * Get Tax Percent + * Set Title * - * @return float|null + * @param string $title + * @return $this */ - public function getPercent(); + public function setTitle($title); /** * Set Tax Percent @@ -58,6 +64,12 @@ public function getPercent(); */ public function setPercent($percent); + /** + * @param string|float $amount + * @return $this + */ + public function setAmount($amount); + /** * Retrieve existing extension attributes object or create a new one. * diff --git a/app/code/Magento/Tax/Api/Data/GrandTotalRatesInterface.php b/app/code/Magento/Tax/Api/Data/GrandTotalRatesInterface.php index b307126f6333e..c9900967ae760 100644 --- a/app/code/Magento/Tax/Api/Data/GrandTotalRatesInterface.php +++ b/app/code/Magento/Tax/Api/Data/GrandTotalRatesInterface.php @@ -10,8 +10,15 @@ * @api * @since 100.0.2 */ -interface GrandTotalRatesInterface +interface GrandTotalRatesInterface extends \Magento\Framework\Api\ExtensibleDataInterface { + /** + * Tax rate title + * + * @return string + */ + public function getTitle(); + /** * Get tax percentage value * @@ -19,6 +26,19 @@ interface GrandTotalRatesInterface */ public function getPercent(); + /** + * Get tax amount value + * + * @return float|string + */ + public function getAmount(); + + /** + * @param string $title + * @return $this + */ + public function setTitle($title); + /** * @param float $percent * @return $this @@ -26,15 +46,25 @@ public function getPercent(); public function setPercent($percent); /** - * Tax rate title + * @param string|float $amount + * @return $this + */ + public function setAmount($amount); + + /** + * Retrieve existing extension attributes object or create a new one. * - * @return string + * @return \Magento\Tax\Api\Data\GrandTotalRatesExtensionInterface|null */ - public function getTitle(); + public function getExtensionAttributes(); /** - * @param string $title + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\GrandTotalRatesExtensionInterface $extensionAttributes * @return $this */ - public function setTitle($title); + public function setExtensionAttributes( + \Magento\Tax\Api\Data\GrandTotalRatesExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Tax/Model/Calculation/AbstractAggregateCalculator.php b/app/code/Magento/Tax/Model/Calculation/AbstractAggregateCalculator.php index afcfa1bbebcb0..8e5b367c7cc61 100644 --- a/app/code/Magento/Tax/Model/Calculation/AbstractAggregateCalculator.php +++ b/app/code/Magento/Tax/Model/Calculation/AbstractAggregateCalculator.php @@ -18,7 +18,7 @@ protected function calculateWithTaxInPrice(QuoteDetailsItemInterface $item, $qua $this->taxClassManagement->getTaxClassId($item->getTaxClassKey()) ); $rate = $this->calculationTool->getRate($taxRateRequest); - $storeRate = $storeRate = $this->calculationTool->getStoreRate($taxRateRequest, $this->storeId); + $storeRate = $this->calculationTool->getStoreRate($taxRateRequest, $this->storeId); $discountTaxCompensationAmount = 0; $applyTaxAfterDiscount = $this->config->applyTaxAfterDiscount($this->storeId); @@ -70,6 +70,7 @@ protected function calculateWithTaxInPrice(QuoteDetailsItemInterface $item, $qua /** @var \Magento\Tax\Api\Data\AppliedTaxInterface[] $appliedTaxes */ $appliedRates = $this->calculationTool->getAppliedRates($taxRateRequest); $appliedTaxes = $this->getAppliedTaxes($rowTax, $rate, $appliedRates); + $appliedTaxes = $this->calculateAppliedTaxesRateAmounts($appliedTaxes); return $this->taxDetailsItemDataObjectFactory->create() ->setCode($item->getCode()) @@ -145,6 +146,7 @@ protected function calculateWithTaxNotInPrice(QuoteDetailsItemInterface $item, $ $rowTaxes[] = $rowTaxAfterDiscount; $rowTaxesBeforeDiscount[] = $rowTaxPerRate; } + $appliedTaxes = $this->calculateAppliedTaxesRateAmounts($appliedTaxes); $rowTax = array_sum($rowTaxes); $rowTaxBeforeDiscount = array_sum($rowTaxesBeforeDiscount); $rowTotalInclTax = $rowTotal + $rowTaxBeforeDiscount; diff --git a/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php b/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php index 8cfe3079424d4..488f9aed14e50 100644 --- a/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php +++ b/app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php @@ -6,7 +6,9 @@ namespace Magento\Tax\Model\Calculation; use Magento\Customer\Api\Data\AddressInterface as CustomerAddress; +use Magento\Tax\Api\Data\AppliedTaxInterface; use Magento\Tax\Api\Data\AppliedTaxInterfaceFactory; +use Magento\Tax\Api\Data\AppliedTaxRateInterface; use Magento\Tax\Api\Data\AppliedTaxRateInterfaceFactory; use Magento\Tax\Api\Data\QuoteDetailsItemInterface; use Magento\Tax\Api\Data\TaxDetailsItemInterface; @@ -444,4 +446,35 @@ protected function calculatePriceInclTax($storePriceInclTax, $storeRate, $custom } return $customerPriceInclTax; } + + /** + * Calculate applied taxes rates amounts + * + * @param array $appliedTaxes + * @return array + */ + protected function calculateAppliedTaxesRateAmounts($appliedTaxes) + { + /** @var AppliedTaxInterface $appliedTax */ + foreach ($appliedTaxes as $appliedTax) { + if ($appliedTax->getRates()) { + $totalNominalPercent = 0; + /** @var AppliedTaxRateInterface $rateObject */ + foreach ($appliedTax->getRates() as $rateObject) { + $totalNominalPercent += $rateObject->getPercent(); + } + + foreach ($appliedTax->getRates() as $rateObject) { + $amount = $this->calculationTool->round( + $appliedTax->getAmount() * ( + $rateObject->getPercent() / $totalNominalPercent + ) + ); + $rateObject->setAmount($amount); + } + } + } + + return $appliedTaxes; + } } diff --git a/app/code/Magento/Tax/Model/Calculation/GrandTotalRates.php b/app/code/Magento/Tax/Model/Calculation/GrandTotalRates.php index be7fe9c5473be..38729e2cc09ae 100644 --- a/app/code/Magento/Tax/Model/Calculation/GrandTotalRates.php +++ b/app/code/Magento/Tax/Model/Calculation/GrandTotalRates.php @@ -6,19 +6,21 @@ namespace Magento\Tax\Model\Calculation; +use Magento\Framework\Model\AbstractExtensibleModel; use Magento\Tax\Api\Data\GrandTotalRatesInterface; -use Magento\Framework\Api\AbstractSimpleObject; /** * Grand Total Tax Details Model */ -class GrandTotalRates extends AbstractSimpleObject implements GrandTotalRatesInterface +class GrandTotalRates extends AbstractExtensibleModel implements GrandTotalRatesInterface { + /**#@+ * Constants defined for keys of array, makes typos less likely */ + const TITLE = 'title'; const PERCENT = 'percent'; - const TITLE = 'title'; + const AMOUNT = 'amount'; /**#@-*/ /** @@ -26,23 +28,31 @@ class GrandTotalRates extends AbstractSimpleObject implements GrandTotalRatesInt */ public function getTitle() { - return $this->_get(self::TITLE); + return $this->getData(self::TITLE); } /** * {@inheritdoc} */ - public function setTitle($title) + public function getPercent() { - return $this->setData(self::TITLE, $title); + return $this->getData(self::PERCENT); } /** * {@inheritdoc} */ - public function getPercent() + public function getAmount() { - return $this->_get(self::PERCENT); + return $this->getData(self::AMOUNT); + } + + /** + * {@inheritdoc} + */ + public function setTitle($title) + { + return $this->setData(self::TITLE, $title); } /** @@ -52,4 +62,29 @@ public function setPercent($percent) { return $this->setData(self::PERCENT, $percent); } + + /** + * {@inheritdoc} + */ + public function setAmount($amount) + { + return $this->setData(self::AMOUNT, $amount); + } + + /** + * {@inheritdoc} + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\GrandTotalRatesExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Calculation/UnitBaseCalculator.php b/app/code/Magento/Tax/Model/Calculation/UnitBaseCalculator.php index ed469e822d937..b174d612a834c 100644 --- a/app/code/Magento/Tax/Model/Calculation/UnitBaseCalculator.php +++ b/app/code/Magento/Tax/Model/Calculation/UnitBaseCalculator.php @@ -88,6 +88,7 @@ protected function calculateWithTaxInPrice(QuoteDetailsItemInterface $item, $qua /** @var \Magento\Tax\Api\Data\AppliedTaxInterface[] $appliedTaxes */ $appliedRates = $this->calculationTool->getAppliedRates($taxRateRequest); $appliedTaxes = $this->getAppliedTaxes($rowTax, $rate, $appliedRates); + $appliedTaxes = $this->calculateAppliedTaxesRateAmounts($appliedTaxes); return $this->taxDetailsItemDataObjectFactory->create() ->setCode($item->getCode()) @@ -163,6 +164,7 @@ protected function calculateWithTaxNotInPrice(QuoteDetailsItemInterface $item, $ $unitTaxes[] = $unitTaxAfterDiscount; $unitTaxesBeforeDiscount[] = $unitTaxPerRate; } + $appliedTaxes = $this->calculateAppliedTaxesRateAmounts($appliedTaxes); $unitTax = array_sum($unitTaxes); $unitTaxBeforeDiscount = array_sum($unitTaxesBeforeDiscount); diff --git a/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php b/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php index 0ba5e8822ed67..187d3ae158efd 100644 --- a/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php +++ b/app/code/Magento/Tax/Model/Quote/GrandTotalDetailsPlugin.php @@ -5,9 +5,8 @@ */ namespace Magento\Tax\Model\Quote; -use Magento\Quote\Api\Data\TotalSegmentExtensionFactory; use Magento\Framework\Serialize\Serializer\Json; -use Magento\Framework\App\ObjectManager; +use Magento\Quote\Api\Data\TotalSegmentExtensionFactory; class GrandTotalDetailsPlugin { @@ -73,9 +72,11 @@ protected function getRatesData($rates) { $taxRates = []; foreach ($rates as $rate) { + /** @var \Magento\Tax\Api\Data\GrandTotalRatesInterface $taxRate */ $taxRate = $this->ratesFactory->create([]); $taxRate->setPercent($rate['percent']); $taxRate->setTitle($rate['title']); + $taxRate->setAmount($rate['amount']); $taxRates[] = $taxRate; } return $taxRates; @@ -94,7 +95,6 @@ public function afterProcess( array $totalSegments, array $addressTotals = [] ) { - if (!array_key_exists($this->code, $addressTotals)) { return $totalSegments; } diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php index 1fcaf0e413cd5..6f522a3323b69 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php @@ -8,21 +8,19 @@ namespace Magento\Tax\Model\Sales\Total\Quote; -use Magento\Customer\Api\Data\AddressInterfaceFactory as CustomerAddressFactory; use Magento\Customer\Api\Data\AddressInterface as CustomerAddress; +use Magento\Customer\Api\Data\AddressInterfaceFactory as CustomerAddressFactory; use Magento\Customer\Api\Data\RegionInterfaceFactory as CustomerAddressRegionFactory; -use Magento\Framework\DataObject; +use Magento\Quote\Api\Data\ShippingAssignmentInterface; use Magento\Quote\Model\Quote\Address as QuoteAddress; use Magento\Quote\Model\Quote\Address\Total\AbstractTotal; use Magento\Quote\Model\Quote\Item\AbstractItem; use Magento\Store\Model\Store; +use Magento\Tax\Api\Data\QuoteDetailsInterface; use Magento\Tax\Api\Data\QuoteDetailsInterfaceFactory; -use Magento\Tax\Api\Data\TaxClassKeyInterfaceFactory; use Magento\Tax\Api\Data\TaxClassKeyInterface; use Magento\Tax\Api\Data\TaxDetailsInterface; use Magento\Tax\Api\Data\TaxDetailsItemInterface; -use Magento\Tax\Api\Data\QuoteDetailsInterface; -use Magento\Quote\Api\Data\ShippingAssignmentInterface; /** * Tax totals calculation model @@ -531,7 +529,7 @@ protected function processProductItems( $total->setSubtotalInclTax($subtotalInclTax); $total->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); $total->setBaseSubtotalInclTax($baseSubtotalInclTax); - $shippingAssignment->getShipping()->getAddress()->setBaseSubtotalTotalInclTax($baseSubtotalInclTax);; + $shippingAssignment->getShipping()->getAddress()->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); return $this; } @@ -546,7 +544,7 @@ protected function processProductItems( protected function processAppliedTaxes( QuoteAddress\Total $total, ShippingAssignmentInterface $shippingAssignment, - Array $itemsByType + array $itemsByType ) { $total->setAppliedTaxes([]); $allAppliedTaxesArray = []; @@ -717,6 +715,7 @@ public function convertAppliedTaxes($appliedTaxes, $baseAppliedTaxes, $extraInfo $rates[] = [ 'percent' => $rateDataObject->getPercent(), 'code' => $rateDataObject->getCode(), + 'amount' => $rateDataObject->getAmount(), 'title' => $rateDataObject->getTitle(), ]; } @@ -769,11 +768,15 @@ protected function _saveAppliedTaxes( $row['amount'] = 0; $row['base_amount'] = 0; $previouslyAppliedTaxes[$row['id']] = $row; + + foreach ($previouslyAppliedTaxes[$row['id']]['rates'] as $previousRateKey => $previousRate) { + $previouslyAppliedTaxes[$row['id']]['rates'][$previousRateKey]['amount'] = 0; + } } if (!is_null($row['percent'])) { - $row['percent'] = $row['percent'] ? $row['percent'] : 1; - $rate = $rate ? $rate : 1; + $row['percent'] = $row['percent'] ?: 1; + $rate = $rate ?: 1; $appliedAmount = $amount / $rate * $row['percent']; $baseAppliedAmount = $baseAmount / $rate * $row['percent']; @@ -786,6 +789,15 @@ protected function _saveAppliedTaxes( } } + foreach ($row['rates'] as $appliedRate) { + foreach ($previouslyAppliedTaxes[$row['id']]['rates'] as $previousRateKey => $previousRate) { + if ($previousRate['code'] == $appliedRate['code']) { + $previouslyAppliedTaxes[$row['id']]['rates'][$previousRateKey]['amount'] += + $appliedRate['amount']; + } + } + } + if ($appliedAmount || $previouslyAppliedTaxes[$row['id']]['amount']) { $previouslyAppliedTaxes[$row['id']]['amount'] += $appliedAmount; $previouslyAppliedTaxes[$row['id']]['base_amount'] += $baseAppliedAmount; diff --git a/app/code/Magento/Tax/Model/TaxCalculation.php b/app/code/Magento/Tax/Model/TaxCalculation.php index ac18dfec6c7ed..9d0e612256df4 100644 --- a/app/code/Magento/Tax/Model/TaxCalculation.php +++ b/app/code/Magento/Tax/Model/TaxCalculation.php @@ -6,19 +6,18 @@ namespace Magento\Tax\Model; -use Magento\Tax\Api\TaxCalculationInterface; -use Magento\Tax\Api\TaxClassManagementInterface; -use Magento\Tax\Api\Data\TaxDetailsItemInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Tax\Api\Data\QuoteDetailsItemInterface; use Magento\Tax\Api\Data\TaxDetailsInterfaceFactory; +use Magento\Tax\Api\Data\TaxDetailsItemInterface; use Magento\Tax\Api\Data\TaxDetailsItemInterfaceFactory; +use Magento\Tax\Api\TaxCalculationInterface; +use Magento\Tax\Api\TaxClassManagementInterface; use Magento\Tax\Model\Calculation\AbstractCalculator; use Magento\Tax\Model\Calculation\CalculatorFactory; -use Magento\Tax\Model\Config; use Magento\Tax\Model\TaxDetails\AppliedTax; use Magento\Tax\Model\TaxDetails\AppliedTaxRate; use Magento\Tax\Model\TaxDetails\TaxDetails; -use Magento\Store\Model\StoreManagerInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -352,6 +351,7 @@ protected function aggregateItemData($taxDetailsData, TaxDetailsItemInterface $i AppliedTaxRate::KEY_CODE => $rateDataObject->getCode(), AppliedTaxRate::KEY_TITLE => $rateDataObject->getTitle(), AppliedTaxRate::KEY_PERCENT => $rateDataObject->getPercent(), + AppliedTaxRate::KEY_AMOUNT => $rateDataObject->getAmount(), ]; } $appliedTaxes[$taxId] = [ @@ -362,6 +362,12 @@ protected function aggregateItemData($taxDetailsData, TaxDetailsItemInterface $i ]; } else { $appliedTaxes[$taxId][AppliedTax::KEY_AMOUNT] += $itemAppliedTax->getAmount(); + + $rateDataObjects = $itemAppliedTax->getRates(); + foreach ($rateDataObjects as $rateDataObject) { + $appliedTaxes[$taxId][AppliedTax::KEY_RATES][$rateDataObject->getCode()][AppliedTax::KEY_AMOUNT] += + $rateDataObject->getAmount(); + } } } diff --git a/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php b/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php index 0e0ec13f13497..cfe8fb69b6fcf 100644 --- a/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php +++ b/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php @@ -19,6 +19,7 @@ class AppliedTaxRate extends AbstractExtensibleModel implements AppliedTaxRateIn const KEY_CODE = 'code'; const KEY_TITLE = 'title'; const KEY_PERCENT = 'percent'; + const KEY_AMOUNT = 'amount'; /**#@-*/ /** @@ -46,10 +47,15 @@ public function getPercent() } /** - * Set code - * - * @param string $code - * @return $this + * {@inheritdoc} + */ + public function getAmount() + { + return $this->getData(self::KEY_AMOUNT); + } + + /** + * {@inheritdoc} */ public function setCode($code) { @@ -57,10 +63,7 @@ public function setCode($code) } /** - * Set Title - * - * @param string $title - * @return $this + * {@inheritdoc} */ public function setTitle($title) { @@ -68,10 +71,7 @@ public function setTitle($title) } /** - * Set Tax Percent - * - * @param float $percent - * @return $this + * {@inheritdoc} */ public function setPercent($percent) { @@ -80,8 +80,14 @@ public function setPercent($percent) /** * {@inheritdoc} - * - * @return \Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface|null + */ + public function setAmount($amount) + { + return $this->setData(self::KEY_AMOUNT, $amount); + } + + /** + * {@inheritdoc} */ public function getExtensionAttributes() { @@ -90,9 +96,6 @@ public function getExtensionAttributes() /** * {@inheritdoc} - * - * @param \Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface $extensionAttributes - * @return $this */ public function setExtensionAttributes(\Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface $extensionAttributes) { diff --git a/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php b/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php index e5bd728e180f6..8332021a589d2 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Quote/GrandTotalDetailsPluginTest.php @@ -6,7 +6,7 @@ namespace Magento\Tax\Test\Unit\Model\Quote; -use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -131,6 +131,10 @@ protected function setupTaxRateFactoryMock(array $taxRate) ->with([]) ->willReturn($taxRateMock); + $taxRateMock->expects($this->once()) + ->method('setAmount') + ->with($taxRate['amount']) + ->willReturnSelf(); $taxRateMock->expects($this->once()) ->method('setPercent') ->with($taxRate['percent']) @@ -172,8 +176,9 @@ protected function setupTaxDetails(array $taxDetails) public function testAfterProcess() { $taxRate = [ - 'percent' => 8.25, 'title' => 'TX', + 'percent' => 8.25, + 'amount' => 1.06, ]; $taxAmount = 10; diff --git a/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html b/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html index 9c45e73db6fa4..670101cf567ea 100644 --- a/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html +++ b/app/code/Magento/Tax/view/frontend/web/template/checkout/cart/totals/tax.html @@ -32,18 +32,16 @@ - - - - - - - - - - + + + + + + + + diff --git a/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html b/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html index 0f2e3251bcfdb..335107d912e7e 100644 --- a/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html +++ b/app/code/Magento/Tax/view/frontend/web/template/checkout/summary/tax.html @@ -43,18 +43,16 @@ - - - - - - - - - - + + + + + + + + diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php index e0bd6f3523612..06243c0f5589a 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php @@ -141,6 +141,7 @@ public function calculateUnitBasedDataProvider() 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 1.5, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -168,6 +169,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 1.5, ], ], ], @@ -205,6 +207,7 @@ public function calculateUnitBasedDataProvider() 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', 'percent' => 8.25, + 'amount' => 1.4, ], ], 'tax_rate_key' => 'US - 42 - 8.25', @@ -232,6 +235,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 0.83, ], ], ], @@ -258,6 +262,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 0.57, ], ], ], @@ -295,6 +300,7 @@ public function calculateUnitBasedDataProvider() 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', 'percent' => 8.25, + 'amount' => 2.80, ], ], 'tax_rate_key' => 'US - 42 - 8.25', @@ -322,6 +328,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.66, ], ], ], @@ -348,6 +355,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.14, ], ], ], @@ -400,6 +408,7 @@ public function calculateUnitBasedDataProvider() 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', 'percent' => 8.25, + 'amount' => 5.60, ], ], 'tax_rate_key' => 'US - 42 - 8.25', @@ -427,6 +436,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.66, ], ], ], @@ -453,6 +463,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.14, ], ], ], @@ -479,6 +490,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.66, ], ], ], @@ -505,6 +517,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.14, ], ], ], @@ -546,6 +559,7 @@ public function calculateUnitBasedDataProvider() 'code' => 'US - 42 - 22', 'title' => 'US - 42 - 22', 'percent' => 22, + 'amount' => 4.4, ], ], 'tax_rate_key' => 'US - 42 - 22', @@ -573,6 +587,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 22, 'code' => 'US - 42 - 22', 'title' => 'US - 42 - 22', + 'amount' => 4.4, ], ], ], @@ -611,6 +626,7 @@ public function calculateUnitBasedDataProvider() 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 18.1, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -638,12 +654,13 @@ public function calculateUnitBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 1.5, ], ], ], ], ], - 'sku_2' => [ + 'sku_2' => [ 'code' => 'sku_2', 'row_tax' => 16.6, 'price' => 11, @@ -664,6 +681,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 16.6, ], ], ], @@ -724,6 +742,7 @@ public function calculateUnitBasedDataProvider() 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 1.5, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -751,6 +770,7 @@ public function calculateUnitBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 1.5, ], ], ], @@ -886,6 +906,7 @@ public function calculateTaxNoTaxInclDataProvider() 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 0.75, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -902,6 +923,7 @@ public function calculateTaxNoTaxInclDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 0.75, ], ], ], @@ -1051,6 +1073,7 @@ public function calculateTaxTaxInclDataProvider() 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 0.70, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -1079,6 +1102,7 @@ public function calculateTaxTaxInclDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 0.7, ], ], ], @@ -1174,13 +1198,14 @@ public function calculateTaxRoundingDataProvider() $quoteDetailAppliedTaxesBase = [ [ - 'amount' => 1.20, + 'amount' => 1.2, 'percent' => 7.5, 'rates' => [ [ 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 1.2, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -1225,6 +1250,7 @@ public function calculateTaxRoundingDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 1.2, ], ], ], @@ -1317,6 +1343,7 @@ public function calculateTaxRowBasedDataProvider() 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 0.75, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -1344,6 +1371,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 0.75, ], ], ], @@ -1381,6 +1409,7 @@ public function calculateTaxRowBasedDataProvider() 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', 'percent' => 8.25, + 'amount' => 1.4, ], ], 'tax_rate_key' => 'US - 42 - 8.25', @@ -1408,6 +1437,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 0.83, ], ], ], @@ -1434,6 +1464,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 0.57, ], ], ], @@ -1471,6 +1502,7 @@ public function calculateTaxRowBasedDataProvider() 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', 'percent' => 8.25, + 'amount' => 2.81, ], ], 'tax_rate_key' => 'US - 42 - 8.25', @@ -1498,6 +1530,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.65, ], ], ], @@ -1524,6 +1557,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.16, ], ], ], @@ -1576,6 +1610,7 @@ public function calculateTaxRowBasedDataProvider() 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', 'percent' => 8.25, + 'amount' => 5.62, ], ], 'tax_rate_key' => 'US - 42 - 8.25', @@ -1603,6 +1638,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.65, ], ], ], @@ -1629,6 +1665,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.16, ], ], ], @@ -1655,6 +1692,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.65, ], ], ], @@ -1681,6 +1719,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.16, ], ], ], @@ -1712,6 +1751,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 0.7, ], ], ], @@ -1738,6 +1778,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 0.7, ], ], ], @@ -1771,6 +1812,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 22, 'code' => 'US - 42 - 22', 'title' => 'US - 42 - 22', + 'amount' => 0.6, ], ], 'tax_rate_key' => 'US - 42 - 22', @@ -1798,6 +1840,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 22, 'code' => 'US - 42 - 22', 'title' => 'US - 42 - 22', + 'amount' => 0.6, ], ], ], @@ -1837,6 +1880,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 17.25, ], ], ], @@ -1863,6 +1907,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 0.75, ], ], ], @@ -1889,6 +1934,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 16.5, ], ], ], @@ -1930,6 +1976,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 17.41, ], ], ], @@ -1956,6 +2003,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 0.68, ], ], ], @@ -1982,6 +2030,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 16.73, ], ], ], @@ -2029,6 +2078,7 @@ public function calculateTaxRowBasedDataProvider() 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', 'percent' => 7.5, + 'amount' => 18.51, ], ], 'tax_rate_key' => 'US - 42 - 7.5', @@ -2041,6 +2091,7 @@ public function calculateTaxRowBasedDataProvider() 'code' => 'US - 42 - 22', 'title' => 'US - 42 - 22', 'percent' => 22, + 'amount' => 8.76, ], ], 'tax_rate_key' => 'US - 42 - 22', @@ -2068,6 +2119,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 7.5, 'code' => 'US - 42 - 7.5', 'title' => 'US - 42 - 7.5', + 'amount' => 18.51, ], ], ], @@ -2094,6 +2146,7 @@ public function calculateTaxRowBasedDataProvider() 'percent' => 22, 'code' => 'US - 42 - 22', 'title' => 'US - 42 - 22', + 'amount' => 8.76, ], ], ], @@ -2212,11 +2265,13 @@ protected function getBaseQuoteResult() 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', 'percent' => 8.25, + 'amount' => 13.76 ], [ 'code' => 'US - 42 - 5 - 55555', 'title' => 'US - 42 - 5 - 55555', 'percent' => 5, + 'amount' => 8.34 ], ], 'tax_rate_key' => 'US - 42 - 8.25US - 42 - 5 - 55555', @@ -2229,6 +2284,7 @@ protected function getBaseQuoteResult() 'code' => 'US - 42 - 11 - 55555', 'title' => 'US - 42 - 11 - 55555', 'percent' => 11, + 'amount' => 20.78, ], ], 'tax_rate_key' => 'US - 42 - 11 - 55555', @@ -2256,11 +2312,13 @@ protected function getBaseQuoteResult() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 1.06 ], 'US - 42 - 5 - 55555' => [ 'percent' => 5, 'code' => 'US - 42 - 5 - 55555', 'title' => 'US - 42 - 5 - 55555', + 'amount' => 0.65 ], ], ], @@ -2273,6 +2331,7 @@ protected function getBaseQuoteResult() 'percent' => 11, 'code' => 'US - 42 - 11 - 55555', 'title' => 'US - 42 - 11 - 55555', + 'amount' => 1.6, ], ], ], @@ -2299,11 +2358,13 @@ protected function getBaseQuoteResult() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 4.86, ], 'US - 42 - 5 - 55555' => [ 'percent' => 5, 'code' => 'US - 42 - 5 - 55555', 'title' => 'US - 42 - 5 - 55555', + 'amount' => 2.94, ], ], ], @@ -2316,6 +2377,7 @@ protected function getBaseQuoteResult() 'percent' => 11, 'code' => 'US - 42 - 11 - 55555', 'title' => 'US - 42 - 11 - 55555', + 'amount' => 7.35, ], ], ], @@ -2342,11 +2404,13 @@ protected function getBaseQuoteResult() 'percent' => 8.25, 'code' => 'US - 42 - 8.25', 'title' => 'US - 42 - 8.25', + 'amount' => 7.84, ], 'US - 42 - 5 - 55555' => [ 'percent' => 5, 'code' => 'US - 42 - 5 - 55555', 'title' => 'US - 42 - 5 - 55555', + 'amount' => 4.75, ], ], ], @@ -2359,6 +2423,7 @@ protected function getBaseQuoteResult() 'percent' => 11, 'code' => 'US - 42 - 11 - 55555', 'title' => 'US - 42 - 11 - 55555', + 'amount' => 11.83, ], ], ], @@ -2441,10 +2506,13 @@ public function multiRulesTotalBasedDataProvider() $results['tax_amount'] = 42.89; $results['discount_tax_compensation_amount'] = 3.06; $results['applied_taxes'][0]['amount'] = 22.11; + $results['applied_taxes'][0]['rates'][1]['amount'] = 8.35; $results['items']['sku_2']['row_tax'] = 15.16; $results['items']['sku_2']['row_total'] = 66.91; $results['items']['sku_2']['discount_tax_compensation_amount'] = 2.03; $results['items']['sku_2']['applied_taxes']['US - 42 - 8.25US - 42 - 5 - 55555']['amount'] = 7.81; + $results['items']['sku_2']['applied_taxes'] + ['US - 42 - 8.25US - 42 - 5 - 55555']['rates']['US - 42 - 5 - 55555']['amount'] = 2.95; return [ 'multi rules, multi rows' => [ @@ -2488,12 +2556,19 @@ public function multiRulesUnitBasedDataProvider() $results['tax_amount'] = 42.87; $results['discount_tax_compensation_amount'] = 3.05; $results['applied_taxes'][1]['amount'] = 20.77; + $results['applied_taxes'][1]['rates'][0]['amount'] = 20.77; $results['items']['sku_1']['row_tax'] = 3.3; $results['items']['sku_1']['row_total'] = 16.9; $results['items']['sku_1']['discount_tax_compensation_amount'] = 1; $results['items']['sku_1']['applied_taxes']['US - 42 - 8.25US - 42 - 5 - 55555']['amount'] = 1.7; + $results['items']['sku_1']['applied_taxes'] + ['US - 42 - 8.25US - 42 - 5 - 55555']['rates']['US - 42 - 5 - 55555']['amount'] = 0.64; $results['items']['sku_2']['applied_taxes']['US - 42 - 8.25US - 42 - 5 - 55555']['amount'] = 7.81; $results['items']['sku_2']['applied_taxes']['US - 42 - 11 - 55555']['amount'] = 7.34; + $results['items']['sku_2']['applied_taxes'] + ['US - 42 - 8.25US - 42 - 5 - 55555']['rates']['US - 42 - 5 - 55555']['amount'] = 2.95; + $results['items']['sku_2']['applied_taxes'] + ['US - 42 - 11 - 55555']['rates']['US - 42 - 11 - 55555']['amount'] = 7.34; return [ 'multi rules, multi rows' => [ diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_no.php b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_no.php index a04ecdcb360b2..ef32e871fdf71 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_no.php +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_no.php @@ -91,6 +91,7 @@ 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, 'percent' => 7.5, + 'amount' => 0.75, ], ], ], @@ -103,6 +104,7 @@ 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, 'percent' => 5.5, + 'amount' => 0.59, ], ], ], diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_yes.php b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_yes.php index 7bed3a9e228c0..396b9cb60c879 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_yes.php +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_yes.php @@ -91,6 +91,7 @@ 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, 'percent' => 7.5, + 'amount' => 0.75, ], ], ], @@ -103,6 +104,7 @@ 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, 'percent' => 5.5, + 'amount' => 0.55, ], ], ], diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_row.php b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_row.php index c54e1146bbc0c..e17ee7be74c91 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_row.php +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_row.php @@ -96,6 +96,7 @@ 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, 'percent' => 9, + 'amount' => 1.84, ], ], ], @@ -108,6 +109,7 @@ 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, 'percent' => 5, + 'amount' => 1.02, ], ], ], @@ -142,6 +144,7 @@ 'percent' => 9, 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, + 'amount' => 0.9, ], ], 'item_id' => null, @@ -158,6 +161,7 @@ 'percent' => 5, 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, + 'amount' => 0.5, ], ], 'item_id' => null, @@ -194,6 +198,7 @@ 'percent' => 9, 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, + 'amount' => 0.94, ], ], 'item_id' => null, @@ -210,6 +215,7 @@ 'percent' => 5, 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, + 'amount' => 0.52, ], ], 'item_id' => null, diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_total.php b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_total.php index 791d55a79c3f3..0f3aa4d739f3f 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_total.php +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_two_row_calculate_subtotal_yes_total.php @@ -96,6 +96,7 @@ 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, 'percent' => 9, + 'amount' => 1.85, ], ], ], @@ -108,6 +109,7 @@ 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, 'percent' => 5, + 'amount' => 1.03, ], ], ], @@ -142,6 +144,7 @@ 'percent' => 9, 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, + 'amount' => 0.9, ], ], 'item_id' => null, @@ -158,6 +161,7 @@ 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, 'percent' => 5, + 'amount' => 0.5, ], ], 'item_id' => null, @@ -194,6 +198,7 @@ 'percent' => 9, 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, + 'amount' => 0.95, ], ], 'item_id' => null, @@ -210,6 +215,7 @@ 'percent' => 5, 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, + 'amount' => 0.53, ], ], 'item_id' => null, diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_no.php b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_no.php index 443038e7ad8ba..f87f713382b0e 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_no.php +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_no.php @@ -91,6 +91,7 @@ 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, 'percent' => 7.5, + 'amount' => 0.8, ], ], ], @@ -103,6 +104,7 @@ 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, 'percent' => 5.5, + 'amount' => 0.6, ], ], ], diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_yes.php b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_yes.php index 3d22651b4f119..54a67fc75d7c2 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_yes.php +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_yes.php @@ -91,6 +91,7 @@ 'code' => SetupUtil::TAX_RATE_TX, 'title' => SetupUtil::TAX_RATE_TX, 'percent' => 7.5, + 'amount' => 0.8, ], ], ], @@ -103,6 +104,7 @@ 'code' => SetupUtil::TAX_RATE_AUSTIN, 'title' => SetupUtil::TAX_RATE_AUSTIN, 'percent' => 5.5, + 'amount' => 0.6, ], ], ],