%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#70e7d4'}}}%% sequenceDiagram autonumber rect rgb(255,250,240) Note right of Merchant: POST /shipments?draft=true Merchant->>+Carriyo: Create a Draft Shipment Carriyo-->>Merchant: Shipment in draft status Note right of Carriyo: Shipment ID Generated end rect rgb(245,245,245) Note right of Merchant: POST /shipments/{shipment-id}/confirm Merchant->>+Carriyo: Confirm Draft Shipment Carriyo-->>Merchant: Shipment in pending status Carriyo->>+Carrier: Book the Shipment Carrier-->>-Carriyo: Shipment Booked Note right of Carrier: Tracking Number Generated alt carrier call fails Carriyo--)Merchant: Shipment in error status (async webhook) Note left of Carriyo: No Carrier Tracking Number else carrier call success Carriyo--)Merchant: Shipment in booked status (async webhook) Note left of Carriyo: Carrier Tracking Number Available end Carriyo-)+Carrier: Get the Label Carrier--)-Carriyo: Label Returned Note right of Carrier: Label Generated Carriyo--)-Merchant: Shipment with label (async webhook) Note left of Carriyo: Shipment Label Available end rect rgb(255,250,240) Note right of Merchant: POST /shipments/{shipment-id}/ready-to-ship Merchant->>+Carriyo: Ready to Ship Carriyo-->>Merchant: Ready to Ship Request Received Carriyo-->>+Carrier: Schedule Collection Carrier-->>-Carriyo: Collection Scheduled Carriyo--)-Merchant: Shipment in ready_to_ship status (async webhook) Note left of Carriyo: Shipment is Ready to Ship end