<?php require_once __DIR__ . '/../app/bootstrap.php'; if($_SERVER['REQUEST_METHOD']!=='POST' || !verify_csrf()) App\Core\Response::json(['ok'=>false,'message'=>'Invalid CSRF'],419); $cart=App\Core\Cart::summary(); $customer=current_user() ?: ['id'=>null,'name'=>$_POST['customer_name']??'Guest','email'=>$_POST['customer_email']??'','phone'=>$_POST['customer_phone']??'']; $id=App\Core\OrderService::create($customer,$cart,$_POST); App\Core\Cart::clear(); App\Core\Response::json(['ok'=>true,'order_id'=>$id]);
