Change charge description
This commit is contained in:
parent
56b85ecdac
commit
f88c622f94
|
@ -16,7 +16,6 @@ from lnbits.core.crud import get_wallet
|
||||||
|
|
||||||
async def get_charge_details(service_id):
|
async def get_charge_details(service_id):
|
||||||
details = {
|
details = {
|
||||||
"description": f"TwitchAlerts donation for service {str(service_id)}",
|
|
||||||
"time": 1440,
|
"time": 1440,
|
||||||
}
|
}
|
||||||
service = await get_service(service_id)
|
service = await get_service(service_id)
|
||||||
|
|
|
@ -108,18 +108,21 @@ async def api_create_donation():
|
||||||
"""Takes data from donation form and creates+returns SatsPay charge"""
|
"""Takes data from donation form and creates+returns SatsPay charge"""
|
||||||
cur_code = "USD"
|
cur_code = "USD"
|
||||||
price = await btc_price(cur_code)
|
price = await btc_price(cur_code)
|
||||||
|
sats = g.data["sats"]
|
||||||
message = g.data.get("message", "")
|
message = g.data.get("message", "")
|
||||||
amount = g.data["sats"] * (10 ** (-8)) * price
|
amount = sats * (10 ** (-8)) * price
|
||||||
webhook_base = request.scheme + "://" + request.headers["Host"]
|
webhook_base = request.scheme + "://" + request.headers["Host"]
|
||||||
service_id = g.data["service"]
|
service_id = g.data["service"]
|
||||||
service = await get_service(service_id)
|
service = await get_service(service_id)
|
||||||
charge_details = await get_charge_details(service.id)
|
charge_details = await get_charge_details(service.id)
|
||||||
name = g.data.get("name", "Anonymous")
|
name = g.data.get("name", "Anonymous")
|
||||||
|
description = f"{sats} sats donation from {name} to {service.twitchuser}"
|
||||||
charge = await create_charge(
|
charge = await create_charge(
|
||||||
amount=g.data["sats"],
|
amount=sats,
|
||||||
completelink=f"https://twitch.tv/{service.twitchuser}",
|
completelink=f"https://twitch.tv/{service.twitchuser}",
|
||||||
completelinktext="Back to Stream!",
|
completelinktext="Back to Stream!",
|
||||||
webhook=webhook_base + "/twitchalerts/api/v1/postdonation",
|
webhook=webhook_base + "/twitchalerts/api/v1/postdonation",
|
||||||
|
description=description,
|
||||||
**charge_details)
|
**charge_details)
|
||||||
await create_donation(
|
await create_donation(
|
||||||
id=charge.id,
|
id=charge.id,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user