def deposit(self, money): if(money <= 1000000): Transaction.create(self, money, tran_type = "Deposit"); self.__balance += money self.updateDBAccountBalance() print("Successfully deposited " + str(money) + " to account " + self.get_cust_id()) else: print("Sorry! Max Deposit limit(at a time) is 1 Million.")
def withdraw(self, money): if(super(CurrentAccount, self).get_balance() - money >= CurrentAccount.min_balance): Transaction.create(self, money, tran_type = "Withdraw"); new_bal = super(CurrentAccount, self).get_balance() - money super(CurrentAccount, self).set_balance(new_bal) super(CurrentAccount, self).updateDBAccountBalance() print("Successfully Withdrawn " + str(money) + " from account " + super(CurrentAccount, self).get_cust_id()) else: print("Not Have Enough Balance to Complete this transaction.Minimum Balance should be "+str(CurrentAccount.min_balance))
def withdraw(self, money): print("Inside Account Withdraw") if(self.__balance - money >= 0): Transaction.create(self, money, tran_type = "Withdraw"); self.__balance -= money self.updateDBAccountBalance() print("Successfully Withdrawn " + str(money) + " from account " + self.get_cust_id()) else: print("Not Have Enough Balance to Complete this transaction.")
def transfer(user_account, to_account, money): if(user_account.get_balance() - money > 0): new_account = Util.get_db_account(to_account) if(new_account != None): Transaction.create(new_account, money, tran_type = "Transfer", add = True, account_id = user_account.get_cust_id()) new_account.set_balance(new_account.get_balance() + money) new_account.updateDBAccountBalance() Transaction.create(user_account, money, tran_type = "Transfer", add = False, account_id = to_account) user_account.set_balance(user_account.get_balance() - money) user_account.updateDBAccountBalance() print(str(money)+" has been transferred to "+str(to_account)) else: print("Recipient Account Not Found") print("Please Check the Recipient Account Number.")