Solution
Sequence Diagram: Food Delivery Order Process
Objects (Lifelines):
- Customer – The user placing the order.
- Mobile App – The food delivery application.
- Order Service – Handles order creation and processing.
- Payment Service – Processes payments.
- Restaurant System – Receives and prepares the order.
- Delivery Service – Manages delivery personnel and tracks delivery.
Sequence of Messages:
TEXT
Customer → Mobile App: Browse menu and select items
Customer → Mobile App: Add items to cart
Customer → Mobile App: Click "Place Order"
Mobile App → Order Service: Create order (items, customer details, address)
Order Service → Payment Service: Process payment (amount, payment info)
Payment Service → Order Service: Return "Payment Successful"
Order Service → Mobile App: Show order confirmation
Order Service → Restaurant System: Send order notification
Restaurant System → Order Service: Confirm order received
(Time passes - Food Preparation)
Restaurant System → Delivery Service: Notify order ready for pickup
Delivery Service → Delivery Person: Assign delivery task
Delivery Person → Delivery Service: Pick up order
Delivery Service → Mobile App: Update status "Order Picked Up"
Delivery Person → Customer: Deliver order
Delivery Person → Delivery Service: Mark order as "Delivered"
Delivery Service → Mobile App: Update status "Order Delivered"
Mobile App → Customer: Show delivery confirmation
Textual Representation:
TEXT
Customer Mobile App Order Service Payment Service Restaurant Sys Delivery Service
│ │ │ │ │ │
│──Browse & Add─│ │ │ │ │
│──Place Order──│ │ │ │ │
│ │──Create Order─▶│ │ │ │
│ │ │──Process Pay─▶│ │ │
│ │ │◀─Payment OK──│ │ │
│ │◀─Confirm Order─│ │ │ │
│ │ │──Notify Order──────────────────▶│ │
│ │ │◀─Confirm────────────────────────│ │
│ │ │ │ │ │
│ │ │ │ │──Order Ready─────▶│
│ │ │ │ │ │
│ │ │ │ │ │──Assign Deliver─│
│ │ │ │ │ │
│ │◀─Status Update──────────────────────────────────────────────────────────│
│ │ │ │ │ │
│ │ │ │ │ │
│◀─Delivered──────────────────────────────────────────────────────────────────────────────────