/** Shared commerce numbers so cart, checkout and orders stay consistent. */ export const DELIVERY_FEE = 80; export const DEMO_VOUCHER = "GISHEN10"; export const DEMO_VOUCHER_PCT = 0.1; export const DEMO_OTP = "1234"; export function voucherDiscount(subtotal: number, code: string | null | undefined) { if (!code) return 0; if (code.trim().toUpperCase() === DEMO_VOUCHER) { return Math.round(subtotal * DEMO_VOUCHER_PCT); } return 0; } export function orderSubtotalTotal(input: { subtotal: number; deliveryFee: number; discount?: number; }) { return Math.max(0, input.subtotal + input.deliveryFee - (input.discount ?? 0)); }