File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
app/code/Magento/Sales/Model/Order/Webapi Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,31 @@ public function execute(
49
49
OrderItemInterface $ dataObject ,
50
50
array $ result
51
51
): array {
52
- $ result [OrderItemInterface::ROW_TOTAL ] = $ this ->priceRenderer ->getTotalAmount ($ dataObject );
53
- $ result [OrderItemInterface::BASE_ROW_TOTAL ] = $ this ->priceRenderer ->getBaseTotalAmount ($ dataObject );
54
- $ result [OrderItemInterface::ROW_TOTAL_INCL_TAX ] = $ this ->defaultRenderer ->getTotalAmount ($ dataObject );
55
- $ result [OrderItemInterface::BASE_ROW_TOTAL_INCL_TAX ] = $ dataObject ->getBaseRowTotal ()
52
+ $ result [OrderItemInterface::ROW_TOTAL ] = $ this ->round ($ this ->priceRenderer ->getTotalAmount ($ dataObject ));
53
+ $ result [OrderItemInterface::BASE_ROW_TOTAL ] = $ this ->round (
54
+ $ this ->priceRenderer ->getBaseTotalAmount ($ dataObject )
55
+ );
56
+ $ result [OrderItemInterface::ROW_TOTAL_INCL_TAX ] = $ this ->round (
57
+ $ this ->defaultRenderer ->getTotalAmount ($ dataObject )
58
+ );
59
+ $ result [OrderItemInterface::BASE_ROW_TOTAL_INCL_TAX ] = $ this ->round ($ dataObject ->getBaseRowTotal ()
56
60
+ $ dataObject ->getBaseTaxAmount ()
57
61
+ $ dataObject ->getBaseDiscountTaxCompensationAmount ()
58
62
+ $ dataObject ->getBaseWeeeTaxAppliedAmount ()
59
- - $ dataObject ->getBaseDiscountAmount ();
63
+ - $ dataObject ->getBaseDiscountAmount ()
64
+ );
60
65
61
66
return $ result ;
62
67
}
68
+
69
+ /**
70
+ * Remove negative values from row totals
71
+ *
72
+ * @param float $value
73
+ * @return mixed
74
+ */
75
+ private function round (float $ value )
76
+ {
77
+ return max ($ value , 0 );
78
+ }
63
79
}
You can’t perform that action at this time.
0 commit comments