create_charge data
This commit is contained in:
parent
c58e2c5d74
commit
510a28f3d0
1 changed files with 4 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ from starlette.responses import RedirectResponse
|
||||||
|
|
||||||
from lnbits.core.crud import get_user
|
from lnbits.core.crud import get_user
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||||
|
from lnbits.extensions.satspay.models import CreateCharge
|
||||||
from lnbits.extensions.streamalerts.models import (
|
from lnbits.extensions.streamalerts.models import (
|
||||||
CreateDonation,
|
CreateDonation,
|
||||||
CreateService,
|
CreateService,
|
||||||
|
|
@ -116,14 +117,15 @@ async def api_create_donation(data: CreateDonation, request: Request):
|
||||||
name = data.name
|
name = data.name
|
||||||
|
|
||||||
description = f"{sats} sats donation from {name} to {service.twitchuser}"
|
description = f"{sats} sats donation from {name} to {service.twitchuser}"
|
||||||
charge = await create_charge(
|
create_charge_data = CreateCharge(
|
||||||
amount=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 + "/streamalerts/api/v1/postdonation",
|
webhook=webhook_base + "/streamalerts/api/v1/postdonation",
|
||||||
description=description,
|
description=description,
|
||||||
**charge_details,
|
**charge_details
|
||||||
)
|
)
|
||||||
|
charge = await create_charge(user=charge_details["user"], data=data)
|
||||||
await create_donation(
|
await create_donation(
|
||||||
id=charge.id,
|
id=charge.id,
|
||||||
wallet=service.wallet,
|
wallet=service.wallet,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue