Port distributing account details to support LBTC

master
Mark Veidemanis 2 years ago
parent 0e4fa8a0bb
commit e5b7f29346
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -181,11 +181,16 @@ class Markets(util.Base):
currency_account_info_map[currency] = account["account_number"] currency_account_info_map[currency] = account["account_number"]
return (supported_currencies, currency_account_info_map) return (supported_currencies, currency_account_info_map)
def distribute_account_details(self, currencies=None, account_info=None): def _distribute_account_details(self, platform, currencies=None, account_info=None):
""" """
Distribute account details for ads. Distribute account details for ads.
We will disable ads we can't support. We will disable ads we can't support.
""" """
if platform == "agora":
caller = self.agora
elif platform == "lbtc":
caller = self.lbtc
if not currencies: if not currencies:
currencies = self.sinks.currencies currencies = self.sinks.currencies
if not account_info: if not account_info:
@ -196,7 +201,7 @@ class Markets(util.Base):
# not_supported = [currency for currency in all_currencies if currency not in supported_currencies] # not_supported = [currency for currency in all_currencies if currency not in supported_currencies]
our_ads = self.agora.enum_ads() our_ads = caller.enum_ads()
supported_ads = [ad for ad in our_ads if ad[3] in supported_currencies] supported_ads = [ad for ad in our_ads if ad[3] in supported_currencies]
@ -216,7 +221,7 @@ class Markets(util.Base):
provider = ad[4] provider = ad[4]
payment_details = currency_account_info_map[currency] payment_details = currency_account_info_map[currency]
ad_id = ad[1] ad_id = ad[1]
self.agora.create_ad( caller.create_ad(
asset, asset,
countrycode, countrycode,
currency, currency,
@ -233,7 +238,7 @@ class Markets(util.Base):
currency = ad[3] currency = ad[3]
provider = ad[4] provider = ad[4]
ad_id = ad[1] ad_id = ad[1]
self.agora.create_ad( caller.create_ad(
asset, asset,
countrycode, countrycode,
currency, currency,
@ -244,6 +249,14 @@ class Markets(util.Base):
ad_id=ad_id, ad_id=ad_id,
) )
def distribute_account_details(self, currencies=None, account_info=None):
"""
Helper to distribute the account details for all platforms.
"""
platforms = ("agora", "lbtc")
for platform in platforms:
self.distribute_account_details(platform, currencies=currencies, account_info=account_info)
def format_ad(self, asset, currency, payment_details_text): def format_ad(self, asset, currency, payment_details_text):
""" """
Format the ad. Format the ad.

Loading…
Cancel
Save