コード例 #1
0
ファイル: atm.py プロジェクト: EngineersBox/Pybank
 def deposit(bsb, accnum, amount):
     if ini_config.checkSec(bsb + " " + accnum) == True:
         camt = int(ini_config.getValue(str(bsb + " " + accnum), "bal"))
         ini_config.writeValue(str(bsb + " " + accnum), "bal", str(camt + amount))
         print("Deposited: $" + str(amount))
         print("Account Balance: $" + str(camt + amount))
     else:
         print("Invalid account details")
コード例 #2
0
ファイル: atm.py プロジェクト: EngineersBox/Pybank
 def withdraw(bsb, accnum, amount):
     if ini_config.checkSec(bsb + " " + accnum) == True and int(ini_config.getValue(str(bsb + " " + accnum), "bal")) >= amount:
         camt = int(ini_config.getValue(str(bsb + " " + accnum), "bal"))
         ini_config.writeValue(str(bsb + " " + accnum), "bal", str(camt - amount))
         print("Withdrawn: $" + str(amount))
         print("Account Balance: $" + str(camt - amount))
     else:
         print("Invalid account details or amount")
コード例 #3
0
ファイル: accounts.py プロジェクト: EngineersBox/Pybank
 def __init__(self, acctype, bsb, accnum, userid, passwd):
     if accountType.trykey(acctype) == True:
         self.acctype = acctype
     else:
         self.acctype = 'savings'
     self.bsb = bsb
     self.accnum = accnum
     self.userid = userid
     self.passwd = msgEnc.encMsg(newKey, passwd).decode('utf-8')[:-2]
     self.balance = 0
     self.section = self.bsb + " " + self.accnum
     ini_config.writeValue(self.section, "inherits", "account")
     ini_config.writeValue(self.section, "acctype", self.acctype)
     ini_config.writeValue(self.section, "uid", self.userid)
     ini_config.writeValue(self.section, "pwd", self.passwd)
     ini_config.writeValue(self.section, "bal", str(self.balance))
コード例 #4
0
ファイル: accounts.py プロジェクト: EngineersBox/Pybank
 def setbal(self, bal, password):
     if self.passwd == password:
         self.balance = bal
         ini_config.writeValue(self.section, "bal", str(self.balance))
     else:
         pass
コード例 #5
0
ファイル: accounts.py プロジェクト: EngineersBox/Pybank
 def rembal(self, count):
     self.balance -= count
     ini_config.writeValue(self.section, "bal", str(self.balance))
コード例 #6
0
ファイル: accounts.py プロジェクト: EngineersBox/Pybank
 def change_passwd(self, oldpass, newpass=gens.id_gen(10)):
     if self.passwd == msgEnc.encMsg(newKey, oldpass).decode('utf-8')[:-2]:
         self.passwd = msgEnc.encMsg(newKey, newpass).decode('utf-8')[:-2]
         ini_config.writeValue(self.secion, 'pwd', str(self.passwd))
     else:
         print("Error: Passwords do not match")