feat: refactor cart and purchase handling to support polymorphic buyable types and improve code readability

This commit is contained in:
2026-07-16 09:55:38 -03:00
parent c05206cc51
commit 6fc6ed1fac
14 changed files with 196 additions and 79 deletions

View File

@@ -113,7 +113,8 @@ class TelepagosWebhookTest extends TestCase
$this->assertDatabaseHas('compra_items', [
'compra_id' => $matchingPurchase->id,
'producto_variante_id' => $variant->id,
'buyable_type' => ProductVariant::class,
'buyable_id' => $variant->id,
'cantidad' => 1,
'total' => 50,
]);
@@ -201,7 +202,7 @@ class TelepagosWebhookTest extends TestCase
'status' => 'active',
]);
$cart->addItem($variantId, $quantity);
$cart->addItem(ProductVariant::class, $variantId, $quantity);
/** @var CheckoutService $checkoutService */
$checkoutService = app(CheckoutService::class);