Add provider to trade information
This commit is contained in:
parent
b88f49b6ae
commit
d9f55ce497
|
@ -130,9 +130,10 @@ class Agora(object):
|
|||
elif asset == "BTC":
|
||||
amount_crypto = contact["data"]["amount_btc"]
|
||||
currency = contact["data"]["currency"]
|
||||
provider = contact["data"]["advertisement"]["payment_method"]
|
||||
if not contact["data"]["is_selling"]:
|
||||
continue
|
||||
rtrn.append(f"{reference}: {buyer} {amount}{currency} {amount_crypto}{asset}")
|
||||
rtrn.append(f"{reference}: {buyer} {amount}{currency} {provider} {amount_crypto}{asset}")
|
||||
return rtrn
|
||||
|
||||
def dashboard_hook(self, dash):
|
||||
|
@ -152,6 +153,7 @@ class Agora(object):
|
|||
buyer = contact["data"]["buyer"]["username"]
|
||||
amount = contact["data"]["amount"]
|
||||
asset = contact["data"]["advertisement"]["asset"]
|
||||
provider = contact["data"]["advertisement"]["payment_method"]
|
||||
if asset == "XMR":
|
||||
amount_crypto = contact["data"]["amount_xmr"]
|
||||
elif asset == "BTC":
|
||||
|
@ -160,12 +162,12 @@ class Agora(object):
|
|||
if not contact["data"]["is_selling"]:
|
||||
continue
|
||||
if reference not in self.last_dash:
|
||||
reference = self.tx.new_trade(asset, contact_id, buyer, currency, amount, amount_crypto)
|
||||
reference = self.tx.new_trade(asset, contact_id, buyer, currency, amount, amount_crypto, provider)
|
||||
if reference:
|
||||
if reference not in current_trades:
|
||||
current_trades.append(reference)
|
||||
# Let us know there is a new trade
|
||||
self.irc.sendmsg(f"AUTO {reference}: {buyer} {amount}{currency} {amount_crypto}{asset}")
|
||||
self.irc.sendmsg(f"AUTO {reference}: {buyer} {amount}{currency} {provider} {amount_crypto}{asset}")
|
||||
# Note that we have seen this reference
|
||||
self.last_dash.add(reference)
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class Transactions(object):
|
|||
if not stored_trade:
|
||||
self.log.error("Could not find entry in DB for typeless transaction: {id}", id=txid)
|
||||
return
|
||||
print("BEFORE CONVERT STORED TRADE", stored_trade)
|
||||
stored_trade = convert(stored_trade)
|
||||
if "old_state" in inside:
|
||||
if "new_state" in inside:
|
||||
|
@ -240,7 +241,7 @@ class Transactions(object):
|
|||
message_long = rtrn["response"]["data"]["message"]
|
||||
self.irc.sendmsg(f"{message} - {message_long}")
|
||||
|
||||
def new_trade(self, asset, trade_id, buyer, currency, amount, amount_crypto):
|
||||
def new_trade(self, asset, trade_id, buyer, currency, amount, amount_crypto, provider):
|
||||
"""
|
||||
Called when we have a new trade in Agora.
|
||||
Store details in Redis, generate a reference and optionally let the customer know the reference.
|
||||
|
@ -258,6 +259,7 @@ class Transactions(object):
|
|||
"amount": amount,
|
||||
"amount_crypto": amount_crypto,
|
||||
"reference": reference,
|
||||
"provider": provider,
|
||||
}
|
||||
self.log.info("Storing trade information: {info}", info=str(to_store))
|
||||
r.hmset(f"trade.{reference}", to_store)
|
||||
|
|
Loading…
Reference in New Issue