2082 11

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

ParticipantRole
CustomerInitiates the order
Web/App InterfaceFront-end system
Order Management SystemProcesses and manages orders
Restaurant SystemReceives and prepares the order
Payment GatewayHandles online payment
Bank/Card SystemAuthorizes 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

MessageFromTo
login()CustomerUI
browseMenu()CustomerUI
placeOrder()CustomerUI
createOrder()UIOrder System
sendOrderDetails()Order SystemRestaurant
initiatePayment()UIPayment Gateway
requestAuth()Payment GatewayBank
authSuccess()BankPayment Gateway
paymentConfirmed()Payment GatewayOrder System
orderConfirmation()UICustomer
notifyRestaurant()Order SystemRestaurant
deliveryStatus()Order SystemCustomer

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.