diff --git a/lnbits/extensions/tipjar/helpers.py b/lnbits/extensions/tipjar/helpers.py index 7e89b7a9..54061405 100644 --- a/lnbits/extensions/tipjar/helpers.py +++ b/lnbits/extensions/tipjar/helpers.py @@ -1,5 +1,6 @@ from lnbits.core.crud import get_wallet from .crud import get_tipjar +import json async def get_charge_details(tipjar_id): @@ -14,6 +15,6 @@ async def get_charge_details(tipjar_id): "lnbitswallet": wallet_id, "onchainwallet": tipjar.onchain, "completelink": "/tipjar/" + str(tipjar_id), - "completelinktext": "Thanks for the tip!" + "completelinktext": "Thanks for the tip!", } return details diff --git a/lnbits/extensions/tipjar/views_api.py b/lnbits/extensions/tipjar/views_api.py index 3bbbbefa..2f89ec99 100644 --- a/lnbits/extensions/tipjar/views_api.py +++ b/lnbits/extensions/tipjar/views_api.py @@ -1,5 +1,5 @@ from http import HTTPStatus - +import json from fastapi import Request from fastapi.param_functions import Query from fastapi.params import Depends @@ -57,6 +57,7 @@ async def api_create_tip(data: createTips): webhook = tipjar.webhook charge_details = await get_charge_details(tipjar.id) + print(charge_details["time"]) name = data.name # Ensure that description string can be split reliably name = name.replace('"', "''") @@ -65,13 +66,19 @@ async def api_create_tip(data: createTips): description = f'"{name}": {message}' charge = await create_charge( + user=charge_details["user"], data={ "amount": sats, "webhook": webhook, "description": description, - **charge_details, + "onchainwallet": charge_details["onchainwallet"], + "lnbitswallet": charge_details["lnbitswallet"], + "completelink": charge_details["completelink"], + "completelinktext": charge_details["completelinktext"], + "time": charge_details["time"], }, ) + await create_tip( id=charge.id, wallet=tipjar.wallet,