Skip to main content

Module trip

Module trip 

Source
Expand description

The trip sample: the disruption case of one booking.

It is the awkward workflow on purpose: several obligations are open at once, one of them per extra; the rebooking card is a persistent card bound to the case revision and to the quote it shows, so a new quote makes a click on it stale; the rebooking goes to an airline that may answer late or never, and the states after it are never collapsed into “done”; and a leg the traveler asked to keep is refused any change, by the domain, whatever was read.

use turnframe_core::case::CaseRef;
use turnframe_core::flow::{WorkflowDefinition, check_view};
use turnframe_core::ids::CaseRevision;
use turnframe_test::workflows::trip::{TripPhase, TripWorkflow, awaiting_rebooking_confirmation};

let workflow = TripWorkflow::default();
let state = awaiting_rebooking_confirmation();
let view = workflow.project(CaseRef::new("trip", "trip-1", CaseRevision(7)), Some(&state));

assert_eq!(view.phase, TripPhase::AwaitingRebookingConfirmation);
assert!(view.obligations.is_empty());
assert!(view.blocking_interaction.is_some());
assert!(check_view(&workflow, &view).is_ok());

Re-exports§

pub use airline::AirlineMode;
pub use airline::airline_answer;
pub use apply::apply;
pub use apply::extra_id_for;
pub use apply::next_status_for;
pub use apply::rejection;
pub use apply::validate;
pub use command::AddExtraArgs;
pub use command::AssignPayerArgs;
pub use command::ChangeExtraArgs;
pub use command::ChangeTravelerArgs;
pub use command::LegArgs;
pub use command::OpenArgs;
pub use command::SetNameArgs;
pub use command::SetTravelDateArgs;
pub use command::SetTravelerArgs;
pub use command::TravelerRecord;
pub use command::TripCommand;
pub use command::TripEvent;
pub use command::operations;
pub use definition::REBOOK_CONFIRM_OPTION;
pub use definition::REBOOK_DECLINE_OPTION;
pub use definition::REBOOKING_CONFIRMATION_KEY;
pub use definition::TripWorkflow;
pub use model::OTHER_TRAVELER_ID;
pub use model::REQUOTED_FARE_DIFFERENCE_CENTS;
pub use model::SAMPLE_EXTRA_DESCRIPTIONS;
pub use model::SAMPLE_FARE_DIFFERENCE_CENTS;
pub use model::SAMPLE_NAME;
pub use model::SAMPLE_REFUSAL_CODE;
pub use model::SAMPLE_TICKET_NUMBER;
pub use model::SAMPLE_TRAVELER_ID;
pub use model::TripModel;
pub use model::awaiting_rebooking_confirmation;
pub use model::awaiting_rebooking_confirmation_at;
pub use model::complete_case;
pub use model::incomplete_case;
pub use model::other_traveler;
pub use model::sample_legs;
pub use model::sample_new_extra;
pub use model::sample_offer;
pub use model::sample_quote;
pub use model::sample_travel_date;
pub use model::sample_traveler;
pub use model::unassigned_case;
pub use model::with_offer;
pub use state::Extra;
pub use state::Leg;
pub use state::LegStatus;
pub use state::NewExtra;
pub use state::Offer;
pub use state::Payer;
pub use state::TripObligation;
pub use state::TripOutcome;
pub use state::TripPhase;
pub use state::TripState;
pub use state::TripStatus;
pub use state::TripTraveler;

Modules§

airline
The sample airline: how it answers a rebooking sent to it.
apply
The pure transition function of the trip sample.
command
Typed trip commands, events and model-facing argument shapes.
definition
The trip WorkflowDefinition: projection, catalog, compilation, policy, validation and receipts.
model
The exploration model and the ready-made fixtures of the trip sample.
state
Persisted state, phases, obligations and outcomes of the trip sample.

Constants§

CONFORMANCE_CASE_ID
Case identifier the executor conformance suite runs against.
CONFORMANCE_REVISION
Revision the conformance case is seeded at, chosen so a failure that reports 0 or 1 is obviously wrong rather than accidentally right.

Functions§

conformance_case
The trip sample wired up for executors::run_all.

Type Aliases§

TripExecutor
An in-memory executor for the trip workflow.