feat(refund): add support for event date suspension in cart invalidation process

This commit is contained in:
2026-09-17 11:42:33 -03:00
parent df6892c662
commit 830f65c402
5 changed files with 50 additions and 18 deletions

View File

@@ -15,9 +15,12 @@ class InvalidateEventDateCartsService
public function __construct(private readonly StockReservationService $reservations) {}
/** @param Collection<int, int> $eventDateIds */
public function invalidate(Tenant $tenant, Collection $eventDateIds): void
{
DB::transaction(function () use ($tenant, $eventDateIds): void {
public function invalidate(
Tenant $tenant,
Collection $eventDateIds,
string $reason = StockReservationService::REASON_EVENT_DATE_RESCHEDULED,
): void {
DB::transaction(function () use ($tenant, $eventDateIds, $reason): void {
$carts = Cart::query()
->where('tenant_codigo', $tenant->codigo)
->where('status', Cart::STATUS_ACTIVE)
@@ -44,7 +47,7 @@ class InvalidateEventDateCartsService
$this->reservations->releaseCurrentCartReservation(
$cart,
StockReservationService::REASON_EVENT_DATE_RESCHEDULED,
$reason,
);
// Reuse the existing expired-cart flow: stale mutations receive the