From 4219513a8a786e0a203732a2bf2a680f8f6b0432 Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Fri, 9 Apr 2021 00:22:52 +0100 Subject: [PATCH] Cleaned up api --- lnbits/extensions/satspay/crud.py | 7 ++++--- lnbits/extensions/satspay/templates/satspay/_api_docs.html | 7 ++----- lnbits/extensions/satspay/templates/satspay/display.html | 7 ------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/lnbits/extensions/satspay/crud.py b/lnbits/extensions/satspay/crud.py index c90af7641..0883aadff 100644 --- a/lnbits/extensions/satspay/crud.py +++ b/lnbits/extensions/satspay/crud.py @@ -19,9 +19,10 @@ async def create_charge(user: str, description: str = None, onchainwallet: Optio charge_id = urlsafe_short_hash() if onchainwallet: wallet = await get_watch_wallet(onchainwallet) - onchainaddress = await get_fresh_address(onchainwallet) + onchain = await get_fresh_address(onchainwallet) + onchainaddress = onchain.address else: - onchainaddress.address = None + onchainaddress = None if lnbitswallet: payment_hash, payment_request = await create_invoice( wallet_id=lnbitswallet, @@ -50,7 +51,7 @@ async def create_charge(user: str, description: str = None, onchainwallet: Optio ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) """, - (charge_id, user, description, onchainwallet, onchainaddress.address, lnbitswallet, + (charge_id, user, description, onchainwallet, onchainaddress, lnbitswallet, payment_request, payment_hash, webhook, completelink, completelinktext, time, amount, 0), ) return await get_charge(charge_id) diff --git a/lnbits/extensions/satspay/templates/satspay/_api_docs.html b/lnbits/extensions/satspay/templates/satspay/_api_docs.html index 0c27ab7b4..526af7f37 100644 --- a/lnbits/extensions/satspay/templates/satspay/_api_docs.html +++ b/lnbits/extensions/satspay/templates/satspay/_api_docs.html @@ -9,7 +9,6 @@ >

-
Headers
- {"X-Api-Key": <admin_key>}
+ {"X-Api-Key": <invoice_key>}
Body (application/json)
@@ -103,7 +102,7 @@ >GET /satspay/api/v1/charges
Headers
- {"X-Api-Key": <admin_key>}
+ {"X-Api-Key": <invoice_key>}
Body (application/json)
@@ -152,8 +151,6 @@ >GET /satspay/api/v1/charges/balance/<charge_id> -
Headers
- {"X-Api-Key": <admin_key>}
Body (application/json)
diff --git a/lnbits/extensions/satspay/templates/satspay/display.html b/lnbits/extensions/satspay/templates/satspay/display.html index a37c57b85..52e9bfc78 100644 --- a/lnbits/extensions/satspay/templates/satspay/display.html +++ b/lnbits/extensions/satspay/templates/satspay/display.html @@ -3,7 +3,6 @@
{{ charge.description }}
-
Time elapsed
@@ -24,8 +23,6 @@
- -
-
-
@@ -104,8 +99,6 @@
- -