fix: if sats and fiat checkout conversion currency

This commit is contained in:
Arc 2026-05-07 14:34:22 +01:00
commit 32c230957e
7 changed files with 59 additions and 16 deletions

View file

@ -41,8 +41,16 @@ window.PageEventsDisplay = {
return LNbits.utils.convertMarkdown(this.event?.info || '')
},
allowFiatCheckout() {
const currency = (this.event?.currency || '').toLowerCase()
return this.event?.allow_fiat && !['sat', 'sats'].includes(currency)
return Boolean(this.event?.allow_fiat)
},
fiatCheckoutLabel() {
if (!this.allowFiatCheckout) return 'Fiat'
const unit = ['sat', 'sats'].includes(
(this.event?.currency || '').toLowerCase()
)
? this.event?.fiat_currency
: this.event?.currency
return `Fiat (${(unit || 'GBP').toUpperCase()})`
},
allowEmailNotifications() {
return Boolean(this.event?.extra?.email_notifications)

View file

@ -72,7 +72,7 @@
:options="[
{label: 'Lightning', value: 'lightning'},
{
label: `Fiat (${event.currency.toUpperCase()})`,
label: fiatCheckoutLabel,
value: 'fiat'
}
]"

View file

@ -99,6 +99,7 @@ window.PageEvents = {
data: {
currency: 'sats',
allow_fiat: false,
fiat_currency: 'GBP',
extra: {
promo_codes: []
}
@ -171,7 +172,9 @@ window.PageEvents = {
}))
}
if (!this.isFiatCurrency(data.currency)) {
data.allow_fiat = false
if (!data.allow_fiat) {
data.fiat_currency = 'GBP'
}
}
if (data.id) {
@ -188,6 +191,7 @@ window.PageEvents = {
this.formDialog.data = {
currency: 'sats',
allow_fiat: false,
fiat_currency: 'GBP',
extra: {
conditional: false,
min_tickets: 1,
@ -204,6 +208,7 @@ window.PageEvents = {
this.formDialog.data = {
currency: 'sats',
allow_fiat: false,
fiat_currency: 'GBP',
extra: {
email_notifications: false,
nostr_notifications: false,

View file

@ -373,16 +373,27 @@
</div>
<q-toggle
v-model="formDialog.data.allow_fiat"
:disable="
formDialog.data.currency == null ||
['sat', 'sats'].includes(
(formDialog.data.currency || '').toLowerCase()
)
"
label="Allow fiat checkout"
left-label
hint="Lets attendees pay through a configured fiat provider using the event currency."
></q-toggle>
<q-select
v-if="
formDialog.data.allow_fiat &&
['sat', 'sats'].includes(
(formDialog.data.currency || '').toLowerCase()
)
"
filled
dense
v-model="formDialog.data.fiat_currency"
label="Fiat checkout currency"
:options="
currencies.filter(
c => !['sat', 'sats'].includes((c || '').toLowerCase())
)
"
></q-select>
<q-expansion-item
group="advanced"
icon="settings"