Booking ID format (draft)
Job: one lodging reference issuer in Middleware. Display = storage.
| Field | Rule |
|---|---|
| Format | Exactly 6 digits, zero-padded string |
| Live start | 010000 only if current live max numeric ref < 10000 |
| Storage | "010000" — not integer 10000 |
| Scope | Global lodging counter, not per-hotel |
| Issuer | Middleware create-booking only |
Examples: 010000, 010001, … 099999, 100000.
Listing-booking counters (100000SL) stay a different product line.
Seed
Preferred: counter value 9999 so the next issue is 10000 → "010000".
If production already issued ≥ 010000, do not rewind. Next ref = max(legacyNumeric, 9999) + 1. Staging may use 900000+.
Imports keep original refs (including alphanumeric).
How to build
On POST https://middleware-dev.bookdirect.live/api/v1/bookdirect/bookings (proposed remount; v1 still documents /nellalink/bookings):
- Allocate next counter atomically
- Store on Core booking as
meta_key/referencestring (live emails already readbooking.meta_key) - Return the same string to FE, emails, manage
?ref=
Do not confuse with payment reference (PSP id).
IDOR
Counter service is Middleware + server Core key. Public browse key must not increment.
Acceptance
- First live booking after a clean cutover is
010000(or documented continuation) - Emails, invoices, reservation cards show the 6-digit form
- Concurrent creates cannot duplicate
- Support search works for legacy + new refs