Skip to content

Commit b952d5f

Browse files
committed
MC-23904: Can't Refund Invoice Without 0 Quantities Through REST API
1 parent 226b08d commit b952d5f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/code/Magento/Sales/Model/Order/Creditmemo/Validation/QuantityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function validate($entity)
9696

9797
if ($entity->getGrandTotal() <= 0) {
9898
$messages[] = __('The credit memo\'s total must be positive.');
99-
} elseif ($totalQuantity <= 0 && !$this->canRefundShipping($order)) {
99+
} elseif ($totalQuantity < 0 && !$this->canRefundShipping($order)) {
100100
$messages[] = __('You can\'t create a creditmemo without products.');
101101
}
102102

app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Validation/QuantityValidatorTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,15 @@ public function dataProviderForValidateQty()
229229
'total' => 15,
230230
'expected' => []
231231
],
232+
[
233+
'orderId' => 1,
234+
'orderItemId' => 1,
235+
'qtyToRequest' => 0,
236+
'qtyToRefund' => 0,
237+
'sku',
238+
'total' => 15,
239+
'expected' => []
240+
],
232241
[
233242
'orderId' => 1,
234243
'orderItemId' => 1,

0 commit comments

Comments
 (0)