Address syntax issues and convert release_trade to async
This commit is contained in:
@@ -61,7 +61,7 @@ class AgoraDesk:
|
||||
try:
|
||||
text = yield response.content()
|
||||
except: # noqa
|
||||
self.log.error(f"Error with API call")
|
||||
self.log.error("Error with API call")
|
||||
return
|
||||
try:
|
||||
result["response"] = json.loads(text)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Twisted/Klein imports
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
# Other library imports
|
||||
from json import dumps
|
||||
from random import choices
|
||||
@@ -95,7 +98,7 @@ class Transactions(util.Base):
|
||||
# Amount is reliable here as it is checked by find_trade, so no need for stored_trade["amount"]
|
||||
if float(amount_usd) > float(settings.Agora.AcceptableAltLookupUSD):
|
||||
self.log.info("Not checking against amount and currency as amount exceeds MAX")
|
||||
self.irc.sendmsg(f"Not checking against amount and currency as amount exceeds MAX")
|
||||
self.irc.sendmsg("Not checking against amount and currency as amount exceeds MAX")
|
||||
# Close here if the amount exceeds the allowable limit for no reference
|
||||
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "EXCEEDS_MAX")
|
||||
return False
|
||||
@@ -166,6 +169,7 @@ class Transactions(util.Base):
|
||||
return False
|
||||
return True
|
||||
|
||||
@inlineCallbacks
|
||||
def transaction(self, data):
|
||||
"""
|
||||
Store details of transaction and post notifications to IRC.
|
||||
@@ -252,8 +256,9 @@ class Transactions(util.Base):
|
||||
# self.log.error(f"Cannot release trade {reference}.")
|
||||
# return
|
||||
|
||||
self.release_funds(stored_trade["id"], stored_trade["reference"])
|
||||
yield self.release_funds(stored_trade["id"], stored_trade["reference"])
|
||||
|
||||
@inlineCallbacks
|
||||
def release_funds(self, trade_id, reference):
|
||||
stored_trade = db.get_ref(reference)
|
||||
platform = stored_trade["subclass"]
|
||||
@@ -267,7 +272,7 @@ class Transactions(util.Base):
|
||||
release = self.lbtc.release_funds
|
||||
post_message = self.lbtc.api.contact_message_post
|
||||
|
||||
rtrn = release(trade_id)
|
||||
rtrn = yield release(trade_id)
|
||||
if rtrn["message"] == "OK":
|
||||
post_message(trade_id, "Thanks! Releasing now :)")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user