feat(purchase): refactor stock reservation expiration handling and update related tests

This commit is contained in:
2026-08-26 16:36:26 -03:00
parent adc4cc9595
commit c820741e5f
7 changed files with 19 additions and 29 deletions

View File

@@ -343,9 +343,9 @@ class StockReservationService
});
}
public function refreshForPurchase(Purchase $purchase, ?Carbon $expiresAt): void
public function clearExpirationForReview(Purchase $purchase): void
{
DB::transaction(function () use ($purchase, $expiresAt): void {
DB::transaction(function () use ($purchase): void {
/** @var Purchase $purchase */
$purchase = Purchase::query()->lockForUpdate()->findOrFail($purchase->getKey());
if ($purchase->stock_reservation_id === null) {
@@ -363,7 +363,7 @@ class StockReservationService
throw new StockReservationExpiredException;
}
$reservation->update(['expires_at' => $expiresAt]);
$reservation->update(['expires_at' => null]);
});
}