feat: add total field to purchases and update related logic for payment processing

This commit is contained in:
2026-07-07 10:16:28 -03:00
parent 362e888e46
commit 7b2a741884
9 changed files with 377 additions and 56 deletions

View File

@@ -29,6 +29,10 @@ class CheckoutService
]);
}
$cartItems->load('variant.product');
$cart->setRelation('items', $cartItems);
$totalAmount = $cart->getTotalAmount();
/** @var Purchase $purchase */
$purchase = Purchase::query()->updateOrCreate(
[
@@ -41,6 +45,7 @@ class CheckoutService
...$purchaseData,
'payment_status' => 'pending',
'payment_method' => null,
'total' => $totalAmount,
]
);