Beispiel #1
0
    def transfer(self, amount, target, comment):

        self.withdraw(amount, should_log=False)

        self.deposit(amount, target, should_log=False)

        pymysql_lib.create_log(self.logged_user,
                               target,
                               amount,
                               comment,
                               type='transfer')
Beispiel #2
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...!")
Beispiel #3
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...!")