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

@@ -84,7 +84,8 @@ export function buildCustomerSnapshot(
export function buildOrderSnapshot(
selections: WizardSelections,
products: Product[],
categories: Category[]
categories: Category[],
billingInterval?: 'one_time' | 'monthly'
): OrderSnapshot {
const items: OrderItem[] = []
let subtotal = 0
@@ -127,10 +128,10 @@ export function buildOrderSnapshot(
const taxAmount = Math.round(subtotal * (dominantTaxRate / 100) * 100) / 100
const total = Math.round((subtotal + taxAmount) * 100) / 100
// Wenn alle Items one_time sind → billing_cycle = 'one_time', sonst 'monthly'
const billingCycle = items.every((i) => i.billing_interval === 'one_time')
// Wenn billingInterval übergeben, dieses nutzen; sonst automatisch ermitteln
const billingCycle = billingInterval || (items.every((i) => i.billing_interval === 'one_time')
? 'one_time'
: 'monthly'
: 'monthly')
return {
schema_version: 1,