feat(inventory): add refunded_units to inventory model and update related services

This commit is contained in:
2026-09-16 15:00:28 -03:00
parent f8a3296821
commit 353fd34db2
7 changed files with 137 additions and 1 deletions

View File

@@ -188,6 +188,7 @@ class VariantReplacementService
$replacementInventory = Inventory::query()->create([
'sold_units' => $sourceInventory->sold_units,
'refunded_units' => $sourceInventory->refunded_units,
'reserved_stock' => $reservedStock,
'real_stock' => $sourceInventory->real_stock,
]);
@@ -235,6 +236,7 @@ class VariantReplacementService
'real_stock' => $destinationInventory->real_stock + $sourceInventory->real_stock,
'reserved_stock' => $destinationInventory->reserved_stock + $sourceInventory->reserved_stock,
'sold_units' => $destinationInventory->sold_units + $sourceInventory->sold_units,
'refunded_units' => $destinationInventory->refunded_units + $sourceInventory->refunded_units,
]);
if ($activeLines->isNotEmpty()) {
StockReservationLine::query()
@@ -245,6 +247,7 @@ class VariantReplacementService
'real_stock' => 0,
'reserved_stock' => 0,
'sold_units' => 0,
'refunded_units' => 0,
]);
}