Cant call satspayserver function
This commit is contained in:
parent
65b926ad08
commit
4403186441
2 changed files with 11 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
from lnbits.core.crud import get_wallet
|
from lnbits.core.crud import get_wallet
|
||||||
from .crud import get_tipjar
|
from .crud import get_tipjar
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
async def get_charge_details(tipjar_id):
|
async def get_charge_details(tipjar_id):
|
||||||
|
|
@ -14,6 +15,6 @@ async def get_charge_details(tipjar_id):
|
||||||
"lnbitswallet": wallet_id,
|
"lnbitswallet": wallet_id,
|
||||||
"onchainwallet": tipjar.onchain,
|
"onchainwallet": tipjar.onchain,
|
||||||
"completelink": "/tipjar/" + str(tipjar_id),
|
"completelink": "/tipjar/" + str(tipjar_id),
|
||||||
"completelinktext": "Thanks for the tip!"
|
"completelinktext": "Thanks for the tip!",
|
||||||
}
|
}
|
||||||
return details
|
return details
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
import json
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
from fastapi.param_functions import Query
|
from fastapi.param_functions import Query
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
|
|
@ -57,6 +57,7 @@ async def api_create_tip(data: createTips):
|
||||||
|
|
||||||
webhook = tipjar.webhook
|
webhook = tipjar.webhook
|
||||||
charge_details = await get_charge_details(tipjar.id)
|
charge_details = await get_charge_details(tipjar.id)
|
||||||
|
print(charge_details["time"])
|
||||||
name = data.name
|
name = data.name
|
||||||
# Ensure that description string can be split reliably
|
# Ensure that description string can be split reliably
|
||||||
name = name.replace('"', "''")
|
name = name.replace('"', "''")
|
||||||
|
|
@ -65,13 +66,19 @@ async def api_create_tip(data: createTips):
|
||||||
description = f'"{name}": {message}'
|
description = f'"{name}": {message}'
|
||||||
|
|
||||||
charge = await create_charge(
|
charge = await create_charge(
|
||||||
|
user=charge_details["user"],
|
||||||
data={
|
data={
|
||||||
"amount": sats,
|
"amount": sats,
|
||||||
"webhook": webhook,
|
"webhook": webhook,
|
||||||
"description": description,
|
"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(
|
await create_tip(
|
||||||
id=charge.id,
|
id=charge.id,
|
||||||
wallet=tipjar.wallet,
|
wallet=tipjar.wallet,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue