File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Model/Order/Creditmemo/Validation
Test/Unit/Model/Order/Creditmemo/Validation Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -132,16 +132,17 @@ private function validateTotalQuantityRefundable(
132132 );
133133 }
134134 $ orderItem = $ orderItemsById [$ item ->getOrderItemId ()];
135+ $ qtyRequested = (float )$ item ->getQty ();
135136
136- if (!$ this ->isValidDecimalRefundQty ($ orderItem ->getIsQtyDecimal (), $ item -> getQty () )) {
137+ if (!$ this ->isValidDecimalRefundQty ($ orderItem ->getIsQtyDecimal (), $ qtyRequested )) {
137138 return __ (
138139 'We found an invalid quantity to refund item "%1". ' ,
139140 $ orderItem ->getSku ()
140141 );
141142 }
142143
143- if (!$ this ->canRefundItem ($ orderItem , $ item -> getQty () , $ invoiceQtysRefundLimits ) ||
144- !$ this ->isQtyAvailable ($ orderItem , $ item -> getQty () )
144+ if (!$ this ->canRefundItem ($ orderItem , $ qtyRequested , $ invoiceQtysRefundLimits ) ||
145+ !$ this ->isQtyAvailable ($ orderItem , $ qtyRequested )
145146 ) {
146147 return __ (
147148 'The quantity to creditmemo must not be greater than the unrefunded quantity '
Original file line number Diff line number Diff line change @@ -284,6 +284,17 @@ public static function dataProviderForValidateQty()
284284 'isQtyDecimalAllowed ' => false ,
285285 'isAllowZeroGrandTotal ' => true
286286 ],
287+ [
288+ 'orderId ' => 1 ,
289+ 'orderItemId ' => 1 ,
290+ 'qtyToRequest ' => '1.0000 ' ,
291+ 'qtyToRefund ' => '1.0000 ' ,
292+ 'sku ' ,
293+ 'total ' => 15 ,
294+ 'expected ' => [],
295+ 'isQtyDecimalAllowed ' => false ,
296+ 'isAllowZeroGrandTotal ' => true
297+ ],
287298 [
288299 'orderId ' => 1 ,
289300 'orderItemId ' => 1 ,
You can’t perform that action at this time.
0 commit comments