From afa34c90c2f772bc445a33ff6d923077ad46c48c Mon Sep 17 00:00:00 2001 From: Padreug Date: Tue, 29 Sep 2026 08:23:52 +0200 Subject: [PATCH] feat(events): buy from a chosen ticket wave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checkout was priced and requested off the event, which since events ext v1.6.8 means the PRIMARY wave. Two things were wrong at once: once early bird closed the dialog displayed the closed tier's price while the backend charged the open one, and an event with two waves open could not be bought at all — the purchase endpoint refuses to guess ("Please select a ticket wave") and nothing sent `ticket_wave_id`. The dialog now resolves a wave the way the backend does: a single open wave is implied, several means the buyer picks, none means nothing is on sale. Price, currency and fiat availability all read from that wave — `allow_fiat` too, which is a per-wave opt-in and could otherwise offer a rail the purchase would refuse. The picker only renders when there is an actual choice, so the common single-wave case gains no extra click, and the CTA is disabled rather than firing a request the backend will reject. `ticket_wave_id` now rides on all three purchase paths (discounted-free, Lightning, fiat) and on the promo preview, so the quote and the charge are priced against the same tier. Plumbing worth noting: the tags a card renders from describe the active wave but carry no wave id, by the flat-tag decision on aiolabs/events#61. So the detail page fetches the LNbits record for the pickable tiers — possible only because `ticket_waves` is public from v1.6.8-aio.2 (aiolabs/events#66). Non-fatal on failure: the backend answers 410 for sold-out or closed events, where there is no tier to pick anyway. 3 service tests pin the wire format, including that no empty wave id is sent when the buyer had no choice. 62 pass; vue-tsc and prettier clean. --- .../components/PurchaseTicketDialog.vue | 876 ++++++++++++------ .../events/composables/usePromoCode.ts | 161 ++-- .../events/composables/useTicketPurchase.ts | 334 +++---- .../events/services/TicketApiService.spec.ts | 382 +++++--- .../events/services/TicketApiService.ts | 310 ++++--- src/modules/events/views/EventDetailPage.vue | 457 +++++---- 6 files changed, 1601 insertions(+), 919 deletions(-) diff --git a/src/modules/events/components/PurchaseTicketDialog.vue b/src/modules/events/components/PurchaseTicketDialog.vue index 6726b20..a1737fb 100644 --- a/src/modules/events/components/PurchaseTicketDialog.vue +++ b/src/modules/events/components/PurchaseTicketDialog.vue @@ -1,14 +1,20 @@