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

@@ -75,7 +75,8 @@ class StorePurchaseTest extends TestCase
$response->assertJsonPath('data.email', 'juan.perez@example.com');
$response->assertJsonPath('data.tenant_codigo', 'sonder');
$response->assertJsonPath('data.items', []);
$response->assertJsonPath('data.total', '0.00');
$response->assertJsonPath('data.subtotal', '100.00');
$response->assertJsonPath('data.total', '100.00');
$purchaseId = $response->json('data.id');
@@ -88,6 +89,7 @@ class StorePurchaseTest extends TestCase
'telefono' => '+54 9 341 555-4321',
'nombre_apellido' => 'Juan Perez',
'email' => 'juan.perez@example.com',
'total' => 100,
]);
$this->assertDatabaseMissing('compra_items', [
'compra_id' => $purchaseId,
@@ -97,10 +99,6 @@ class StorePurchaseTest extends TestCase
'status' => 'active',
'user_id' => $user->id,
]);
$this->assertDatabaseMissing('carritos', [
'id' => $cartId,
'deleted_at' => null,
]);
$this->assertDatabaseHas('carrito_items', [
'cart_id' => $cartId,
'producto_variante_id' => $variant->id,