feat: restructure checkout steps, add Kauf/Abo selection and product display flags
All checks were successful
Staging Build / build (push) Successful in 2m41s
All checks were successful
Staging Build / build (push) Successful in 2m41s
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user