basic offlineshop functionality.

This commit is contained in:
fiatjaf
2021-03-07 00:08:36 -03:00
parent 88eb8e0e78
commit 732d06c1e5
15 changed files with 842 additions and 8 deletions
+5 -8
View File
@@ -131,14 +131,15 @@ async def get_wallet_for_key(key: str, key_type: str = "invoice") -> Optional[Wa
# ---------------
async def get_standalone_payment(checking_id: str) -> Optional[Payment]:
async def get_standalone_payment(checking_id_or_hash: str) -> Optional[Payment]:
row = await db.fetchone(
"""
SELECT *
FROM apipayments
WHERE checking_id = ?
WHERE checking_id = ? OR payment_hash = ?
LIMIT 1
""",
(checking_id,),
(checking_id_or_hash, checking_id_or_hash),
)
return Payment.from_row(row) if row else None
@@ -285,11 +286,7 @@ async def create_payment(
async def update_payment_status(checking_id: str, pending: bool) -> None:
await db.execute(
"UPDATE apipayments SET pending = ? WHERE checking_id = ?",
(
int(pending),
checking_id,
),
"UPDATE apipayments SET pending = ? WHERE checking_id = ?", (int(pending), checking_id,),
)