feat: refactor purchase status handling and add finalize endpoint for purchases

This commit is contained in:
2026-07-07 15:33:29 -03:00
parent 786b4eb6a9
commit c276ccd311
11 changed files with 220 additions and 27 deletions

View File

@@ -83,16 +83,14 @@ class TelepagosWebhookTest extends TestCase
$this->assertDatabaseHas('compras', [
'id' => $matchingPurchase->id,
'status' => 'paid',
'payment_status' => 'approved',
'status' => Purchase::STATUS_PAID,
'payment_method' => 'transfer',
'total' => 50,
]);
$this->assertDatabaseHas('compras', [
'id' => $newerPurchase->id,
'status' => 'pending',
'payment_status' => 'pending',
'status' => Purchase::STATUS_PENDING_PAYMENT,
'payment_method' => 'transfer',
'total' => 100,
]);
@@ -154,6 +152,8 @@ class TelepagosWebhookTest extends TestCase
'payment_method' => 'transfer',
]);
$checkoutService->finalizePurchase($purchase);
return $purchase->fresh();
}