diff --git a/migrations.py b/migrations.py
index a7e3e86..512540d 100644
--- a/migrations.py
+++ b/migrations.py
@@ -185,3 +185,13 @@ async def m007_add_allow_fiat(db):
ALTER TABLE events.events
ADD COLUMN allow_fiat BOOLEAN NOT NULL DEFAULT FALSE;
""")
+
+
+async def m008_add_fiat_currency(db):
+ """
+ Add a fiat_currency column for sat-denominated events using fiat checkout.
+ """
+ await db.execute("""
+ ALTER TABLE events.events
+ ADD COLUMN fiat_currency TEXT NOT NULL DEFAULT 'GBP';
+ """)
diff --git a/models.py b/models.py
index 7886600..20037ec 100644
--- a/models.py
+++ b/models.py
@@ -37,6 +37,7 @@ class CreateEvent(BaseModel):
event_end_date: str
currency: str = "sat"
allow_fiat: bool = False
+ fiat_currency: str = "GBP"
amount_tickets: int = Query(..., ge=0)
price_per_ticket: float = Query(..., ge=0)
banner: str | None = None
@@ -54,6 +55,7 @@ class Event(BaseModel):
event_end_date: str
currency: str
allow_fiat: bool = False
+ fiat_currency: str = "GBP"
amount_tickets: int
price_per_ticket: float
time: datetime
@@ -72,6 +74,7 @@ class PublicEvent(BaseModel):
event_end_date: str
currency: str
allow_fiat: bool = False
+ fiat_currency: str = "GBP"
price_per_ticket: float
banner: str | None
extra: EventExtra = Field(default_factory=EventExtra)
diff --git a/static/js/display.js b/static/js/display.js
index a927b09..d8be8e9 100644
--- a/static/js/display.js
+++ b/static/js/display.js
@@ -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)
diff --git a/static/js/display.vue b/static/js/display.vue
index e37b844..f5ac5fb 100644
--- a/static/js/display.vue
+++ b/static/js/display.vue
@@ -72,7 +72,7 @@
:options="[
{label: 'Lightning', value: 'lightning'},
{
- label: `Fiat (${event.currency.toUpperCase()})`,
+ label: fiatCheckoutLabel,
value: 'fiat'
}
]"
diff --git a/static/js/index.js b/static/js/index.js
index e770db9..07e1b46 100644
--- a/static/js/index.js
+++ b/static/js/index.js
@@ -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,
diff --git a/static/js/index.vue b/static/js/index.vue
index 75af661..06729f3 100644
--- a/static/js/index.vue
+++ b/static/js/index.vue
@@ -373,16 +373,27 @@
+