Cross-Context Event Contracts: Backoffice โ Commerce (Pricing) โ
Formal event contracts for the pricing โ commerce boundary. For the Kalkulations-Engine specification, see kalkulations-engine.md. For the broader domain events catalog, see domain-driven-design.md ยง4.
Event Catalog โ
| Event | Emitter | Consumer | Purpose |
|---|---|---|---|
PriceMatrixPublished | Backoffice (PriceMatrix โ PUBLISHED) | Commerce (TourOfferingPrice read model) | Syncs resolved selling prices for storefront display and checkout |
SeasonPricingFinalized | Backoffice (batch orchestrator) | Commerce (catalog distribution) | Signals season-wide catalog readiness (partial success supported) |
BookingConfirmed | Commerce (Booking โ DEPOSIT_PAID โ ADR-009) | Backoffice (CostingSheet auto-lock) | Triggers cost lock and Soll baseline freeze |
Internal Backoffice event:
CostingSheetLocked(emitted when CostingSheet โLOCKED) is an internal event delivered via@nestjs/event-emitter. Commerce does not consume it โ cost locking โ price freezing. The system freezes prices per-booking viaprice_matrix_idbinding at checkout (costing-pricing-separation ADR ยง3, ยง5).
Payload Schemas โ
PriceMatrixPublished โ
| Field | Type | Description |
|---|---|---|
event_id | UUID | Idempotency key |
tenant_id | UUID | Owning operator |
price_matrix_id | UUID | The published PriceMatrix entity |
price_matrix_version | INT | Monotonic version counter |
costing_sheet_id | UUID | Source cost calculation |
tour_departure_id | UUID | Target departure (null for template-level previews) |
channel | String | Sales channel (e.g., DEFAULT, B2B_OTA) |
list_price | Decimal | List Price |
variants | PriceVariant[] | Full resolved variant array |
currency | String (ISO 4217) | Selling currency |
supersedes_price_matrix_id | `UUID | null` |
published_at | TIMESTAMPTZ | Publication timestamp |
BookingConfirmed (consumed by Backoffice) โ
| Field | Type | Consumed? | Description |
|---|---|---|---|
event_id | UUID | โ | Idempotency key |
tenant_id | UUID | โ | Owning operator |
booking_id | UUID | โ | Confirmed booking |
tour_departure_id | UUID | โ | Used to locate CostingSheet |
price_matrix_id | UUID | โ | PriceMatrix version booked against |
confirmed_at | TIMESTAMPTZ | โ | Confirmation timestamp |
Delivery Contracts โ
| Event | Mechanism | Trigger | Idempotency |
|---|---|---|---|
PriceMatrixPublished | Hasura Event Trigger (async, post-commit) | backoffice.price_matrices.status โ PUBLISHED | event_id (UUID) |
SeasonPricingFinalized | NestJS Hasura Action callback (async) | Batch orchestrator completion | event_id |
BookingConfirmed | Hasura Event Trigger (async, post-commit) | commerce.bookings.status โ DEPOSIT_PAID | event_id |
All consumers implement at-least-once processing with event_id-based deduplication. Version conflicts on PriceMatrixPublished use monotonic resolution: price_matrix_version > current โ update; otherwise discard.