lib/suppliers/<supplier>/. The adapter is the only code that knows the supplier’s format, its ids and its quirks. Everything above it works with our own domain types: hotels, offers, prices, guests and bookings.
The contract
The contract isSupplierAdapter in lib/suppliers/types.ts.
Every call returns its raw request and response, so the Inspector can show exactly what was sent and received.
The suppliers
Each real supplier has its own page with its rules, its flow next to ours, and how its data maps to ours:
Hotelbeds
Signature auth, rateKeys, the daily stop.
LiteAPI
Prebook before booking, pace, outdated offers.
RateHawk
Search limits, name rules, the five-step booking.
Sessions
For a supplier that needs a login, the session manager (lib/state/session-manager.ts) logs in on first use and reuses the stored session. Concurrent callers share one login, the session is renewed shortly before it expires, and when the supplier says the session expired it logs in again once and retries the call once. Sessions are stored in Postgres, so every server instance reuses the same one.
Offer references that expire
An offer keeps its supplier reference and when it expires. When the supplier doesn’t publish an expiry, Omnibeds uses its own estimate and labels it “our estimate” in the screen. An expired reference is refreshed by searching again for the same product. See Booking.Data modes
Live and record need presenter mode. Omnibeds stops Hotelbeds at 40 live calls a day, below what the test key allows, and every live call to a real supplier is counted on the API usage page.
Rules for an adapter
1
Build it from the supplier's public documentation
Keep the adapter thin: translate requests and answers, nothing more. Orchestration, mapping, pricing and logging stay in our own code.
2
Respect every documented rule before calling
Validate each field by the supplier’s documentation (for example name characters, required adults per room) and show the rule in the screen, so a request the supplier would refuse is never sent.
3
Say which errors are worth retrying
Mark 4xx and malformed answers as not retryable. The orchestrator then skips the retry, which would only spend quota.
4
Return the raw exchange
Every call returns what was sent and received, for the log.
5
Test it live, and clean up
Add a test to the live suite. Any booking it makes is cancelled at the end, even when the test fails.