|
@ -140,9 +140,9 @@ def get_wallet_payment(wallet_id: str, checking_id: str) -> Optional[Payment]: |
|
|
with open_db() as db: |
|
|
with open_db() as db: |
|
|
row = db.fetchone( |
|
|
row = db.fetchone( |
|
|
""" |
|
|
""" |
|
|
SELECT payhash as checking_id, amount, fee, pending, memo, time |
|
|
SELECT id as checking_id, amount, fee, pending, memo, time |
|
|
FROM apipayments |
|
|
FROM apipayment |
|
|
WHERE wallet = ? AND payhash = ? |
|
|
WHERE wallet = ? AND id = ? |
|
|
""", |
|
|
""", |
|
|
(wallet_id, checking_id), |
|
|
(wallet_id, checking_id), |
|
|
) |
|
|
) |
|
@ -159,8 +159,8 @@ def get_wallet_payments(wallet_id: str, *, include_all_pending: bool = False) -> |
|
|
|
|
|
|
|
|
rows = db.fetchall( |
|
|
rows = db.fetchall( |
|
|
f""" |
|
|
f""" |
|
|
SELECT payhash as checking_id, amount, fee, pending, memo, time |
|
|
SELECT id as checking_id, amount, fee, pending, memo, time |
|
|
FROM apipayments |
|
|
FROM apipayment |
|
|
WHERE wallet = ? AND {clause} |
|
|
WHERE wallet = ? AND {clause} |
|
|
ORDER BY time DESC |
|
|
ORDER BY time DESC |
|
|
""", |
|
|
""", |
|
@ -175,7 +175,7 @@ def delete_wallet_payments_expired(wallet_id: str, *, seconds: int = 86400) -> N |
|
|
db.execute( |
|
|
db.execute( |
|
|
""" |
|
|
""" |
|
|
DELETE |
|
|
DELETE |
|
|
FROM apipayments WHERE wallet = ? AND pending = 1 AND time < strftime('%s', 'now') - ? |
|
|
FROM apipayment WHERE wallet = ? AND pending = 1 AND time < strftime('%s', 'now') - ? |
|
|
""", |
|
|
""", |
|
|
(wallet_id, seconds), |
|
|
(wallet_id, seconds), |
|
|
) |
|
|
) |
|
@ -191,7 +191,7 @@ def create_payment( |
|
|
with open_db() as db: |
|
|
with open_db() as db: |
|
|
db.execute( |
|
|
db.execute( |
|
|
""" |
|
|
""" |
|
|
INSERT INTO apipayments (wallet, id, payment_hash, amount, pending, memo, fee) |
|
|
INSERT INTO apipayment (wallet, id, payment_hash, amount, pending, memo, fee) |
|
|
VALUES (?, ?, ?, ?, ?, ?) |
|
|
VALUES (?, ?, ?, ?, ?, ?) |
|
|
""", |
|
|
""", |
|
|
(wallet_id, checking_id, payment_hash, amount, int(pending), memo, fee), |
|
|
(wallet_id, checking_id, payment_hash, amount, int(pending), memo, fee), |
|
@ -205,17 +205,17 @@ def create_payment( |
|
|
|
|
|
|
|
|
def update_payment_status(checking_id: str, pending: bool) -> None: |
|
|
def update_payment_status(checking_id: str, pending: bool) -> None: |
|
|
with open_db() as db: |
|
|
with open_db() as db: |
|
|
db.execute("UPDATE apipayments SET pending = ? WHERE id = ?", (int(pending), checking_id,)) |
|
|
db.execute("UPDATE apipayment SET pending = ? WHERE id = ?", (int(pending), checking_id,)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_payment(checking_id: str) -> None: |
|
|
def delete_payment(checking_id: str) -> None: |
|
|
with open_db() as db: |
|
|
with open_db() as db: |
|
|
db.execute("DELETE FROM apipayments WHERE id = ?", (checking_id,)) |
|
|
db.execute("DELETE FROM apipayment WHERE id = ?", (checking_id,)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check_internal(payment_hash: str) -> None: |
|
|
def check_internal(payment_hash: str) -> None: |
|
|
with open_db() as db: |
|
|
with open_db() as db: |
|
|
row = db.fetchone("SELECT * FROM apipayments WHERE payment_hash = ?", (payment_hash,)) |
|
|
row = db.fetchone("SELECT * FROM apipayment WHERE payment_hash = ?", (payment_hash,)) |
|
|
if not row: |
|
|
if not row: |
|
|
return False |
|
|
return False |
|
|
else: |
|
|
else: |
|
|