def delete_voucher_from_user_wallet(context, username, user_id): LoggerManager.general_logs( f"Removing voucher from user {username} ({user_id})'s wallet now") user_selected_voucher_id_in_wallet = context.user_data[user_id]['user_selected_voucher'][0] response_result = UserManager.delete_voucher_from_user_wallet( user_selected_voucher_id_in_wallet) if not response_result: return voucher_id_in_db = context.user_data[user_id]['user_selected_voucher'][1] response_result = UserManager.update_user_voucher_history(user_id, 'claimed', voucher_id_in_db) if not response_result: return LoggerManager.general_logs( f"Voucher removed from user {username} ({user_id})'s wallet!") return True
def remove_expired_voucher_from_db(user_id, user_asset_id, voucher_id): UserManager.update_user_voucher_history(user_id, 'expired', voucher_id) UserManager.delete_voucher_from_user_wallet(user_asset_id)