feat(events): associate purchases and integrations with events

This commit is contained in:
2026-09-28 19:13:36 +00:00
parent 7f754037bb
commit 7996d53e12
13 changed files with 312 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ class PurchaseResponseLoader
=== StorefrontWebsiteType::CHECKOUT_SUMMARY_EVENT;
$relations = [
'tenant',
'event.attachment',
'items.sourceCatalogItem.event.attachment',
'stockReservation',
];

View File

@@ -206,6 +206,7 @@ class StartCheckoutService
fn (array $line): float => $line['selection']->getPrice() * $line['quantity'],
),
$cart->getKey(),
$cartItems->first()?->catalogItem?->event_id,
);
$cart->update(['current_purchase_id' => $purchase->getKey()]);
$this->reservations->attachToPurchase($cart, $purchase, $this->checkoutExpiration());
@@ -273,6 +274,7 @@ class StartCheckoutService
$purchaseData,
$cart->getTotalAmount(),
$cart->getKey(),
$cartItems->first()?->catalogItem?->event_id,
);
$cart->update(['current_purchase_id' => $purchase->getKey()]);
$this->reservations->attachToPurchase($cart, $purchase, $this->checkoutExpiration());
@@ -410,10 +412,12 @@ class StartCheckoutService
array $purchaseData,
float $total,
?int $cartId,
?int $eventId,
): Purchase {
return Purchase::query()->create([
...$purchaseData,
'cart_id' => $cartId,
'event_id' => $eventId,
'tenant_codigo' => $tenant->codigo,
'user_id' => $userId,
'status' => Purchase::STATUS_CREATED,