bitcoin-atm
bitcoin atm for pyc inc.
git clone https://9o.is/git/bitcoin-atm.git
Messages.scala
(2238B)
1 package inc.pyc.chimera
2
3 import inc.pyc.bill.acceptor.Events._
4 import inc.pyc.chimera.minions.Balance
5 import akka.actor.ActorRef
6
7 /**
8 * User scanned a QR code.
9 *
10 * @param qr data in QR code
11 */
12 case class QrCode(qr: String)
13
14 /**
15 * Buy Bitcoin!
16 */
17 case object Buy
18
19 /**
20 * Log in the registered user.
21 *
22 * @param email registered email
23 * @param password one-time password
24 */
25 case class UserVerify(email: String, password: String)
26
27 /**
28 * Go to wizard screen.
29 *
30 * @param page name of the screen
31 * @param reason message explaining why the action is occurring
32 */
33 case class Goto(screen: Screen, reason: String = "")
34
35 /**
36 * Commands minion to check if bill should be
37 * accepted.
38 *
39 * @param inserted inserted bill
40 * @param tx incomplete transaction
41 * @param balance balance in bitcoin wallet
42 */
43 case class InspectBill(
44 inserted: Inserted,
45 tx: IncompleteTx,
46 balance: Balance)
47
48 /**
49 * Bill is acceptable.
50 */
51 case object ValidBill
52
53 /**
54 * Bill is unacceptable because it is passed purchase limit
55 */
56 case object InvalidBill
57
58 /**
59 * Container for phone number. Used by client to send to `Overlord`
60 */
61 case class Phone(number: String, sms: Boolean = true, verified: Boolean = false)
62
63 /**
64 * Container for email. Used by client to send to `Overlord`
65 */
66 case class Email(data: String)
67
68 /**
69 * Command from client to Overlord to skip the current state
70 * and go to the next one.
71 */
72 case object Continue
73
74 /**
75 * Command from client to Overlord to go to the previous state.
76 */
77 case object Previous
78
79 /**
80 * Someone touched the screen.
81 * This may be helpful to reset state timeout.
82 */
83 case object Touch
84
85 /**
86 * Balance in bitcoin wallet, measured by fiat currency.
87 *
88 * @param remaining the balance in wallet
89 */
90 case class FiatBalance(remaining: Double)
91
92 /**
93 * QR code does not have a valid bitcoin address.
94 */
95 case object InvalidBitcoinAddress
96
97 /**
98 * When trying to log in and credentials do not exist.
99 */
100 case object LoggedOut
101
102 /**
103 * The amount left to spend.
104 *
105 * @param left total amount the user can buy right now
106 * @param limit total amount the user can buy in a 24 hour period
107 */
108 case class LeftToSpend(left: Int, limit: Int)
109
110
111 case object DataRequest
112 case class DataReply[T >: Data](data: T)