bitcoin-atm

bitcoin atm for pyc inc.

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

System.scala

(2852B)


      1 package inc.pyc.chimera
      2 
      3 import akka.actor._
      4 import com.typesafe.config._
      5 import inc.pyc.currency._
      6 import com.coiney.akka.mailer.MailerSystem
      7 
      8 /**
      9  * System Configurations.
     10  */
     11 object System {
     12   
     13   /**
     14    * Main Actor System
     15    */
     16   implicit val system = ActorSystem("ChimeraSystem", ConfigFactory.load())
     17 
     18   /**
     19    * The main currency being accepted by this machine.
     20    */
     21   val currency = findCurrency(Settings(system).currency)
     22   
     23   /**
     24    * Event Bus for Chimera internal to client comets.
     25    */
     26   val client = new LookupSystem
     27   
     28   /**
     29    * The heart of Chimera: a finite state machine that 
     30    * manages how data flows to the client.
     31    */
     32   lazy val overlord = system.actorOf(Props[Overlord], "Overlord")
     33 }
     34 
     35 /**
     36  * System settings from configuration files.
     37  */
     38 class SettingsImpl(config: Config) extends Extension {
     39   val chimera         = config getConfig "chimera"
     40   val guid            = chimera getString "guid"
     41   val secret          = chimera getString "secret"
     42   val name            = chimera getString "name"
     43   val currency        = chimera getString "currency"
     44   val userDb          = chimera getString "userDb"
     45   val adProductName   = chimera getString "ad.productName"
     46   val adProductMsg    = chimera getString "ad.productMsg"
     47   val awsAccess       = chimera getString "aws.accessKey"
     48   val awsSecret       = chimera getString "aws.secretKey"
     49   val techPhone       = chimera getString "techsupport.phone"
     50   val techEmail       = chimera getString "techsupport.email"
     51   val twilioSid       = chimera getString "twilio.sid"
     52   val twilioToken     = chimera getString "twilio.token"
     53   val twilioPhone     = chimera getString "twilio.phone"
     54   val twitter         = chimera getString "twitter"
     55   val facebook        = chimera getString "facebook"
     56   val gplus           = chimera getString "gplus"
     57   val walletService   = config getString  "bitcoin.wallet"
     58   val tickerService   = config getString  "bitcoin.ticker"
     59   val smtpSender      = config getString "mailer.smtp.from.name"
     60   val smtpEmail       = config getString "mailer.smtp.from.email"
     61 }
     62 
     63 object Settings extends ExtensionId[SettingsImpl] 
     64   with ExtensionIdProvider {
     65 
     66   override def lookup = Settings
     67 
     68   override def createExtension(system: ExtendedActorSystem) =
     69     new SettingsImpl(system.settings.config)
     70 
     71   override def get(system: ActorSystem): SettingsImpl = super.get(system)
     72 }
     73 
     74 /**
     75  * System configurations.
     76  * 
     77  * @param name name of the store or location
     78  * @param currency currency accepted
     79  * @param techPhone phone number for tech support
     80  * @param techEmail email address for tech support
     81  */
     82 case class SystemConfig(
     83     name: String,
     84     adImage: String,
     85     adProductName: String,
     86     adProductMsg: String,
     87     currency: Currency,
     88     currencySymbol: String,
     89     techPhone: String, 
     90     techEmail: String,
     91     phoneVerifiedBuyLimit: Int,
     92     maxBuyLimit: Int
     93 )