Fix creating ads with the incorrect provider when not whitelisted
This commit is contained in:
parent
059c723cc1
commit
af65433c55
|
@ -685,22 +685,21 @@ class LocalPlatformClient(ABC):
|
||||||
to_return = []
|
to_return = []
|
||||||
for asset, countrycode, currency, provider in dist_list:
|
for asset, countrycode, currency, provider in dist_list:
|
||||||
if (asset, countrycode, currency, provider) not in our_ads:
|
if (asset, countrycode, currency, provider) not in our_ads:
|
||||||
if currency in supported_currencies:
|
if currency not in supported_currencies:
|
||||||
if currency not in account_info:
|
continue
|
||||||
continue
|
# Create the actual ad and pass in all the stuff
|
||||||
# Create the actual ad and pass in all the stuff
|
rtrn = await self.create_ad(
|
||||||
rtrn = await self.create_ad(
|
asset,
|
||||||
asset,
|
countrycode,
|
||||||
countrycode,
|
currency,
|
||||||
currency,
|
provider,
|
||||||
provider,
|
payment_details=account_info[currency],
|
||||||
payment_details=account_info[currency],
|
ad=ad,
|
||||||
ad=ad,
|
)
|
||||||
)
|
# Bail on first error, let's not continue
|
||||||
# Bail on first error, let's not continue
|
if rtrn is False:
|
||||||
if rtrn is False:
|
return False
|
||||||
return False
|
to_return.append(rtrn)
|
||||||
to_return.append(rtrn)
|
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
async def redist_countries(self, ad):
|
async def redist_countries(self, ad):
|
||||||
|
@ -1141,9 +1140,9 @@ class LocalPlatformClient(ABC):
|
||||||
distlist.append([l_currency, l_country])
|
distlist.append([l_currency, l_country])
|
||||||
|
|
||||||
# Iterate providers like REVOLUT, NATIONAL_BANK
|
# Iterate providers like REVOLUT, NATIONAL_BANK
|
||||||
for provider in self.instance.ads_providers:
|
for provider in ad.providers:
|
||||||
# Iterate assets like XMR, BTC
|
# Iterate assets like XMR, BTC
|
||||||
for asset in self.instance.ads_assets:
|
for asset in ad.assets:
|
||||||
# Iterate pairs of currency and country like EUR, GB
|
# Iterate pairs of currency and country like EUR, GB
|
||||||
for currency, countrycode in distlist:
|
for currency, countrycode in distlist:
|
||||||
if filter_asset:
|
if filter_asset:
|
||||||
|
|
|
@ -246,6 +246,14 @@ class Ad(models.Model):
|
||||||
visible = models.BooleanField(default=True)
|
visible = models.BooleanField(default=True)
|
||||||
enabled = models.BooleanField(default=True)
|
enabled = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def providers(self):
|
||||||
|
return [x.code for x in self.provider_list.all()]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def assets(self):
|
||||||
|
return [x.code for x in self.asset_list.all()]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_by_id(cls, ad_id, user):
|
def get_by_id(cls, ad_id, user):
|
||||||
return cls.objects.filter(id=ad_id, user=user, enabled=True).first()
|
return cls.objects.filter(id=ad_id, user=user, enabled=True).first()
|
||||||
|
|
Loading…
Reference in New Issue