Events (Audit Trail)
Understanding the event sourcing system for order tracking and auditing
Events (Audit Trail)
Rahal uses an event sourcing pattern to maintain a complete, immutable audit trail of everything that happens to an order. This provides transparency, debugging capabilities, and compliance support.
What Are Events?
Events are immutable records that capture significant actions or state changes in an order's lifecycle. Each event contains:
| Field | Description |
|---|---|
id | Unique event identifier |
entityId | The order ID this event belongs to |
entityType | Always ORDER for booking events |
version | Event version (for schema evolution) |
eventType | Type of event (see catalog below) |
eventData | JSON payload with event-specific details |
createdAt | Timestamp when event occurred |
Why Event Sourcing?
Event sourcing provides several benefits:
1. Complete Audit Trail
Every action is recorded. You can trace exactly what happened and when.
2. Debugging
When something goes wrong, the event log shows the exact sequence of operations.
3. Compliance
For corporate travel, auditors can verify the complete booking history.
4. Reconciliation
Events help reconcile internal records with external systems (payment providers, travel suppliers).
Event Catalog
Order Creation Events
| Event Type | Description | Event Data |
|---|---|---|
ORDER_CREATED | Order was created | Flight reservation information |
Example Event Data:
{
"flightReservationInformation": {
"origin": "BGW",
"destination": "DXB",
"departureDate": "2024-06-15",
"returnDate": "2024-06-20"
}
}Payment Events
| Event Type | Description | Event Data |
|---|---|---|
ORDER_PAYMENT_VERIFIED_TO_BE_PAID | Payment confirmed | - |
ORDER_FINALIZED_BY_CONFIRMING_BNPL_TRANSACTION | BNPL payment confirmed | BNPL details |
Reservation Events
| Event Type | Description | Event Data |
|---|---|---|
ORDER_RESERVATION_CREATED | Reservation created with supplier | reservationId |
ORDER_RESERVATION_TICKET_ISSUED | Flight ticket issued | reservationId |
ORDER_RESERVATION_CANCELED | Reservation cancelled | reservationId, reason |
ORDER_RESERVATION_SWITCHED_TO_CREDIT | Hotel payment switched to credit | Booking details |
ORDER_RESERVATION_RESOLVED_OUTSIDE_APP | Manual resolution recorded | Resolution details |
ORDER_RESERVATION_UPDATED_OUTSIDE_APP | External update recorded | Update details |
Example Reservation Created:
{
"reservationId": "12345678"
}Status Change Events
| Event Type | Description | Event Data |
|---|---|---|
ORDER_STATUS_MANUALLY_CHANGED | Admin changed order status | Previous status, new status, reason |
ORDER_MANUALLY_RESOLVED | Admin manually resolved an issue | Resolution details |
Example Status Change:
{
"previousStatus": "FAILED",
"newStatus": "FINALIZED",
"reason": "Ticket issued manually via supplier portal"
}Error Events
| Event Type | Description | Event Data |
|---|---|---|
ORDER_ENCOUNTERED_ERROR | Error occurred during processing | Error message, context |
ORDER_CANCELED_DUE_TO_NO_ACTIVITY | Order cancelled (unpaid 24h+) | - |
Example Error Event:
{
"message": "Creating reservation for order failed.",
"reservationInformation": {
"searchResultKey": "abc123",
"supplier": "IRIX"
}
}Refund Events
| Event Type | Description | Event Data |
|---|---|---|
ORDER_REFUNDED | Order was refunded | Refund amount, reason |
Event Flow Example
Here's a typical successful order event sequence:
Viewing Events
Events are accessible in the Travel Zone Dashboard:
- Navigate to Orders
- Click Details on an order
- Select the Events tab
Each event shows:
- Timestamp (with time)
- Event type (color-coded: green for success, red for errors)
- Action to view full event data
Error events (ORDER_ENCOUNTERED_ERROR) are highlighted in red for quick identification during troubleshooting.
Event Data Structure
Event data is stored as a JSON string. When viewing an event, the data is parsed and displayed in a readable format.
Common Event Data Fields
| Field | Description |
|---|---|
reservationId | External reservation reference |
message | Human-readable description |
flightReservationInformation | Flight booking details |
reservationInformation | Error context for failed reservations |
Best Practices for Event Analysis
Troubleshooting Failed Orders
- Find the first
ORDER_ENCOUNTERED_ERRORevent - Check the
messageandreservationInformationfields - Look at subsequent events for recovery attempts
- Verify if the order was manually resolved
Verifying Successful Orders
- Confirm
ORDER_CREATEDexists - Verify
ORDER_PAYMENT_VERIFIED_TO_BE_PAIDfollows - Check for
ORDER_RESERVATION_CREATED(one per reservation) - For flights: verify
ORDER_RESERVATION_TICKET_ISSUED - Confirm order status is
FINALIZED
Auditing Corporate Orders
For corporate direct orders, also verify:
- Policy evaluation (logged separately in policy violations)
- Budget reservation (logged in budget transactions)
- Budget confirmation on finalization