Crud webhook amount (#474)
* get_standalone_payment selects only incoming tx
This commit is contained in:
+5
-3
@@ -30,7 +30,8 @@ async def get_account(
|
||||
user_id: str, conn: Optional[Connection] = None
|
||||
) -> Optional[User]:
|
||||
row = await (conn or db).fetchone(
|
||||
"SELECT id, email, pass as password FROM accounts WHERE id = ?", (user_id,)
|
||||
"SELECT id, email, pass as password FROM accounts WHERE id = ?", (
|
||||
user_id,)
|
||||
)
|
||||
|
||||
return User(**row) if row else None
|
||||
@@ -184,7 +185,7 @@ async def get_standalone_payment(
|
||||
"""
|
||||
SELECT *
|
||||
FROM apipayments
|
||||
WHERE checking_id = ? OR hash = ?
|
||||
WHERE (checking_id = ? OR hash = ?) AND amount > 0 -- only the incoming payment
|
||||
LIMIT 1
|
||||
""",
|
||||
(checking_id_or_hash, checking_id_or_hash),
|
||||
@@ -304,7 +305,8 @@ async def delete_expired_invoices(conn: Optional[Connection] = None,) -> None:
|
||||
except:
|
||||
continue
|
||||
|
||||
expiration_date = datetime.datetime.fromtimestamp(invoice.date + invoice.expiry)
|
||||
expiration_date = datetime.datetime.fromtimestamp(
|
||||
invoice.date + invoice.expiry)
|
||||
if expiration_date > datetime.datetime.utcnow():
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user