refactor(checkout): materialize purchase item snapshots at start

This commit is contained in:
2026-08-21 11:03:39 -03:00
parent 3a2dc8b7e0
commit 4e7e42d16e
9 changed files with 74 additions and 325 deletions

View File

@@ -96,12 +96,6 @@ class ReleaseCheckoutService
return $this->loadPurchase($purchase);
}
if ($purchase->items()->exists()) {
throw ValidationException::withMessages([
'items' => __('api.purchase.inconsistent_reservation'),
]);
}
$reservationReturnedToCart = $restoreCart && $this->sourceCart->restore($purchase);
$this->releaseCartReservations($purchase, $reservationReturnedToCart, $targetStatus);
@@ -181,15 +175,6 @@ class ReleaseCheckoutService
private function loadPurchase(Purchase $purchase): Purchase
{
return $purchase->load([
'items.imageAttachment',
'cart.items.catalogItem.inventory',
'cart.items.catalogItem.attachments',
'cart.items.variant.inventory',
'cart.items.variant.attachments',
'cart.items.variant.definitions.itemAttribute.attribute',
'cart.items.variant.eventDates',
'cart.items.variant.eventDate',
]);
return $purchase->load(['items.imageAttachment']);
}
}