From 1827bf5fff5852bc373fc48207c8110bfa527f61 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 16 Mar 2022 18:52:36 +0000 Subject: [PATCH] Move common ad details to dedicated config section --- handler/sources/agora.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/handler/sources/agora.py b/handler/sources/agora.py index c4b9349..a829487 100644 --- a/handler/sources/agora.py +++ b/handler/sources/agora.py @@ -458,7 +458,7 @@ class Agora(util.Base): """ Format the ad. """ - ad = settings.Agora.Ad + ad = settings.Platform.Ad # Substitute the currency ad = ad.replace("$CURRENCY$", currency) @@ -477,7 +477,7 @@ class Agora(util.Base): """ Format the payment details. """ - payment = settings.Agora.PaymentDetails + payment = settings.Platform.PaymentDetails payment_text = "" for field, value in payment_details.items(): @@ -545,7 +545,7 @@ class Agora(util.Base): "track_max_amount": False, "require_trusted_by_advertiser": False, "online_provider": provider, - "payment_method_details": settings.Agora.PaymentMethodDetails, + "payment_method_details": settings.Platform.PaymentMethodDetails, } if visible is False: form["visible"] = False @@ -637,6 +637,9 @@ class Agora(util.Base): :return: response dict :rtype: dict """ + if settings.Agora.Dummy == "1": + self.log.error(f"Running in dummy mode, not releasing funds for {contact_id}") + return payload = {"tradeId": contact_id, "password": settings.Agora.Pass} rtrn = self.agora._api_call(api_method=f"contact_release/{contact_id}", http_method="POST", query_values=payload) @@ -652,33 +655,26 @@ class Agora(util.Base): Withdraw excess funds to our XMR wallets. """ totals_all = self.tx.get_total() - print("totals_all", totals_all) if totals_all is False: return False wallet_xmr, _ = totals_all[2] - print("wallet_xmr", wallet_xmr) # Get the wallet balances in USD total_usd = totals_all[0][1] - print("total_usd", total_usd) - total_trades_usd = self.tx.get_open_trades_usd() - print("UNUSED total_trades_usd", total_trades_usd) + # total_trades_usd = self.tx.get_open_trades_usd() if not total_usd: return False # total_usd += total_trades_usd # print("total_usd after trades add", total_usd) profit_usd = total_usd - float(settings.Money.BaseUSD) - print("profit_usd", profit_usd) # Get the XMR -> USD exchange rate xmr_usd = self.cg.get_price(ids="monero", vs_currencies=["USD"]) - print("xmr_usd", xmr_usd) # Convert the USD total to XMR profit_usd_in_xmr = float(profit_usd) / xmr_usd["monero"]["usd"] - print("profit_usd_in_xmr", profit_usd_in_xmr) # Check profit is above zero if not profit_usd >= 0: @@ -696,10 +692,8 @@ class Agora(util.Base): return half = profit_usd_in_xmr / 2 - print("half", half) half_rounded = round(half, 8) - print("half_rounded", half_rounded) # Read OTP secret with open("otp.key", "r") as f: