Finish implementation and tests for the cheat system #3

Closed
m wants to merge 67 commits from cheat-refactor into master
1 changed files with 10 additions and 4 deletions
Showing only changes of commit 835307b217 - Show all commits

View File

@ -455,14 +455,19 @@ class Agora(object):
""" """
ad = settings.Agora.Ad ad = settings.Agora.Ad
paymentdetails = settings.Agora.PaymentDetails paymentdetails = settings.Agora.PaymentDetails
# Substitute the currency
ad = ad.replace("$CURRENCY$", currency) ad = ad.replace("$CURRENCY$", currency)
if countrycode == "GB" and currency == "GBP": if countrycode == "GB" and currency == "GBP":
adtext = ad.replace("$PAYMENT$", settings.Agora.GBPDetailsAd) ad = ad.replace("$PAYMENT$", settings.Agora.GBPDetailsAd)
paymentdetailstext = paymentdetails.replace("$PAYMENT$", settings.Agora.GBPDetailsPayment) paymentdetailstext = paymentdetails.replace("$PAYMENT$", settings.Agora.GBPDetailsPayment)
else: else:
adtext = ad.replace("$PAYMENT$", settings.Agora.DefaultDetailsAd) ad = ad.replace("$PAYMENT$", settings.Agora.DefaultDetailsAd)
paymentdetailstext = paymentdetails.replace("$PAYMENT$", settings.Agora.DefaultDetailsPayment) paymentdetailstext = paymentdetails.replace("$PAYMENT$", settings.Agora.DefaultDetailsPayment)
# Substitute the asset
ad = ad.replace("$ASSET$", asset) ad = ad.replace("$ASSET$", asset)
rates = self.get_rates_all() rates = self.get_rates_all()
if asset == "XMR": if asset == "XMR":
min_usd = float(settings.Agora.MinUSDXMR) min_usd = float(settings.Agora.MinUSDXMR)
@ -478,7 +483,8 @@ class Agora(object):
max_amount = rates[currency] * max_usd max_amount = rates[currency] * max_usd
price_formula = f"coingecko{asset.lower()}usd*usd{currency.lower()}*{settings.Agora.Margin}" price_formula = f"coingecko{asset.lower()}usd*usd{currency.lower()}*{settings.Agora.Margin}"
# price_formula = f"coingeckoxmrusd*{settings.Agora.Margin}" # price_formula = f"coingeckoxmrusd*{settings.Agora.Margin}"
ad = settings.Agora.Ad
# Remove extra tabs
ad = ad.replace("\\t", "\t") ad = ad.replace("\\t", "\t")
form = {"country_code": countrycode, form = {"country_code": countrycode,
@ -489,7 +495,7 @@ class Agora(object):
"track_max_amount": False, "track_max_amount": False,
"require_trusted_by_advertiser": False, "require_trusted_by_advertiser": False,
"online_provider": "REVOLUT", "online_provider": "REVOLUT",
"msg": adtext, "msg": ad,
"min_amount": min_amount, "min_amount": min_amount,
"max_amount": max_amount, "max_amount": max_amount,
"payment_method_details": settings.Agora.PaymentMethodDetails, "payment_method_details": settings.Agora.PaymentMethodDetails,