Skip to content

Commit faf597b

Browse files
committed
AC-7901: Can't create credit memo - free shipping related,Resolve the conflicts
2 parents 20f7224 + 820b1a3 commit faf597b

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Order/CollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public function firstPartDateRangeDataProvider(): array
466466
return [
467467
['', '', '', '0 0 0 23:59:59'],
468468
['24h', '', '', '0 0 1 0:0:0'],
469-
['7d', '', '', '0 0 6 22:59:59']
469+
['7d', '', '', '0 0 6 23:59:59']
470470
];
471471
}
472472

app/code/Magento/Sales/Model/Order/Creditmemo/Total/Tax.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,10 @@ public function collect(Creditmemo $creditmemo)
134134
$baseShippingDiscountTaxCompensationAmount = 0;
135135
$shippingDelta = $baseOrderShippingAmount - $baseOrderShippingRefundedAmount;
136136

137-
if ($shippingDelta > $creditmemo->getBaseShippingAmount() ||
138-
$this->isShippingIncludeTaxWithTaxAfterDiscount($order->getStoreId())) {
139-
$part = $creditmemo->getShippingAmount();
140-
if ($orderShippingAmount > 0) {
141-
$part = $creditmemo->getShippingAmount() / $orderShippingAmount;
142-
}
143-
$basePart = $creditmemo->getBaseShippingAmount();
144-
if ($baseOrderShippingAmount > 0) {
145-
$basePart = $creditmemo->getBaseShippingAmount() / $baseOrderShippingAmount;
146-
}
137+
if ($orderShippingAmount > 0 && ($shippingDelta > $creditmemo->getBaseShippingAmount() ||
138+
$this->isShippingIncludeTaxWithTaxAfterDiscount($order->getStoreId()))) {
139+
$part = $creditmemo->getShippingAmount() / $orderShippingAmount;
140+
$basePart = $creditmemo->getBaseShippingAmount() / $baseOrderShippingAmount;
147141
$shippingTaxAmount = $order->getShippingTaxAmount() * $part;
148142
$baseShippingTaxAmount = $order->getBaseShippingTaxAmount() * $basePart;
149143
$shippingDiscountTaxCompensationAmount = $order->getShippingDiscountTaxCompensationAmount() * $part;

app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/TaxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ public function collectDataProvider()
860860
],
861861
],
862862
'creditmemo_data' => [
863-
'grand_total' => 13.4,
863+
'grand_total' => 14.76,
864864
'base_grand_total' => 13.4,
865865
'tax_amount' => 1.22,
866866
'base_tax_amount' => 1.22,

0 commit comments

Comments
 (0)