Loyalty Platform - Kiosk Flow Diagram

%%{init: { "theme": "base", "themeVariables": { "fontSize": "18px", "background": "transparent", "actorBkg": "#038851", "actorTextColor": "#ffffff", "actorBorder": "#026139", "actorLineColor": "#94a3b8", "signalColor": "#64748b", "signalTextColor": "#059669", "noteBkgColor": "#e6f4ee", "noteTextColor": "#02502f", "noteBorderColor": "#038851", "activationBkgColor": "#c6ebdc", "activationBorderColor": "#026139", "sequenceNumberColor": "#ffffff" }, "sequence": { "useMaxWidth": true, "actorMargin": 70, "width": 150, "height": 60, "boxMargin": 12, "noteMargin": 14, "messageMargin": 50, "diagramMarginX": 20, "diagramMarginY": 20, "actorFontSize": 18, "actorFontWeight": 700, "noteFontSize": 15, "noteFontFamily": "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", "messageFontSize": 16, "messageFontWeight": 700, "noteAlign": "left", "mirrorActors": false } }}%%
sequenceDiagram
    autonumber
    participant LOYALTY PLATFORM as Loyalty Platform
    participant KIOSK as Kiosk
    participant DLVRCT as Deliverect
    participant POS PLATFORM as POS

    Note over LOYALTY PLATFORM,POS PLATFORM: ๐Ÿญ โ€” ๐—ฃ๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜ & ๐— ๐—ฒ๐—ป๐˜‚ ๐—ฆ๐˜†๐—ป๐—ฐ<br/>โ„น๏ธ The POS is the source of truth for product data. Products are<br/>synced into Deliverect, which builds and publishes menus<br/>to the Kiosk channel.
    POS PLATFORM->>DLVRCT: sync product data
    DLVRCT->>KIOSK: sync menus

    Note over LOYALTY PLATFORM,POS PLATFORM: ๐Ÿฎ โ€” ๐—–๐˜‚๐˜€๐˜๐—ผ๐—บ๐—ฒ๐—ฟ ๐—œ๐—ฑ๐—ฒ๐—ป๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป<br/>โ„น๏ธ The customer scans their loyalty app at the Kiosk.<br/>The customer is identified and a basket is opened, with a<br/>Basket Id used to track the order end-to-end.
    LOYALTY PLATFORM->>+KIOSK: scan loyalty app (identify customer)
    KIOSK-->>-LOYALTY PLATFORM: Basket Id
    Note right of KIOSK: 200 OK<br/>(<br/>#160;#160;"customerId": "customer-1",<br/>#160;#160;"basketId": "basket-1"<br/>)

    Note over LOYALTY PLATFORM,POS PLATFORM: ๐Ÿฏ โ€” ๐—ข๐—ฟ๐—ฑ๐—ฒ๐—ฟ & ๐—ฃ๐—ฎ๐˜†๐—บ๐—ฒ๐—ป๐˜<br/>โ„น๏ธ The customer completes their order on the Kiosk and pays.<br/>The completed order is passed to Deliverect for parsing.
    KIOSK->>KIOSK: complete order
    KIOSK->>KIOSK: take payment
    KIOSK->>+DLVRCT: submit order
    DLVRCT->>DLVRCT: parse order
    DLVRCT->>+POS PLATFORM: send order
    Note right of DLVRCT: โ„น๏ธ Basket Id is included<br/>(<br/>#160;#160;"basketId": "basket-1",<br/>#160;#160;"items": [ ... ]<br/>)
    deactivate POS PLATFORM
    deactivate DLVRCT

    Note over LOYALTY PLATFORM,POS PLATFORM: ๐Ÿฐ โ€” ๐—ข๐—ฟ๐—ฑ๐—ฒ๐—ฟ ๐—ฆ๐˜๐—ฎ๐˜๐˜‚๐˜€ & ๐—Ÿ๐—ผ๐˜†๐—ฎ๐—น๐˜๐˜† ๐—ฅ๐—ฒ๐—ฑ๐—ฒ๐—บ๐—ฝ๐˜๐—ถ๐—ผ๐—ป<br/>โ„น๏ธ The POS sends order status updates back to Deliverect, which<br/>fans them out as webhooks to the Kiosk and to the Loyalty Platform,<br/>where the loyalty redemption is applied.
    POS PLATFORM->>+DLVRCT: Order Status
    Note right of DLVRCT: ("Accepted")
    POS PLATFORM->>DLVRCT: Order Status
    Note right of DLVRCT: ("Finalised")
    DLVRCT->>KIOSK: webhook: Order Status
    Note right of KIOSK: ("Accepted" / "Finalised")
    DLVRCT->>-LOYALTY PLATFORM: webhook: Loyalty Redemption
    Note right of LOYALTY PLATFORM: (<br/>#160;#160;"basketId": "basket-1",<br/>#160;#160;"status": "finalised",<br/>#160;#160;"loyalty": "redeemed"<br/>)