Coupon checkout sequence diagram
Applying a coupon at checkout: the coupon service checks it and returns the discount, with an alt branch for missing or expired coupons.
The diagram
Reading it step by step
- 1. 'Buyer' sends a request to 'Order service': 'Enter coupon code'.
- 2. 'Order service' sends a request to 'Coupon service': 'Validate coupon'.
- [alt: Valid]
- 3. 'Coupon service' replies to 'Order service': '3,000 won off'.
- 4. 'Order service' replies to 'Buyer': 'Updated total'.
- 5. 'Coupon service' replies to 'Order service': 'Not usable'.
- 6. 'Order service' replies to 'Buyer': 'Coupon error'.
Shape by shape
| Shape | Symbol | Connections |
|---|---|---|
| Buyer | Actor | → Order service(Enter coupon code) · ← Order service, Order service |
| Order service | Participant and lifeline | → Coupon service(Validate coupon), Buyer(Updated total), Buyer(Coupon error) · ← Buyer, Coupon service, Coupon service |
| Coupon service | Participant and lifeline | → Order service(3,000 won off), Order service(Not usable) · ← Order service |
Symbols used here
| Symbol | Meaning |
|---|---|
| Participant and lifeline | A box on top and a dashed line below. |
| Actor | A human participant; a stick figure. |
| Synchronous message | A call that waits; solid line, filled head. |
| Reply | The answer; dashed line, open head. |
| Combined fragment | loop, alt and opt boxes. |
Diagram text
Paste this text into the editor to get the same picture, then change the names to fit your own work.
# Coupon checkout sequence diagram
sequenceDiagram
actor C as Buyer
participant O as Order service
participant K as Coupon service
C->>O: Enter coupon code
O->>K: Validate coupon
alt Valid
K-->>O: 3,000 won off
O-->>C: Updated total
else Expired or unknown
K-->>O: Not usable
O-->>C: Coupon error
end