Implement sender-based anti-fraud system

This commit is contained in:
2022-04-11 20:56:20 +01:00
parent fec536616d
commit 94429d0aaa
6 changed files with 165 additions and 9 deletions

View File

@@ -251,6 +251,27 @@ class IRCCommands(object):
message_long = rtrn["response"]["data"]["message"]
msg(f"{message} - {message_long}")
class map(object):
name = "map"
authed = True
helptext = "Release funds for a trade. Usage: map <reference> <txid>"
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
if length == 2:
reference = spl[1]
txid = spl[2]
is_released = tx.release_map_trade(reference, txid)
if is_released is None:
msg("Trade or TX invalid")
return
elif is_released is True:
msg(f"Trade released")
return
elif is_released is False:
msg(f"Could not release trade")
return
class nuke(object):
name = "nuke"
authed = True
@@ -502,7 +523,7 @@ class IRCCommands(object):
def run(cmd, spl, length, authed, msg, agora, tx, ux):
if length == 2:
account = spl[1]
auth_url = tx.truelayer.create_auth_url(account)
auth_url = tx.sinks.truelayer.create_auth_url(account)
msg(f"Auth URL for {account}: {auth_url}")
class nsignin(object):
@@ -560,13 +581,13 @@ class IRCCommands(object):
transactions = tx.sinks.truelayer.get_transactions(account, account_id)
for transaction in transactions:
txid = transaction["transaction_id"]
ptxid = transaction["meta"]["provider_transaction_id"]
# ptxid = transaction["meta"]["provider_transaction_id"]
txtype = transaction["transaction_type"]
timestamp = transaction["timestamp"]
amount = transaction["amount"]
currency = transaction["currency"]
description = transaction["description"]
msg(f"{timestamp} {txid} {ptxid} {txtype} {amount}{currency} {description}")
msg(f"{timestamp} {txid} {txtype} {amount}{currency} {description}")
class ntransactions(object):
name = "ntransactions"

View File

@@ -44,3 +44,11 @@ class Notify(util.Base):
def notify_release_unsuccessful(self, trade_id):
self.sendmsg(f"Release unsuccessful for {trade_id}", title="Unsuccessful release", tags="tx", priority="5")
def notify_sender_name_mismatch(self, trade_id, platform_username, bank_sender):
self.sendmsg(
f"Sender name mismatch for {trade_id}: Username: {platform_username}, Sender: {bank_sender}",
title="Sender name mismatch",
tags="fraud",
priority="5",
)