Billing: fatture manuali, profilo obbligatorio e piani Stripe mensile/annuale.

Rimuove link al portale Stripe in area cliente, aggiunge flusso admin per PDF
fattura e email, blocca checkout senza dati di fatturazione, allinea prezzi
a €4,90/€39,90 e €9,90/€69,90, locale italiano e documentazione deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 17:10:12 +02:00
parent 148402a97c
commit a5e781729c
78 changed files with 2457 additions and 424 deletions

View File

@@ -25,6 +25,9 @@ module App
config.api_only = false
config.active_job.queue_adapter = :sidekiq
config.time_zone = "Europe/Rome"
config.i18n.default_locale = :it
config.i18n.available_locales = %i[it en]
config.i18n.fallbacks = { it: %i[it en], en: %i[en it] }
config.generators { |g| g.orm :active_record, primary_key_type: :uuid }
end
end

View File

@@ -0,0 +1,5 @@
# Sito in italiano: locale fissa per ogni richiesta web (evita date tipo "July 02, 2026").
Rails.application.config.after_initialize do
I18n.available_locales = %i[it en]
I18n.default_locale = :it
end

View File

@@ -40,12 +40,33 @@ module MatchLiveTv
ENV["STRIPE_WEBHOOK_SECRET"].presence
end
def stripe_premium_light_yearly_price_id
ENV["STRIPE_PREMIUM_LIGHT_YEARLY_PRICE_ID"].presence ||
ENV["STRIPE_PREMIUM_LIGHT_PRICE_ID"].presence ||
ENV["STRIPE_PREMIUM_PRICE_ID"].presence
end
def stripe_premium_light_monthly_price_id
ENV["STRIPE_PREMIUM_LIGHT_MONTHLY_PRICE_ID"].presence
end
def stripe_premium_full_yearly_price_id
ENV["STRIPE_PREMIUM_FULL_YEARLY_PRICE_ID"].presence ||
ENV["STRIPE_PREMIUM_FULL_PRICE_ID"].presence ||
ENV["STRIPE_PREMIUM_PRICE_ID"].presence
end
def stripe_premium_full_monthly_price_id
ENV["STRIPE_PREMIUM_FULL_MONTHLY_PRICE_ID"].presence
end
# Retrocompatibilità
def stripe_premium_light_price_id
ENV.fetch("STRIPE_PREMIUM_LIGHT_PRICE_ID", ENV.fetch("STRIPE_PREMIUM_PRICE_ID", ""))
stripe_premium_light_yearly_price_id.to_s
end
def stripe_premium_full_price_id
ENV.fetch("STRIPE_PREMIUM_FULL_PRICE_ID", ENV.fetch("STRIPE_PREMIUM_PRICE_ID", ""))
stripe_premium_full_yearly_price_id.to_s
end
def stripe_enabled?

View File

@@ -0,0 +1,60 @@
it:
date:
formats:
default: "%d/%m/%Y"
short: "%d %b %Y"
long: "%d %B %Y"
day_names: [domenica, lunedì, martedì, mercoledì, giovedì, venerdì, sabato]
abbr_day_names: [dom, lun, mar, mer, gio, ven, sab]
month_names: [~, gennaio, febbraio, marzo, aprile, maggio, giugno, luglio, agosto, settembre, ottobre, novembre, dicembre]
abbr_month_names: [~, gen, feb, mar, apr, mag, giu, lug, ago, set, ott, nov, dic]
order:
- :day
- :month
- :year
time:
formats:
default: "%d/%m/%Y %H:%M"
short: "%d %b %Y %H:%M"
long: "%d %B %Y alle %H:%M"
am: ""
pm: ""
datetime:
distance_in_words:
about_x_hours:
one: circa un'ora
other: circa %{count} ore
about_x_months:
one: circa un mese
other: circa %{count} mesi
about_x_years:
one: circa un anno
other: circa %{count} anni
almost_x_years:
one: quasi un anno
other: quasi %{count} anni
half_a_minute: mezzo minuto
less_than_x_minutes:
one: meno di un minuto
other: meno di %{count} minuti
less_than_x_seconds:
one: meno di un secondo
other: meno di %{count} secondi
over_x_years:
one: oltre un anno
other: oltre %{count} anni
x_days:
one: 1 giorno
other: "%{count} giorni"
x_minutes:
one: 1 minuto
other: "%{count} minuti"
x_months:
one: 1 mese
other: "%{count} mesi"
x_seconds:
one: 1 secondo
other: "%{count} secondi"
x_years:
one: 1 anno
other: "%{count} anni"

View File

@@ -64,7 +64,7 @@ Rails.application.routes.draw do
get "metrics", to: "dashboard#metrics"
resources :teams, only: %i[index show]
resources :clubs, only: [] do
resources :billing_invoices, only: %i[index new create], controller: "billing_invoices"
resources :billing_invoices, only: %i[index new create edit update], controller: "billing_invoices"
end
resources :sessions, only: %i[index show] do
member { post :stop }
@@ -112,7 +112,7 @@ Rails.application.routes.draw do
get "clubs/:id/billing", to: "clubs#billing", as: :club_billing
get "clubs/:id/billing/profile", to: "club_billing#profile", as: :club_billing_profile
patch "clubs/:id/billing/profile", to: "club_billing#update_profile"
post "clubs/:id/billing/sync_payments", to: "club_billing#sync_payments", as: :club_billing_sync_payments
post "clubs/:id/billing/cancel_subscription", to: "club_billing#cancel_subscription", as: :club_billing_cancel_subscription
get "clubs/:id/billing/invoices/:invoice_id", to: "club_billing#download_invoice", as: :club_billing_invoice
get "clubs/:id/checkout", to: "clubs#checkout", as: :club_checkout
post "clubs/:id/portal", to: "clubs#portal", as: :club_portal