Arc
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
12 deletions
-
lnbits/__init__.py
|
@ -380,22 +380,14 @@ def api_checkinvoice(payhash): |
|
|
if request.headers["Content-Type"] != "application/json": |
|
|
if request.headers["Content-Type"] != "application/json": |
|
|
return jsonify({"ERROR": "MUST BE JSON"}), 400 |
|
|
return jsonify({"ERROR": "MUST BE JSON"}), 400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with open_db() as db: |
|
|
with open_db() as db: |
|
|
payment = db.fetchone( |
|
|
payment = db.fetchall("SELECT * FROM apipayments WHERE payhash = ?", (payhash,)) |
|
|
""" |
|
|
|
|
|
SELECT pending |
|
|
|
|
|
FROM apipayments |
|
|
|
|
|
INNER JOIN wallets AS w ON apipayments.wallet = w.id |
|
|
|
|
|
WHERE payhash = ? |
|
|
|
|
|
AND (w.adminkey = ? OR w.inkey = ?) |
|
|
|
|
|
""", |
|
|
|
|
|
(payhash, request.headers["Grpc-Metadata-macaroon"], request.headers["Grpc-Metadata-macaroon"]), |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if not payment: |
|
|
if not payment: |
|
|
return jsonify({"ERROR": "NO INVOICE"}), 404 |
|
|
return jsonify({"ERROR": "NO INVOICE"}), 404 |
|
|
|
|
|
|
|
|
if not payment["pending"]: # pending |
|
|
if not payment[0][4]: # pending |
|
|
return jsonify({"PAID": "TRUE"}), 200 |
|
|
return jsonify({"PAID": "TRUE"}), 200 |
|
|
|
|
|
|
|
|
if not WALLET.get_invoice_status(payhash).settled: |
|
|
if not WALLET.get_invoice_status(payhash).settled: |
|
|