feat(api): keyless GET /api/v1/public/bookings/{id} for guests

The guest cannot subscribe to the operator's wallet and the existing
booking read needs a wallet invoice key, so a client had no way to wait
for awaiting_payment -> confirmed over HTTP short of polling the invoice
on LNbits core. Add the HTTP twin of the RPC door's chatelet_booking_get:
the 10-char booking id from the quote is the capability, and the response
is public_booking_dict — lifecycle, dates and money only, with the guest's
pubkey/contact and the Lightning/Nostr plumbing stripped.

Closes #18

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-09-15 23:43:21 +02:00
commit 94542ad0f9
4 changed files with 106 additions and 2 deletions

View file

@ -24,6 +24,7 @@ from .models import (
CreateRoomData,
Room,
RoomStatus,
public_booking_dict,
public_room_dict,
)
from .nostr import service as nostr
@ -243,3 +244,15 @@ async def api_get_booking(
if not booking:
raise HTTPException(404, "Booking not found")
return booking
@chatelet_api_router.get("/api/v1/public/bookings/{booking_id}")
async def api_public_booking(booking_id: str) -> dict:
"""Guest read-back of their own booking (keyless). The guest can't
subscribe to the operator's wallet, so this is how a client waits for
`awaiting_payment` -> `confirmed` (or sees `expired` / `declined`)
without a key — the HTTP twin of the RPC door's chatelet_booking_get."""
booking = await crud.get_booking(booking_id)
if not booking:
raise HTTPException(404, "Booking not found")
return public_booking_dict(booking)