Real audit of what works, what is simulated, and what is missing
Working
Auth, Orders, Pricing, Stripe, Menus, Multi-role Users, P2P Delivery, Driver Dispatch, Push Notifications, POS push (all providers), Two-leg traffic ETA, Dynamic prep time, Real-time stock depletion, Saved card (PM attach), Apple/Google Pay, Scheduled order auto-dispatch
Partial / Simulated
Code complete, not end-to-end validated: saved card reuse flow, Apple/Google Pay (device/browser), scheduled order dispatch window crossing, stock depletion → customer-side unavailability display
Not Implemented
None — code complete. Pending E2E validation: saved card reuse, Apple/Google Pay on device. Two design decisions to monitor: (1) All transfers, payouts, stock depletion, and POS push depend on payment_intent.succeeded webhook — idempotency is in place but webhook failure causes state drift; monitor + replay capability needed. (2) Alcohol compliance is operational (enforced at delivery), not pre-authorization — driver gating must be strict and refund path must be clean.
Flow: mobileAuth_v3
sendOTP → OTPCode record → verifyOTP → JWT signed with JWT_SECRET → access_token returnedmobileAuth_v3OTP auth + JWT signing
mobileAPI_v3Central mobile API (all actions)
createOrderFull pricing + Stripe PaymentIntent
calculateDeliveryFeeDistance + surge + traffic cap (Google Maps)
calculateDynamicETATwo-leg traffic ETA: driver→merchant + merchant→customer
pushOrderToPosReal POS push: Clover/Square/Toast/Olo/Deliverect/HungerRush + webhook fallback
calculateOrderMarkupMarkup policy engine
calculateCommissionPlatform commission engine
autoAssignDriverProduction-ready: weighted 6-factor scoring (proximity+rating+acceptance+completion+ETA+freshness), score persisted to DriverStatus, stale location filter, push notifications sent to candidates
merchantOrderFlowDynamic prep time: IQR-filtered historical median + complexity blend
stripeWebhookPayment → merchant/driver transfers
handleOrderCancellationRefund + goodwill credit
handleDriverIncidentIncident → reassign/refund flow
getMerchantMenuMenu via service role (web UI)
processStripeRefundAdmin-triggered Stripe refund
scrubAlcoholFlagsOne-time cleanup utility
autoDispatchScheduledScheduler live — every 5 min: inline expiry marking, immediate re-dispatch on expiry, scheduled orders, batch dissolution (Fix 4)
acceptOrderProduction-safe: atomic assignment guard (Fix 1), offer expiry enforcement (Fix 2), state machine validation (Fix 6)
syncPosMenuPOS sync — Clover/Square credentials needed