fix: use satspay for onchain payments (#56)
* use satspay * safeguard satspay * add fasttrack and 0conf
This commit is contained in:
parent
da16b209cd
commit
99b43ff851
7 changed files with 170 additions and 177 deletions
15
services.py
15
services.py
|
|
@ -62,16 +62,27 @@ async def fetch_watchonly_wallet(api_key: str, wallet_id: str) -> dict[str, Any]
|
|||
return resp.json()
|
||||
|
||||
|
||||
async def fetch_onchain_address(api_key: str, wallet_id: str) -> dict[str, Any]:
|
||||
async def get_satspay_charge(api_key: str, charge_id: str) -> dict[str, Any]:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.get(
|
||||
url=f"http://{settings.host}:{settings.port}/watchonly/api/v1/address/{wallet_id}",
|
||||
url=f"http://{settings.host}:{settings.port}/satspay/api/v1/charge/{charge_id}",
|
||||
headers={"X-API-KEY": api_key},
|
||||
)
|
||||
resp.raise_for_status()
|
||||
return resp.json()
|
||||
|
||||
|
||||
async def create_satspay_charge(api_key: str, data: dict) -> dict[str, Any]:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.post(
|
||||
url=f"http://{settings.host}:{settings.port}/satspay/api/v1/charge",
|
||||
headers={"X-API-KEY": api_key},
|
||||
json=data,
|
||||
)
|
||||
resp.raise_for_status()
|
||||
return resp.json()
|
||||
|
||||
|
||||
async def set_ticket_paid(ticket: Ticket) -> Ticket:
|
||||
if ticket.paid:
|
||||
return ticket
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue