Properly handle ad substitutions
This commit is contained in:
parent
7e42bbebf3
commit
835307b217
|
@ -455,14 +455,19 @@ class Agora(object):
|
|||
"""
|
||||
ad = settings.Agora.Ad
|
||||
paymentdetails = settings.Agora.PaymentDetails
|
||||
|
||||
# Substitute the currency
|
||||
ad = ad.replace("$CURRENCY$", currency)
|
||||
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)
|
||||
else:
|
||||
adtext = ad.replace("$PAYMENT$", settings.Agora.DefaultDetailsAd)
|
||||
ad = ad.replace("$PAYMENT$", settings.Agora.DefaultDetailsAd)
|
||||
paymentdetailstext = paymentdetails.replace("$PAYMENT$", settings.Agora.DefaultDetailsPayment)
|
||||
|
||||
# Substitute the asset
|
||||
ad = ad.replace("$ASSET$", asset)
|
||||
|
||||
rates = self.get_rates_all()
|
||||
if asset == "XMR":
|
||||
min_usd = float(settings.Agora.MinUSDXMR)
|
||||
|
@ -478,7 +483,8 @@ class Agora(object):
|
|||
max_amount = rates[currency] * max_usd
|
||||
price_formula = f"coingecko{asset.lower()}usd*usd{currency.lower()}*{settings.Agora.Margin}"
|
||||
# price_formula = f"coingeckoxmrusd*{settings.Agora.Margin}"
|
||||
ad = settings.Agora.Ad
|
||||
|
||||
# Remove extra tabs
|
||||
ad = ad.replace("\\t", "\t")
|
||||
|
||||
form = {"country_code": countrycode,
|
||||
|
@ -489,7 +495,7 @@ class Agora(object):
|
|||
"track_max_amount": False,
|
||||
"require_trusted_by_advertiser": False,
|
||||
"online_provider": "REVOLUT",
|
||||
"msg": adtext,
|
||||
"msg": ad,
|
||||
"min_amount": min_amount,
|
||||
"max_amount": max_amount,
|
||||
"payment_method_details": settings.Agora.PaymentMethodDetails,
|
||||
|
|
Loading…
Reference in New Issue