Skip to content

Core Concepts

Charter models the complete brokerage lifecycle from initial guest inquiry to confirmed embarkation without adding a single custom SQL table.

flowchart TD
    A["Fleet Source (entry: charteryachts OR page: scaffolded templates)"] --> B["FleetSearchService + YachtSubjectResolver"]
    B --> C["AvailabilityEngine [check_in, check_out) + CharterWriteLock"]
    B --> D["PricingEngine (Date Range > Monthly > Pro-Rata + Discounts + VAT + APA + Extras)"]
    C --> E["BookingWorkflowService (Inquiry -> Option Hold -> Confirmed -> Milestones)"]
    D --> E
    E --> F["QuoteProposalRenderer (HMAC-SHA256 Branded / Unbranded /_charter/proposal/{token})"]
    E --> G["ExpireCharterHoldsTask (*/15 * * * *) + CharterNotifier (WireMail)"]

1. Dual-Source Fleet (entry, page, or none)

Section titled “1. Dual-Source Fleet (entry, page, or none)”

Configure fleet_source in Charter Settings -> Fleet Source Bridge:

  • entry (default): Manage yachts directly inside Charter’s charter-yachts Entries collection.
  • page: Keep yachts as native ProcessWire Page objects and attach Charter’s 5 composable @fieldset:charter-* embedded fields (specs, cabins, amenities, rates, operations) using php vendor/bin/wire charter:scaffold:page.
  • YachtSubjectResolver & CharterYachtResource (charter_yacht): Transparently normalize entry:<uuid> and page:<id> references across search, pricing, rates matrix, inquiries, and bookings.

PricingEngine::calculate() evaluates exact Money minor-unit math in strict precedence order:

  1. Date Range rate (exact yearless window match in RecurringRateCalendar)
  2. Monthly rate (yearless month match)
  3. Pro-Rata daily/hourly math (using pro_rata_divisor: 7 nights or 6 days)
  4. Discounts (stackable vs. non-stackable competition capped at max_discount_percent)
  5. VAT override chain -> APA (0% automatically for Bareboat) -> Extras (WithBooking vs. AtBase)
  6. Fail-Closed FX (CurrencyConverter): Converts via Currency with applySpread: true and throws WireException if an FX rate is missing rather than silently returning 1.0.

3. Half-Open Availability & Multi-Dialect Locks

Section titled “3. Half-Open Availability & Multi-Dialect Locks”

AvailabilityEngine checks [check_in, check_out) intervals so a yacht disembarking at 09:00 and embarking at 17:00 on the same Saturday never falsely conflicts. Every booking save acquires a DB-name-scoped advisory lock via CharterWriteLock (GET_LOCK on MySQL/MariaDB, pg_advisory_xact_lock on PostgreSQL, serialized transaction on SQLite).

4. Redacted HMAC Proposals (QuoteProposalRenderer)

Section titled “4. Redacted HMAC Proposals (QuoteProposalRenderer)”

Share links (/_charter/proposal/{token}) are signed with HKDF-SHA256 derived from $config->userAuthSalt (Charter:proposal-signing-v1). Private operational fields (internal_notes, commission_percent, owner_name, owner_contact, captain_*, private_notes) are never rendered, and unbranded proposals (branded: false) strip agency branding and client details for broker-to-broker forwarding.

Next steps