feat: guest checkout, Stripe return flow, emailed QR tickets, per-event payment methods (v1.6.1-aio.8) #36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/guest-checkout-email"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Backend half of the guest-checkout work for the end-of-month production run (webapp half: aiolabs/webapp
feat/events-guest-checkout; lnbits half: aiolabs/lnbits#66).What changes
CreateTicketacceptsuser_idtogether withemail/name(the exclusion was our own dispatch convenience fromdfabcb8, nothing needed it);crud.create_ticketstops blanking name/email foruser_idrows. Until now no webapp buyer could ever receive a ticket email, logged in or not.CreateTicket.frontend_url(app root). Its origin must be one ofLNBITS_CORS_ALLOWED_ORIGINS, the LNbits base URL orLNBITS_CUSTOM_FRONTEND_URL, else 400 (fail loud; a silent fallback sends the buyer to the wrong app). Under that root the fiat path setsextra["checkout"]for lnbits'StripeCheckoutOptions:success_url=/events/{id}?checkout=success&tickets=<ids>,cancel_url=/events/{id}?checkout=cancelled,customer_email, an event-named line item andevent_id/quantity/ticket_idsmetadata. Ticket ids are minted before the invoice so the success URL can carry them.ticket_base_urluses the same root, so the emailed link opens the webapp when the webapp was the client; absentfrontend_url= today's behaviour (LNbits host / Quasar pages).GET /events/api/v1/qr/{ticket_id}(PNG at error-correction H, instancelnbits_qr_logopasted in the centre).resend-emailreturns aTicketResendResult(per-channel attempted/sent/error). SMTP runs in a worker thread. Our nsec-DM Nostr path is kept.extra.payment_methods(lightning,fiat; empty = legacy rule) with the field name upstream v2 (#64) uses; enforced at purchase, published as NIP-52 tagtickets_payment_methods, and exposed as checkboxes in the admin dialog. This is how Lightning is switched off for the card-only run without code.No schema change (
ticket.emailexists;payment_methodslives inextra).config.json→1.6.1-aio.8. README section +docs/upstream-candidates.md(running log of upstream-shaped features).Verification
pytest(34 passed, incl. newtest_ticket_models,test_frontend_root,test_ticket_qr,test_crud_ticket_email) run with the fork's lnbits onPYTHONPATH— the uv env resolves upstream lnbits, which lackslnbits.core.signers.var-annotatederrors in untouchedcrud.py/nostr_sync.pylines, none in this diff.Deploy
Merge → tag
v1.6.1-aio.8→ sha256 → add a catalog entry in aiolabs/lnbits-extensions → upgrade on aio-demo. Needs aiolabs/lnbits#66 deployed forcustomer_email/cancel_urlto take effect (without it those two keys are ignored by lnbits; everything else works).🤖 Generated with Claude Code
https://claude.ai/code/session_01EYwoAkZZmXMMmaBp4WGUBo
`_resolve_frontend_root` honours `CreateTicket.frontend_url` when its origin is one of LNBITS_CORS_ALLOWED_ORIGINS, the LNbits base URL or LNBITS_CUSTOM_FRONTEND_URL (400 otherwise — a silent fallback would send the buyer to the wrong app), and falls back to request.base_url as before. Under that root the fiat path now parameterises the hosted checkout via `extra["checkout"]` (lnbits StripeCheckoutOptions): success_url `/events/{id}?checkout=success&tickets=<ids>`, cancel_url `/events/{id}?checkout=cancelled`, customer_email, an event-named line item and event_id/quantity/ticket_ids metadata. Ticket ids are minted before the invoice so the success URL can carry them (the payment_hash only exists afterwards). ticket_base_url on the rows uses the same root, so the emailed link lands in the webapp when the webapp was the client. Purchases are gated on `effective_payment_methods(event)` (checked after the free-ticket short-circuit, which charges nothing on any rail). New anonymous `GET /events/api/v1/qr/{ticket_id}` returns a PNG of `ticket://<id>` — port of upstream v1.6.8's endpoint without ticket-image compositing — built at error-correction H with the instance QR logo (`lnbits_qr_logo`) pasted in the centre, matching the client-side QRs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYwoAkZZmXMMmaBp4WGUBo