CSC326 ยท 2082 ยท 5 marks
Draw the sequence diagram for the online food ordering system with the online payment facility.
Draw the sequence diagram for the online food ordering system with the online payment facility. [5]
System Analysis and DesignChapter 6: Introduction to Object-Oriented DevelopmentIntroduction to Unified Modeling Language, Structural and Be
Quick answer
A sequence diagram is a type of UML interaction diagram that shows how objects interact with one another and in what order (sequence) those interactions occur over time. It captures the dynamic behavior of the system.
Sequence Diagram for Online Food Ordering System with Online Payment Facility
What is a Sequence Diagram?
Key Actors and Objects Involved
| Participant | Role |
|---|---|
| Customer | Initiates the order |
| Web/App Interface | Front-end system |
| Order Management System | Processes and manages orders |
| Restaurant System | Receives and prepares the order |
| Payment Gateway | Handles online payment |
| Bank/Card System | Authorizes the transaction |
Sequence Diagram (Textual Representation)
Customer UI/App OrderSystem Restaurant PaymentGateway Bank
| | | | | |
|--login()-->| | | | |
|<--loginSuccess()--| | | | |
| | | | | |
|--browseMenu()-->| | | | |
|<--displayMenu()--| | | | |
| | | | | |
|--selectItems()-->| | | | |
|--placeOrder()-->| | | | |
| |--createOrder()-->| | | |
| | |--sendOrderDetails()-->| | |
| | |<--orderConfirmed()----| | |
| |<--orderID + totalAmount()--| | | |
| | | | | |
|--selectPayment()-->| | | | |
|--enterPaymentDetails()-->| | | | |
| |--initiatePayment()----------->| | |
| | | |--requestAuth()------------>|
| | | | |<--authSuccess()--|
| | | |<--paymentConfirmed()--| |
| |<--paymentSuccess()--| | | |
|<--orderConfirmation() + receipt()--| | | |
| | | | | |
| | |--notifyRestaurant()-->| | |
| | | |--prepareOrder()| |
| | | |--dispatchOrder()| |
|<--deliveryStatus()----------| | | |
Diagram Description (Step-by-Step)
Step 1: Login
- The Customer logs into the system through the UI/App.
- The system returns a login success message.
Step 2: Browse and Select Menu
- Customer browses the menu; the UI fetches and displays menu items.
- Customer selects items and adds them to the cart.
Step 3: Place Order
- Customer clicks Place Order.
- UI sends a
createOrder()request to the Order Management System. - Order system forwards order details to the Restaurant System.
- Restaurant confirms the order back to the Order System.
- UI displays Order ID and total amount to the customer.
Step 4: Online Payment
- Customer selects a payment method (card/wallet) and enters payment details.
- UI calls
initiatePayment()on the Payment Gateway. - Payment Gateway sends an authorization request to the Bank/Card System.
- Bank verifies and returns authorization success.
- Payment Gateway sends payment confirmed back to the Order System and UI.
- Customer receives a payment success message and receipt.
Step 5: Order Fulfillment
- Order System notifies the Restaurant to prepare the order.
- Restaurant prepares and dispatches the order.
- Customer receives real-time delivery status updates.
Summary of Lifelines and Messages
| Message | From | To |
|---|---|---|
login() | Customer | UI |
browseMenu() | Customer | UI |
placeOrder() | Customer | UI |
createOrder() | UI | Order System |
sendOrderDetails() | Order System | Restaurant |
initiatePayment() | UI | Payment Gateway |
requestAuth() | Payment Gateway | Bank |
authSuccess() | Bank | Payment Gateway |
paymentConfirmed() | Payment Gateway | Order System |
orderConfirmation() | UI | Customer |
notifyRestaurant() | Order System | Restaurant |
deliveryStatus() | Order System | Customer |
Key Point for Exam: In a sequence diagram, vertical lines are called lifelines, horizontal arrows are messages, and activation boxes (rectangles on lifelines) show when an object is active/processing.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.