Skip to content

Commit 899ce67

Browse files
committed
Merge remote-tracking branch 'adobe-commerce-tier-4/ACP2E-3950' into PR_2025_06_25_muntianu
2 parents 443f282 + 1d3340d commit 899ce67

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

app/code/Magento/Sales/Model/Order/Webapi/ChangeOutputArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function execute(
7474
*/
7575
private function round(float $value): float
7676
{
77-
return (float) max($value, 0);
77+
return (float) max(round($value, 2), 0);
7878
}
7979

8080
/**

app/code/Magento/Sales/Test/Unit/Model/Order/Webapi/ChangeOutputArrayTest.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2022 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -98,6 +98,24 @@ public static function negativeTotals()
9898
OrderItemInterface::ROW_TOTAL_INCL_TAX => 0,
9999
OrderItemInterface::BASE_ROW_TOTAL_INCL_TAX => 0
100100
]
101+
],
102+
[
103+
'totals' => [
104+
'totalAmount' => -2.83,
105+
'baseTotalAmount' => -2.83,
106+
'totalAmountIncTax' => 3.5527136788005E-15,
107+
'baseRowTotal' => 0.0000,
108+
'baseTaxAmount' => 0.0000,
109+
'baseDiscountTaxCompensationAmount' => 2.83,
110+
'baseWeeeTaxAppliedAmount' => null,
111+
'baseDiscountAmount' => 16.99
112+
],
113+
'expected' => [
114+
OrderItemInterface::ROW_TOTAL => 0,
115+
OrderItemInterface::BASE_ROW_TOTAL => 0,
116+
OrderItemInterface::ROW_TOTAL_INCL_TAX => 0,
117+
OrderItemInterface::BASE_ROW_TOTAL_INCL_TAX => 0
118+
]
101119
]
102120
];
103121
}

0 commit comments

Comments
 (0)