bitcoin-atm

bitcoin atm for pyc inc.

git clone https://9o.is/git/bitcoin-atm.git

State.scala

(2143B)


      1 package inc.pyc.chimera
      2 
      3 /**
      4  * The state of the machine.
      5  */
      6 trait State
      7 
      8 /**
      9  * A state that also has a UI display.
     10  */
     11 trait Screen extends State {
     12   val name: String = getClass().getSimpleName()
     13 }
     14 
     15 /**
     16  * Has just booted but hasn't initialized yet.
     17  */
     18 case object Uninitialized extends State with Screen
     19 
     20 /**
     21  * Waiting for a user to begin. The most common state.
     22  */
     23 case object Idle extends State with Screen
     24 
     25 /**
     26  * Ready for the user to scan their QR code.
     27  */
     28 case object QrScan extends State with Screen
     29 
     30 /**
     31  * Validates a Bitcoin address in QR code.
     32  */
     33 case object QrValidate extends State
     34 
     35 /**
     36  * Tries to log in a registered user with bitcoin address.
     37  */
     38 case object UserLogin extends State
     39 
     40 /**
     41  * Tries to log in a registered user with bitcoin address.
     42  */
     43 case object PhoneLogin extends State
     44 
     45 /**
     46  * Checks historical transactions related to a user.
     47  */
     48 case object HistoryAudit extends State
     49 
     50 /**
     51  * When user reaches buying limit
     52  */
     53 case object LimitReached extends State with Screen
     54 
     55 /**
     56  * In the process of creating a transaction.
     57  */
     58 case object TxCreate extends State
     59 
     60 /**
     61  * Ready for the user to insert their cash.
     62  */
     63 case object CashInsert extends State with Screen
     64 
     65 /**
     66  * Checks if bill inserted should be accepted.
     67  */
     68 case object CashValidate extends State
     69 
     70 /**
     71  * Sending the bitcoin.
     72  */
     73 case object Sending extends State with Screen
     74 
     75 /**
     76  * Screen where user can input their email to get
     77  * a copy of the transaction.
     78  */
     79 case object Receipt extends State with Screen
     80 
     81 /**
     82  * Something bad occurred that interrupted the buying process.
     83  * Manual assistance will be provided for the user.
     84  */
     85 case object ErrorState extends State with Screen
     86 
     87 /**
     88  * There are insufficient funds in the bitcoin wallet.
     89  */
     90 case object InsufficientFunds extends State with Screen
     91 
     92 /**
     93  * Something is wrong and the machine cannot be used.
     94  */
     95 case object Malfunctioning extends State with Screen
     96 
     97 /**
     98  * The network is out.
     99  */
    100 case object NetworkOutage extends State with Screen
    101 
    102 /**
    103  * Thank you message.
    104  */
    105 case object ThankYou extends State with Screen
    106 
    107 /**
    108  * Ad message.
    109  */
    110 case object Ad extends State with Screen