Middle
Draw a sequence diagram of the interaction between Frontend and Backend when using a promo code
sobes.tech AI
Answer from AI
mermaid sequenceDiagram participant User participant Frontend participant Backend
User->>Frontend: Enters promo code and clicks "Apply"
Frontend->>Backend: Sends request with promo code (e.g., POST /apply-promo)
Backend->>Backend: Checks promo code validity (exists, not expired, applicable to order)
alt Promo code is valid
Backend->>Frontend: Returns success response with discount information
Frontend->>User: Displays discount and updates order total
else Promo code is invalid
Backend->>Frontend: Returns error message
Frontend->>User: Shows error message
end