This sequence diagram starts when a user adds an item to their card. When proceeding with the purchase, the user can choose gift wrapping (optional fragment). When it comes to payment, they have two options: card payment and payment by bank transfer (alternative fragment). If the user chooses card payment, they enter their card details and the online store sends the request to the payment gateway. If the customer chooses payment by bank transfer, the online store provides the transfer information to the user. The user pays the bill and gets payment confirmation.
Online shopping diagram code in Gleek
User- Add item to the card -> Online store
/opt Gift wrapping
User- Choose gift wrapping-> Online store
/alt Payment with card
User- Enter card details-> Online store
Online store- Pay with card-> PaymentGateway
/else Payment with transfer
Online store-. Information for transfer-> User
User- Pay with transfer-> Bank
Online store- Confirmation->User
About sequence diagrams
Sequence or event diagrams help create an overview of how a system works. Sequence diagrams show how all the different parts interact with each other over time, carry out the required actions, and complete processes. A sequence diagram descends from top to bottom showing a sequence of interactions and sequence diagram notations.