# TURBOLY INTEGRATION NOTES # Add these environment variables to the respective .env files. # Do NOT commit .env files; set values manually. ## sitepat-turboly/.env TURBOLY_WEBHOOK_SECRET=YOUR_SHARED_SECRET_WITH_TURBOLY SVC_CART_URL=http://YOUR_HOST/sitepat/sitepat-cart/public/ ## sitepat-api/.env (optional; code prefers this if present) SVC_TURBOLY_URL=http://YOUR_HOST/sitepat/sitepat-turboly/public/ # WEBHOOK URLs TO REGISTER ON TURBOLY # Replace {BASE} with your public URL to sitepat-turboly, e.g. http://yourhost/sitepat/sitepat-turboly/public # Header for all: X-Turboly-Webhook-Token: {TURBOLY_WEBHOOK_SECRET} POST {BASE}/api/v1/webhooks/serviceReservations POST {BASE}/api/v1/webhooks/serviceOrders POST {BASE}/api/v1/webhooks/serviceWorkOrders POST {BASE}/api/v1/webhooks/serviceInvoices # EXPECTED WEBHOOK PAYLOAD FIELDS (assumed; confirm with Turboly) # event: confirm|cancel|approve|in_progress|checking|done|complete # cart_service_id: our local ID for mapping updates # Optional: cart_service_detail_ids (array), order_status (int) # STATUS MAPPING IN WEBHOOKS # Reservation: confirm -> cart_service_status=0, cancel -> 1 # Service Order: approve -> job=2 # Work Order: in_progress -> job=2, checking -> 3, done/complete -> 4 # Invoice: complete -> job=4 # MOBILE TRX TAGGING # CartServiceController@toReservationV2() tags local cart note as: # note="channel=mobile;turboly_reservation=" # Use this to filter mobile-origin TRX in CMS. # CMS BOOKING_ENABLED # Add boolean booking_enabled to outlet in sitepat-master/. # Expose in outlet API response. # Once available, toReservationV2() will check it before creating reservation. # MOBILE API ENDPOINTS # Service lists via adapter: # GET /api/transaction/service/reservations # POST /api/transaction/service/reservations # GET /api/transaction/service/orders # GET /api/transaction/service/work-orders # GET /api/transaction/service/invoices # New reservation flow: # POST /api/cart/service/reservation-v2 (route added in code; creates Turboly reservation + local cart) # NOTES # - Webhooks forward to sitepat-cart endpoints to update our DB. # - Reservation-v2: Turboly first, then persist local with channel=mobile. # - Idempotency: Add if Turboly provides event IDs (e.g., store in Redis/DB).