From 6ccc7833777a8af4902a3b194a38042fb415283d Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 13 Dec 2022 13:36:21 +0200 Subject: [PATCH] feat: store & show `webhook` response body --- lnbits/extensions/satspay/helpers.py | 6 +++- lnbits/extensions/satspay/static/js/utils.js | 1 + .../satspay/templates/satspay/index.html | 36 +++++++++++++++---- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/lnbits/extensions/satspay/helpers.py b/lnbits/extensions/satspay/helpers.py index 60c5ba4a..b21a3ae2 100644 --- a/lnbits/extensions/satspay/helpers.py +++ b/lnbits/extensions/satspay/helpers.py @@ -37,7 +37,11 @@ async def call_webhook(charge: Charges): json=public_charge(charge), timeout=40, ) - return {"webhook_success": r.is_success, "webhook_message": r.reason_phrase} + return { + "webhook_success": r.is_success, + "webhook_message": r.reason_phrase, + "webhook_response": r.text, + } except Exception as e: logger.warning(f"Failed to call webhook for charge {charge.id}") logger.warning(e) diff --git a/lnbits/extensions/satspay/static/js/utils.js b/lnbits/extensions/satspay/static/js/utils.js index 2b1be8bd..5317673f 100644 --- a/lnbits/extensions/satspay/static/js/utils.js +++ b/lnbits/extensions/satspay/static/js/utils.js @@ -23,6 +23,7 @@ const mapCharge = (obj, oldObj = {}) => { charge.displayUrl = ['/satspay/', obj.id].join('') charge.expanded = oldObj.expanded || false charge.pendingBalance = oldObj.pendingBalance || 0 + charge.extra = charge.extra ? JSON.parse(charge.extra) : charge.extra return charge } diff --git a/lnbits/extensions/satspay/templates/satspay/index.html b/lnbits/extensions/satspay/templates/satspay/index.html index 602b1a28..2dda8792 100644 --- a/lnbits/extensions/satspay/templates/satspay/index.html +++ b/lnbits/extensions/satspay/templates/satspay/index.html @@ -227,7 +227,12 @@ >
- + {{props.row.webhook_message }}
@@ -528,6 +533,23 @@ + + + + + +
+ Close +
+
+
{% endblock %} {% block scripts %} {{ window_vars(user) }}