Sequence Diagram for the Parking Lot
Create a sequence diagram for the card payment in the parking lot system and solve a challenge.
We'll cover the following...
A sequence diagram is a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for our parking lot system. For the sake of this lesson, we will create sequence diagrams for the following two interactions:
Card payment: This performs a payment using the card.
Sequence challenge: This is for payment verification.
Card payment
The sequence diagram for the card payment should have the following actors and objects that will interact with each other:
Actor:
Customer
Objects:
ExitPanel
,ParkingRate
,ParkingTicket
, andPayment
Interaction steps:
The customer inserts their parking ticket and card into the exit panel.
The
ExitPanel
validates the parking ticket.Based on the ticket details, the
ExitPanel
requests theParkingRate
object to calculate the total parking fee.The
ExitPanel
creates aPayment
object (of typeCreditCard
) and initiates the transaction.The
Payment
object processes the card transaction and returns aPaymentStatus
(success or failure) to theExitPanel
.The
ExitPanel
prompts the customer to remove their card.If the payment is successful:
The customer may request a receipt.
The
ExitPanel
prints the receipt.The exit gate is opened to allow the vehicle to leave.
If the payment is unsuccessful:
The
ExitPanel
displays an error message and may prompt the customer to retry.
Note: The
Payment
object for the card transaction is typically created when the customer is ready to exit and the fee has been calculated.
Based on the order above, the sequence diagram of the card payment in a parking lot system is given below.