feat: issue free tickets without minting an invoice #31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/free-tickets"
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?
Problem
Free events (
price_per_ticket == 0) tried to mint a 0-amount Lightning invoice viacreate_payment_request. That invoice can't settle, and the invoice listener (on_invoice_paid→set_ticket_paid) would never fire for it, so the ticket never became scannable. The webapp then hit its no-paymentRequestguard and threw a misleading "uses fiat checkout" error.(Free ≠ donation — you can't pay 0 to a Lightning invoice; pay-what-you-want is tracked separately as #30.)
Change
api_ticket_createnow short-circuits when the final charge is 0 — a free event or a 100%-off promo, computed after promo + quantity — before any invoice / fiat-provider logic._issue_free_ticketscreates the N rows and runs each through the existingset_ticket_paid: the exact pathon_invoice_paiddrives for a settled payment (flippaid, bumpsold/amount_ticketsunder the per-event lock, republish the NIP-52 calendar event), plus the ticket notification. Only the payment is removed.The response carries a new
TicketPaymentRequest.paid = Truewithpayment_request = None, so the client skips the QR / payment-poll and goes straight to the ticket QRs.sats_paid = 0, so free tickets are naturally skipped byrefund_tickets(no accidental 0-sat LNURL refund).payment_hash— the join key the poll / WebSocket / My-Tickets lookups use — mirroring the paid multi-ticket path.amount_tickets.Companion / follow-ups
paidwith nopaymentRequestinstead of throwing) — separate PR onaiolabs/webapp→dev.Testing note
No API/DB test harness is wired in this repo's
tests/(pure-unit only), and the free path delegates to the already-exercisedset_ticket_paid. Needs the standard dev-LNbits smoke before tagging (FakeWallet): buy a free ticket → ticket returnspaid, no invoice, scannable at the door; counters decrement + NIP-52 republishes; a 100%-off promo on a paid event takes the same path.Includes the
config.jsonbump to1.6.1-aio.7(separate commit).🤖 Generated with Claude Code