mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 06:48:02 +01:00
tipjar working
This commit is contained in:
parent
0be429b539
commit
c1f849b37a
2 changed files with 22 additions and 12 deletions
|
@ -12,6 +12,17 @@ from typing import Optional, NamedTuple
|
|||
from fastapi import FastAPI, Request
|
||||
|
||||
|
||||
class CreateCharge(BaseModel):
|
||||
onchainwallet: str = Query(None)
|
||||
lnbitswallet: str = Query(None)
|
||||
description: str = Query(...)
|
||||
webhook: str = Query(None)
|
||||
completelink: str = Query(None)
|
||||
completelinktext: str = Query(None)
|
||||
time: int = Query(..., ge=1)
|
||||
amount: int = Query(..., ge=1)
|
||||
|
||||
|
||||
class createTip(BaseModel):
|
||||
id: str
|
||||
wallet: str
|
||||
|
|
|
@ -27,7 +27,7 @@ from .crud import (
|
|||
delete_tipjar,
|
||||
)
|
||||
from ..satspay.crud import create_charge
|
||||
from .models import createTipJar, createTips, createTip
|
||||
from .models import createTipJar, createTips, createTip, CreateCharge
|
||||
|
||||
|
||||
@tipjar_ext.post("/api/v1/tipjars")
|
||||
|
@ -64,19 +64,18 @@ async def api_create_tip(data: createTips):
|
|||
if not name:
|
||||
name = "Anonymous"
|
||||
description = f'"{name}": {message}'
|
||||
|
||||
charge = await create_charge(
|
||||
user=charge_details["user"],
|
||||
data={
|
||||
"amount": sats,
|
||||
"webhook": webhook,
|
||||
"description": description,
|
||||
"onchainwallet": charge_details["onchainwallet"],
|
||||
"lnbitswallet": charge_details["lnbitswallet"],
|
||||
"completelink": charge_details["completelink"],
|
||||
"completelinktext": charge_details["completelinktext"],
|
||||
"time": charge_details["time"],
|
||||
},
|
||||
data=CreateCharge(
|
||||
amount=sats,
|
||||
webhook=webhook,
|
||||
description=description,
|
||||
onchainwallet=charge_details["onchainwallet"],
|
||||
lnbitswallet=charge_details["lnbitswallet"],
|
||||
completelink=charge_details["completelink"],
|
||||
completelinktext=charge_details["completelinktext"],
|
||||
time=charge_details["time"],
|
||||
),
|
||||
)
|
||||
|
||||
await create_tip(
|
||||
|
|
Loading…
Add table
Reference in a new issue