def post(self, customer_id):
   abort_if_customer_doesnt_exist(customer_id)
   parser.add_argument('acct_type')
   args = parser.parse_args()
   acct = AccountModel(customer_id=customer_id, acct_type=args['acct_type'])
   S.add(acct)
   return
 def do_1(self, args):
   print "Please enter the following:"
   username_input = raw_input('Username: '******'Password: ')
   c = Customer(username=username_input, password=password_input)
   S.add(c)
   S.commit()
   print self.intro
   return
 def do_2(self, args):
   print "Please choose which customer to add the account for:"
   customers = S.query(Customer).all()
   display_customers()
   customer_index = int(raw_input(">").strip())
   customer = customers[customer_index]
   acct_types = {
     0: 'checking',
     1: 'savings'
   }
   acct_type_prompt = "Please pick what type the account is:\n" + \
                      "  0. Checking\n" + \
                      "  1. Savings\n>"
   acct_type = acct_types[int(raw_input(acct_type_prompt).strip())]
   acct = Account(acct_type=acct_type, balance=0.0, customer=customer)
   S.add(acct)
   S.commit()
   print self.intro
   return
def create_transaction(from_acct=None, to_acct=None, transaction_type=None, amount=0.0, final_balance=None):
  t = Transaction(from_account=from_acct, to_account=to_acct, transaction_type=transaction_type, amount=amount, final_balance=final_balance, date=datetime.utcnow())
  S.add(t)
  S.commit()
def create_transaction(from_acct=None, to_acct=None, transaction_type=None, amount=0.0):
  t = Transaction(from_account=from_acct, to_account=to_acct, transaction_type=transaction_type, amount=amount)
  S.add(t)
  S.commit()
 def post(self):
   args = parser.parse_args()
   c = CustomerModel(username=args['username'], password=args['password'])
   S.add(c)
   S.commit()
   return c.serialize