Busflow Docs

Internal documentation portal

Skip to content

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 โ€‹

EventEmitterConsumerPurpose
PriceMatrixPublishedBackoffice (PriceMatrix โ†’ PUBLISHED)Commerce (TourOfferingPrice read model)Syncs resolved selling prices for storefront display and checkout
SeasonPricingFinalizedBackoffice (batch orchestrator)Commerce (catalog distribution)Signals season-wide catalog readiness (partial success supported)
BookingConfirmedCommerce (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 via price_matrix_id binding at checkout (costing-pricing-separation ADR ยง3, ยง5).


Payload Schemas โ€‹

PriceMatrixPublished โ€‹

FieldTypeDescription
event_idUUIDIdempotency key
tenant_idUUIDOwning operator
price_matrix_idUUIDThe published PriceMatrix entity
price_matrix_versionINTMonotonic version counter
costing_sheet_idUUIDSource cost calculation
tour_departure_idUUIDTarget departure (null for template-level previews)
channelStringSales channel (e.g., DEFAULT, B2B_OTA)
list_priceDecimalList Price
variantsPriceVariant[]Full resolved variant array
currencyString (ISO 4217)Selling currency
supersedes_price_matrix_id`UUIDnull`
published_atTIMESTAMPTZPublication timestamp

BookingConfirmed (consumed by Backoffice) โ€‹

FieldTypeConsumed?Description
event_idUUIDโœ…Idempotency key
tenant_idUUIDโœ…Owning operator
booking_idUUIDโœ…Confirmed booking
tour_departure_idUUIDโœ…Used to locate CostingSheet
price_matrix_idUUIDโœ…PriceMatrix version booked against
confirmed_atTIMESTAMPTZโœ…Confirmation timestamp

Delivery Contracts โ€‹

EventMechanismTriggerIdempotency
PriceMatrixPublishedHasura Event Trigger (async, post-commit)backoffice.price_matrices.status โ†’ PUBLISHEDevent_id (UUID)
SeasonPricingFinalizedNestJS Hasura Action callback (async)Batch orchestrator completionevent_id
BookingConfirmedHasura Event Trigger (async, post-commit)commerce.bookings.status โ†’ DEPOSIT_PAIDevent_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.

Internal documentation โ€” Busflow