import sqlite3, sys, importlib sys.stdout.reconfigure(encoding='utf-8', errors='replace') # Check SQLite current state db = sqlite3.connect(r'C:\gomag-vending\api\data\import.db') c = db.cursor() c.execute("SELECT order_number, customer_name, shipping_name, billing_name FROM orders WHERE order_number='480102897'") r = c.fetchone() print(f"SQLite: customer={r[1]}, shipping={r[2]}, billing={r[3]}") db.close() # Check deployed code version sys.path.insert(0, r'C:\gomag-vending\api') from app.services.sync_service import _derive_customer_info from app.services.order_reader import OrderData, OrderBilling, OrderShipping # Simulate the order billing = OrderBilling(firstname='Liviu', lastname='Stoica', is_company=True, company_name='SLM COMERCE SRL') shipping = OrderShipping(firstname='Liviu', lastname='Stoica') order = OrderData(id='1', number='480102897', date='2026-03-09', billing=billing, shipping=shipping) s, b, customer, _, _ = _derive_customer_info(order) print(f"Code: _derive_customer_info returns customer={customer!r}") # Check if the sqlite_service has the fix import inspect from app.services.sqlite_service import upsert_order source = inspect.getsource(upsert_order) if 'customer_name = excluded.customer_name' in source: print("sqlite_service: upsert has customer_name update ✓") else: print("sqlite_service: upsert MISSING customer_name update ✗")