-
Notifications
You must be signed in to change notification settings - Fork 4
/
bileto_state_diagram.pu
82 lines (77 loc) · 3.12 KB
/
bileto_state_diagram.pu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@startuml bileto_state_diagram
skinparam Monochrome true
left header Consensys Academy Developer Bootcamp 2019 - Final Project\n
right footer \n2019-01-22 by Fábio Corrêa <[email protected]>
title Bileto smart contract - State Diagram\n
state Store {
[*] --> Store.Created: constructor()
Store.Created --> Store.Open: openStore()
Store.Open: By Store.Owner
Store.Created --> Store.Closed: closeStore()
Store.Closed: By Store.Owner
Store.Open --> Store.Suspended: suspendStore()
Store.Suspended: By Store.Owner
Store.Open --> Store.Closed: closeStore()
Store.Suspended --> Store.Open: openStore()
Store.Suspended --> Store.Closed: closeStore()
' Store.Closed: Store.RefundableBalance is Zero
Store.Closed --> [*]
}
state Event {
[*] --> Event.Created: createEvent()
Event.Created: By Store.Owner
Event.Created: Store.Open
Event.Created --> Event.SalesStarted: startTicketSales()
Event.Created --> Event.Cancelled: cancelEvent()
Event.SalesStarted: By Event.Organizer
Event.SalesStarted: Store.Open
Event.SalesStarted --> Event.SalesSuspended: suspendTicketSales()
Event.SalesStarted --> Event.SalesFinished: endTicketSales()
Event.SalesStarted --> Event.Cancelled: cancelEvent()
Event.SalesSuspended: By Event.Organizer
Event.SalesSuspended: Store.Open
Event.SalesSuspended --> Event.SalesStarted: startTicketSales()
Event.SalesSuspended --> Event.SalesFinished: endTicketSales()
Event.SalesSuspended --> Event.Cancelled: cancelEvent()
Event.SalesFinished: By Event.Organizer
Event.SalesFinished: Store.Open
Event.SalesFinished --> Event.Completed: completeEvent()
Event.SalesFinished --> Event.Cancelled: cancelEvent()
Event.Completed: By Event.Organizer
Event.Completed: Store.Open
Event.Completed --> Event.Settled: settleEvent()
Event.Settled: By Store.Owner
Event.Settled: Store.Open
Event.Settled --> [*]
Event.Cancelled: By Event.Organizer
Event.Cancelled: Store.Open
Event.Cancelled --> [*]
}
state Purchase {
[*] --> Purchase.Completed: purchaseTickets()
Purchase.Completed: By Customer
Purchase.Completed: Store.Open
Purchase.Completed: Event.SalesStarted
Purchase.Completed: Purchase.Quantity <= Event.TicketsLeft
Purchase.Completed --> Purchase.Cancelled: cancelPurchase()
Purchase.Cancelled: By Customer
Purchase.Cancelled: Store.Open OR Store.Closed
Purchase.Cancelled: Event.SalesStarted
Purchase.Cancelled: OR Event.SalesSuspended
Purchase.Cancelled: OR Event.SalesFinished
Purchase.Cancelled: OR Event.Cancelled
Purchase.Cancelled: OR Store.Closed
Purchase.Cancelled --> Purchase.Refunded: refundPurchase()
Purchase.Refunded: By Organizer
Purchase.Refunded: Store.Open
Purchase.Refunded: OR Store.Closed
Purchase.Refunded --> [*]
Purchase.Completed --> Purchase.CheckedIn: checkIn()
Purchase.CheckedIn: By Customer
Purchase.CheckedIn: Store.Open
Purchase.CheckedIn: Event.SalesStarted
Purchase.CheckedIn: OR Event.SalesSuspended
Purchase.CheckedIn: OR Event.SalesFinished
Purchase.CheckedIn --> [*]
}
@enduml