Check-In: guest self check-in on top of Oracle OPERA
The backend for a hotel guest app (first branded Hayyak, later Check-In): guests claim their OPERA reservation, add co-guests, check in, extend, and check out with in-app payment, across multiple hotels. I led the backend as its primary contributor and repository owner.
- Organisation → group → hotel
- 3 levels
- Payment gateways, one interface
- 2
- System of record (OHIP)
- OPERA Cloud
- Bilingual
- AR / EN
The problem
What needed solving
Hotels in Saudi Arabia run Oracle OPERA, and arrival still means queueing at the front desk for identity checks, room assignment and payment. The product's goal was to let guests do that from their phone.
OPERA had to remain the system of record: every action a guest takes in the app — room assignment, check-in, a folio charge, check-out — must land in OPERA exactly as a front-desk agent's would. And the platform had to serve several hotels, each with its own OPERA credentials, payment gateway and stay policies.
Constraints
What the design had to respect
- OPERA Cloud is authoritative; the app must never drift from it.
- Per-hotel configuration: OHIP credentials, payment gateway, and early check-in / late check-out windows and fees.
- Card data must never reach the backend — only gateway tokens.
- Guests must complete identity verification before they can be added to a reservation.
- Arabic and English throughout, and support for Saudi accommodation reporting (Shomoos).
Architecture
How the system fits together
A Django REST API with Daphne for WebSockets, Celery for webhooks and notifications, Redis, and PostgreSQL. OPERA is called synchronously through OHIP so the guest sees OPERA's real answer; payments run through one gateway layer with two providers.
Clients
Guest app (Flutter)
On-device passport/ID reading (MRZ and NFC chip) and face matching; gateway SDKs capture cards.
Hotel staff portal
Organisation, group and hotel configuration, rooms and options.
Django admin
Operations and support.
Backend
Django REST API
Guest identity records, hotels and staff roles, OPERA-backed reservations, payments, notifications.
Daphne + Channels
Knox-authenticated WebSockets for guest ↔ staff support chat.
Celery + beat
Webhook processing, push and email fan-out, re-checking payments stuck in progress.
PostgreSQL · Redis · Cloud Storage
Shared multi-hotel schema; broker, cache and channel layer; media and documents.
External systems
Oracle OPERA Cloud (OHIP)
Per-hotel OAuth2; reservations, front office and cashiering APIs.
Tap Payments · HyperPay
Gateway chosen per hotel; signed or encrypted webhooks.
Firebase Cloud Messaging
Push notifications to guests.
Shomoos adapter (FastAPI)
Sidecar that wraps the Saudi accommodation-reporting API.
Engineering decisions
What was chosen, and why
Multi-hotel tenancy in one schema
Organisation → Hotel Group → Hotel, with staff roles (super user, moderator, group manager, branch manager) and per-hotel rows for OHIP credentials, gateway and stay policies. Isolation is enforced in querysets and permission classes; guests and hotel staff are separate user models with separate token tables.
OPERA first: pull before every action, push every change
Before a guest checks in, extends or checks out, the backend refreshes the reservation from OHIP, then pushes the action — room assignment, check-in, folio postings, check-out — back to OPERA in the same request, so the app reflects OPERA's actual state rather than a local copy.
Check-out as an orchestrated settlement
Check-out reads the OPERA folio windows, classifies each as unpaid, overpaid or settled, charges any outstanding balance through the hotel's gateway, posts the payment to each window, closes the folios, and only then checks the guest out — mapping OPERA's unsettled-balance error to a clear domain error.
Two gateways behind one interface
Tap and HyperPay are strategies behind a common gateway layer selected per hotel. Transactions move through explicit states with an audit log. Webhooks are verified (Tap HMAC, HyperPay AES-GCM) and treated as a signal to re-fetch the transaction from the gateway under a row lock, never as the source of truth. Cards are entered in the gateway SDKs; the backend stores tokens, brand and last four digits only.
Shomoos behind its own adapter
A small FastAPI service wraps the government accommodation API for guests, visitors and lookups, normalising its fault format into one response envelope with Swagger documentation, so Django never deals with the upstream protocol directly.
Trade-offs
What those choices cost
Synchronous OHIP calls
Simple, immediate and consistent with OPERA, but a slow OPERA response slows the guest's request; there is no queued retry layer yet.
Shared schema for all hotels
One database to operate; isolation depends on every queryset and permission check being correct.
Gateway per hotel, no automatic failover
Clean reconciliation per hotel; a provider outage affects that hotel's payments until it is switched.
Re-fetch on every webhook
An extra gateway call per event in exchange for never trusting webhook bodies.
On-device identity verification
Fast for guests; the server stores the documents and results but does not re-verify them.
Outcomes
What it delivered
End-to-end guest stay
Claim a reservation, add registered or unregistered co-guests, check in, extend, take a late check-out, and check out with payment — with OPERA updated at each step.
Hotel-level configuration
Each hotel carries its own OPERA credentials, gateway, and paid early check-in / late check-out rules.
Support chat
Real-time guest ↔ staff chat over authenticated WebSockets.
Safe deployments
Containerised services (Gunicorn, Daphne, Celery, Nginx) deployed by GitHub Actions with a pre-deploy backup and automatic rollback.
My role
- Primary backend contributor and repository owner (a little over half of backend commits).
- Designed the multi-hotel data model and staff roles.
- Built the OHIP client and the check-in and check-out orchestration, including folio settlement.
- Built the support chat on Django Channels and set up containerised deployment and CI/CD.
- Co-designed the payments layer with a teammate, who wrote most of the gateway and notification code.
- Co-developed the Shomoos adapter; the Flutter guest app and the second staff portal were built by teammates.
Scope notes
- No adoption or efficiency metrics are claimed; none were instrumented.
- Automatic reporting of checked-in guests to Shomoos was built on a branch that was not merged.
- This study covers the Django/DRF backend and integrations in my repositories.
Next case study
MURI
A subscription-based student transportation platform for Saudi Arabia: student and driver apps, an admin portal, and a Django/PostGIS backend. As team lead I set up the backend and its delivery pipeline and built its geography and trip-validation pieces; teammates built most of the platform features described here.
Read it