Fix LBTC POST message signing

This commit is contained in:
2022-05-10 21:41:16 +01:00
parent 644444c02f
commit b2b7b3b923
4 changed files with 37 additions and 22 deletions

View File

@@ -551,7 +551,7 @@ class Local(util.Base):
}
if self.platform == "agora":
form["asset"] = asset
form["payment_method_details"] = (settings.Platform.PaymentMethodDetails,)
form["payment_method_details"] = settings.Platform.PaymentMethodDetails
form["online_provider"] = provider
elif self.platform == "lbtc":
form["online_provider"] = self.map_provider(provider, reverse=True)
@@ -567,14 +567,13 @@ class Local(util.Base):
form["max_amount"] = round(max_amount, 2)
if self.platform == "lbtc":
form["bank_name"] = bank_name
if edit:
ad = self.api.ad(ad_id=ad_id, **form)
ad = yield self.api.ad(ad_id=ad_id, **form)
else:
ad = self.api.ad_create(**form)
ad = yield self.api.ad_create(**form)
return ad
# TODO: make async
@inlineCallbacks
def dist_countries(self, filter_asset=None):
"""
Distribute our advert into all countries and providers listed in the config.
@@ -583,18 +582,22 @@ class Local(util.Base):
:rtype: bool or dict
"""
dist_list = list(self.markets.create_distribution_list(self.platform, filter_asset))
our_ads = self.enum_ads()
our_ads = yield self.enum_ads()
(
supported_currencies,
account_info,
) = self.markets.get_valid_account_details(self.platform)
# Let's get rid of the ad IDs and make it a tuple like dist_list
our_ads = [(x[0], x[2], x[3], x[4]) for x in our_ads]
if not our_ads:
self.log.error("Could not get our ads.")
return False
to_return = []
for asset, countrycode, currency, provider in dist_list:
if (asset, countrycode, currency, provider) not in our_ads:
if currency in supported_currencies:
# Create the actual ad and pass in all the stuff
rtrn = self.create_ad(
rtrn = yield self.create_ad(
asset,
countrycode,
currency,
@@ -604,9 +607,10 @@ class Local(util.Base):
# Bail on first error, let's not continue
if rtrn is False:
return False
yield rtrn
to_return.append(rtrn)
return to_return
# TODO: make async
@inlineCallbacks
def redist_countries(self):
"""
Redistribute our advert details into all our listed adverts.
@@ -616,7 +620,7 @@ class Local(util.Base):
:return: False or dict with response
:rtype: bool or dict
"""
our_ads = self.enum_ads()
our_ads = yield self.enum_ads()
(
supported_currencies,
account_info,
@@ -624,9 +628,10 @@ class Local(util.Base):
if not our_ads:
self.log.error("Could not get our ads.")
return False
to_return = []
for asset, ad_id, countrycode, currency, provider in our_ads:
if currency in supported_currencies:
rtrn = self.create_ad(
rtrn = yield self.create_ad(
asset,
countrycode,
currency,
@@ -638,7 +643,8 @@ class Local(util.Base):
# Bail on first error, let's not continue
if rtrn is False:
return False
yield (rtrn, ad_id)
to_return.append((rtrn, ad_id))
return to_return
@inlineCallbacks
def strip_duplicate_ads(self):