Pricing Traveler Semantics Refactor Design

Date: 2026-04-13
Status: Approved approach (Approach 2: dual-read, new-write)

Goal

Refactor pricing traveler semantics so that:

extraMattressCount must not be treated as traveler count and must not participate in traveler display/count semantics.

Scope

In-scope:

Out-of-scope:

API Contract Design

New primary keys

Backward-compatible input support (transition)

Temporarily accept both old and new keys in requests/query:

Response normalization

Return only new semantics in pricing selection/traveler sections:

Computation & Data Flow

  1. Parse incoming counts from query/payload using dual-read mapping.
  2. Compute traveler-related values:
    • Traveler count for slabs: adults + children
    • Traveler details count: adults, children, infants
  3. Compute pricing components:
    • Child price continues existing child-without-bed behavior, now driven by children
    • Extra bed/mattress price continues existing extra-bed behavior, now driven by extraMattressCount
  4. Dinner supplement applies to actual travelers only (adults + children).
  5. Persist traveler details without mattress count while allowing read fallback from legacy data where needed.

Internal Mapping Rules

Read-time normalization

Write-time normalization

Persist and emit:

Do not emit legacy key names in new API responses.

Error Handling

Testing Strategy

Add/adjust tests for:

  1. Query parsing: new keys accepted; old keys still accepted.
  2. Slab selection: extraMattressCount does not affect slab banding.
  3. Pricing calculation: child and mattress pricing remain aligned with prior price behavior.
  4. Response shape: returns new fields only for pricing traveler sections.
  5. Booking pricingSelection mapping: accepts new keys and still supports old input aliases.

Files Expected to Change

Rollout Notes