How Online Booking Requests Match to Customers and Vehicles
Source: workshop-public-booking-api-gateway/lib/eventRequestUtils.js
- Vehicle plate lookup takes precedence — if plate matches, uses that vehicle's owner as the customer
- If no vehicle match, tries phone (checks mobile + phone fields), then email (case-insensitive)
- Returns most recently updated match — could match wrong customer if phone was reused
- Email uses ILIKE — "test@example.com" could match "test@example.com.au"
- Plate matching is case-insensitive but space-sensitive — "ABC123" matches "abc123" but not "ABC 123"
- Empty/whitespace fields normalize to NULL — skips that matching step entirely
Support scenarios
- "Booking went to wrong customer" → vehicle is owned by someone else, or phone number was reused
- "Vehicle didn't link" → rego entered with spaces/dashes that don't match