def pay_daily_reward_tx(reward_account, character_coins_account): dest_transfer = Account_transfer.get_by_key_name(str(character_coins_account.key()), parent=reward_account) #str(reward_account.key()) if not dest_transfer: amount = random.randint(25, 75) transfer = accountController.transfer_currency(todays_reward.coins_account, character_coins_account, amount) return transfer return None
def _tx(): dest_transfer = Account_transfer.get_by_key_name(str(source_transfer.key()), parent=source_transfer.counter_account.key()) if not dest_transfer: dest_transfer = Account_transfer( parent = source_transfer.counter_account.key(), key_name = str(source_transfer.key()), self_account = source_transfer.counter_account, counter_account = source_transfer.key().parent(), #same as source_transfer.counter_account counter_transfer = source_transfer, currency_type = source_transfer.currency_type, amount = -source_transfer.amount, is_committed = True) account = Account.get(dest_transfer.self_account.key()) account.balance += source_transfer.amount # add negative amount db.put([account, dest_transfer]) return dest_transfer