Revert "feat: support product quantity and separate steps"
All checks were successful
Staging Build / build (push) Successful in 2m48s

This reverts commit 4ef21ea144.
This commit is contained in:
DanielS
2026-07-09 15:19:38 +02:00
parent 4ef21ea144
commit 915d3b1b2f
6 changed files with 259 additions and 396 deletions

View File

@@ -49,7 +49,6 @@ function hashOrderSnapshot(snapshot: object): string {
export async function submitOrder(params: {
selections: WizardSelections
moduleQuantities?: Record<string, number>
productQuantities?: Record<string, number>
products?: Product[]
categories?: Category[]
customerProfile: Partial<Profile>
@@ -58,7 +57,7 @@ export async function submitOrder(params: {
billingInterval?: 'one_time' | 'monthly'
lastLicenseDate?: string | null
}): Promise<Order> {
const { selections, moduleQuantities, productQuantities, customerProfile, endCustomerId, endCustomer, billingInterval, lastLicenseDate } = params
const { selections, moduleQuantities, customerProfile, endCustomerId, endCustomer, billingInterval, lastLicenseDate } = params
const supabase = await createClient()
const { data: { user } } = await supabase.auth.getUser()
@@ -86,7 +85,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, billingInterval, moduleQuantities, lastLicenseDate, productQuantities)
const orderSnapshot = buildOrderSnapshot(selections, dbProducts, dbCategories, billingInterval, moduleQuantities, lastLicenseDate)
// 2. Idempotenz-Guard: Prüfen ob identische Bestellung in den letzten 5 Minuten existiert
const orderHash = hashOrderSnapshot(orderSnapshot)
@@ -367,7 +366,6 @@ export async function updateOrder(
params: {
selections: WizardSelections
moduleQuantities?: Record<string, number>
productQuantities?: Record<string, number>
customerProfile: Partial<Profile>
endCustomerId?: string | null
endCustomer?: EndCustomer | null
@@ -376,7 +374,7 @@ export async function updateOrder(
companyId?: string | null
}
): Promise<Order> {
const { selections, moduleQuantities, productQuantities, customerProfile, endCustomerId, endCustomer, billingInterval, lastLicenseDate, companyId } = params
const { selections, moduleQuantities, customerProfile, endCustomerId, endCustomer, billingInterval, lastLicenseDate, companyId } = params
const supabase = await createClient()
const admin = createAdminClient()
@@ -436,7 +434,7 @@ export async function updateOrder(
// 1. Snapshots aufbauen
const customerSnapshot = buildCustomerSnapshot(customerProfile, endCustomer ?? null)
const orderSnapshot = buildOrderSnapshot(selections, dbProducts, dbCategories, billingInterval, moduleQuantities, lastLicenseDate, productQuantities)
const orderSnapshot = buildOrderSnapshot(selections, dbProducts, dbCategories, billingInterval, moduleQuantities, lastLicenseDate)
const orderHash = hashOrderSnapshot(orderSnapshot)
// 2. Bestellung in DB aktualisieren