示例#1
0
    def deposit(self, amount, name="self"):

        target_name = name if name != "self" else self.logged_user

        original_balance = pymysql_lib.get_balance(target_name)[0]['balance']
        bal = int(original_balance) + amount

        pymysql_lib.alter_balance(target_name, bal)
        pymysql_lib.transaction_log(name, amount, 'none', 1)
        print("Deposit Successfull...!")
示例#2
0
    def withdraw(self, amount):

        data = pymysql_lib.fetch_user_details(self.logged_user)

        mybalance = data[0]['balance']
        if mybalance < amount:
            print("Insufficient Balance!!!")
        else:
            newbalance = mybalance - amount
            pymysql_lib.alter_balance(self.logged_user, newbalance)
            pymysql_lib.transaction_log(self.logged_user, amount, 'none', 2)
            print("Withdrawal Successful!!")
示例#3
0
    def withdraw(self, amount, name="self", comment="none", should_log=True):

        target_name = name if name != "self" else self.logged_user

        original_balance = pymysql_lib.get_balance(target_name)[0]['balance']
        bal = int(original_balance) - amount

        pymysql_lib.alter_balance(target_name, bal)

        if should_log:
            pymysql_lib.create_log(target_name,
                                   target_name,
                                   amount,
                                   comment,
                                   type='withdrawal')

        print("withdrawal Successfull...!")
示例#4
0
    def deposit(self, amount, name="self", comment='none', should_log=True):

        target_name = name if name != "self" else self.logged_user

        original_balance = pymysql_lib.get_balance(target_name)[0]['balance']
        bal = int(original_balance) + amount

        pymysql_lib.alter_balance(target_name, bal)

        if should_log:

            pymysql_lib.create_log(target_name,
                                   target_name,
                                   amount,
                                   comment,
                                   type='deposit')

        print("Deposit Successfull...!")