Core: fix internal webhooks (#649)

* fix internal webhooks

* argument annotation
This commit is contained in:
calle
2022-06-03 14:33:31 +02:00
committed by GitHub
parent b03da7b9c2
commit 906f0166bd
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -180,13 +180,18 @@ async def get_wallet_for_key(
async def get_standalone_payment(
checking_id_or_hash: str, conn: Optional[Connection] = None
checking_id_or_hash: str,
conn: Optional[Connection] = None,
incoming: Optional[bool] = False,
) -> Optional[Payment]:
clause: str = "checking_id = ? OR hash = ?"
if incoming:
clause = f"({clause}) AND amount > 0"
row = await (conn or db).fetchone(
"""
f"""
SELECT *
FROM apipayments
WHERE checking_id = ? OR hash = ?
WHERE {clause}
LIMIT 1
""",
(checking_id_or_hash, checking_id_or_hash),