feat: restructure checkout steps, add Kauf/Abo selection and product display flags
All checks were successful
Staging Build / build (push) Successful in 2m41s

This commit is contained in:
DanielS
2026-06-25 09:03:53 +02:00
parent eafd890297
commit f9fb90848b
6 changed files with 358 additions and 180 deletions

View File

@@ -55,8 +55,9 @@ export async function submitOrder(params: {
customerProfile: Partial<Profile>
endCustomerId?: string | null
endCustomer?: EndCustomer | null
billingInterval?: 'one_time' | 'monthly'
}): Promise<Order> {
const { selections, customerProfile, endCustomerId, endCustomer } = params
const { selections, customerProfile, endCustomerId, endCustomer, billingInterval } = params
const supabase = await createClient()
const { data: { user } } = await supabase.auth.getUser()
@@ -105,7 +106,7 @@ export async function submitOrder(params: {
// 1. Snapshots aufbauen
// Wenn Endkunde vorhanden: dessen Daten einfrieren; sonst Partner-Profil (Fallback)
const customerSnapshot = buildCustomerSnapshot(customerProfile, endCustomer ?? null)
const orderSnapshot = buildOrderSnapshot(selections, dbProducts, dbCategories)
const orderSnapshot = buildOrderSnapshot(selections, dbProducts, dbCategories, billingInterval)
// 2. Idempotenz-Guard: Prüfen ob identische Bestellung in den letzten 30s existiert
const orderHash = hashOrderSnapshot(orderSnapshot)