Honour per-wave fiat when the organiser set an explicit rail list #67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/wave-aware-payment-methods"
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?
Reported from aio-demo: event fiat enabled, Card offered at checkout, purchase refused with "Fiat payments are not enabled for this ticket wave."
Cause
effective_payment_methodsreturned the organiser's explicitextra.payment_methodsbefore consulting anything else:So the
waveargument I added in #61 did nothing in the common case. The webapp always setsextra.payment_methodsfrom its payment-method checkboxes, which makes the explicit path the normal one, not the exception. Three layers then disagreed:tickets_payment_methods: lightning,fiatwhile omittingtickets_allow_fiat— contradicting itselfapi_ticket_create, the only wave-aware check, refused the purchaseConfirmed against the live instance — the reported event's waves:
Fix
Asking about a specific wave means asking what a buyer can actually use for it, so a rail that wave cannot honour is dropped. The event-level question (no wave) still reports every rail the organiser enabled — that is what the admin views want. Fiat-only rails on a non-fiat wave now yield an empty list, which is honest: nothing is purchasable from that wave.
Tests
5 new, including both publisher shapes with an explicit list — the case that actually bit, and which the #61 tests missed because their fixtures left
payment_methodsempty. That gap is why a bug survived a PR that claimed to fix this exact contradiction. 133 pass; ruff, black clean; mypy unchanged from baseline.Does not fix existing data
Waves already created through the webapp were saved with
allow_fiatunset, so they genuinely cannot take fiat until toggled — the LNbits admin's per-wave dialog has that switch. The webapp half isaiolabs/webappfix/wave-fiat-inheritance.Reported from aio-demo: an event with fiat enabled, Card offered at checkout, and the purchase refused with "Fiat payments are not enabled for this ticket wave." `effective_payment_methods` returned the organiser's explicit `extra.payment_methods` list before ever consulting the wave: explicit = list(...) if explicit: return explicit # <- the wave never got a look in So the `wave` argument I added for #61 did nothing in the common case. The webapp always sets `extra.payment_methods` from its payment-method checkboxes, which means the explicit path is the normal one, not the exception — three layers then disagreed: - the NIP-52 tag advertised `tickets_payment_methods: lightning,fiat` while omitting `tickets_allow_fiat`, contradicting itself - the checkout rendered a Card button - `api_ticket_create`, the only wave-aware check, refused the purchase Asking about a specific wave means asking what a buyer can actually use for it, so a rail that wave cannot honour is now dropped. The event-level question (no wave) still reports every rail the organiser enabled — that is what `/republish-all` and the admin views want. Fiat-only rails on a non-fiat wave now yield an empty list, which is honest: nothing is purchasable from that wave. 5 tests, including both publisher shapes with an explicit list — the case that actually bit, and which the #61 tests missed because their fixtures left `payment_methods` empty. 133 pass. Does not fix the data on events already created through the webapp: their waves were saved with `allow_fiat` unset, so those waves genuinely cannot take fiat until toggled. That is aiolabs/webapp's side.