feat: Complete checkout overhaul with Stripe PaymentIntent integration and abandoned cart recovery

This commit is contained in:
Codex Agent
2025-10-07 22:25:03 +02:00
parent dd5545605c
commit aa8c6c67c5
38 changed files with 1848 additions and 878 deletions

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('abandoned_checkouts', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('package_id')->constrained()->onDelete('cascade');
$table->string('email'); // Denormalisiert für Performance
$table->json('checkout_state')->nullable(); // Gespeicherter Checkout-Zustand
$table->integer('last_step')->default(1); // Letzter erreichter Schritt
$table->timestamp('abandoned_at');
$table->timestamp('reminded_at')->nullable(); // Wann zuletzt erinnert
$table->string('reminder_stage')->default('none'); // none, 1h, 24h, 1w
$table->timestamp('expires_at')->nullable(); // Wann der Checkout verfällt
$table->boolean('converted')->default(false); // Ob erfolgreich abgeschlossen
$table->timestamps();
$table->index(['email', 'reminder_stage']);
$table->index(['abandoned_at']);
$table->index(['reminded_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('abandoned_checkouts');
}
};