@startujn render { direction: down; arrow_spacing: 24 } journey BOOK "Book an appointment" description: "Book a time and pay a deposit. A reminder the day before lets the client reschedule or cancel" unique_id_friendly: booking start from_site { description: "From the booking page" } view slots { title: "Pick a service and time"; description: "Free slots, next 4 weeks"; route: /book } action hold_slot { title: "Hold the slot"; description: "For 10 minutes" } view details { title: "Your details"; description: "Name, phone, email and card"; route: /book/details } action pay_deposit { title: "Charge deposit"; description: "20% of the price" } system psp { type: external; title: "Payment provider"; host: api.pay.example } action confirm { type: message; title: "Send confirmation"; channel: email and SMS } view booked { title: "Booking confirmed"; route: /appointments/:id } end done { type: success; description: "Appointment booked" } action day_before { type: wait; title: "Until the day before"; description: "10:00, the day before the appointment" } action remind { type: message; title: "Reminder SMS"; channel: SMS } handoff reminder_link { title: "Reminder link"; channel: SMS; resume: /appointments/:id/manage } view manage { title: "Manage booking"; description: "Reschedule or cancel"; route: /appointments/:id/manage } ref reschedule { journey: RESCHEDULE; title: "Reschedule"; description: "The deposit moves along" } view cancel_confirm { type: modal; title: "Cancel appointment?"; description: "Says if the deposit is refunded or kept" } end refunded { type: success; description: "Canceled, deposit refunded" } end kept { type: failure; description: "Canceled on the day, deposit kept" } from_site --> slots slots --> hold_slot : [Pick time] { payload: [service, slot] } hold_slot --> details : still free hold_slot .x.> slots : taken meanwhile details --> pay_deposit : [Book and pay] { payload: [name, phone, email, card_token] } pay_deposit -right-> psp { payload: [card_token, deposit] } psp ..> pay_deposit { payload: [payment_id] } pay_deposit --> confirm : paid pay_deposit .x.> details : declined confirm --> booked confirm --> day_before booked --> done : [Done] day_before --> remind remind --> reminder_link reminder_link ..> manage : [Open link] manage -left-> reschedule : [Reschedule] manage --> cancel_confirm : [Cancel] cancel_confirm ..> manage : [Keep it] cancel_confirm -left-> refunded : [Cancel appointment] before the day cancel_confirm -right-x-> kept : [Cancel appointment] on the day @endujn