Aggiunge pagamento con bonifico e importo concordato per società.

Il piano si attiva solo dopo la conferma admin; Stripe resta a listino se non c'è un prezzo commerciale.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-18 23:20:43 +02:00
co-authored by Cursor
parent 1e4e0560f1
commit e436f5ece4
56 changed files with 1571 additions and 53 deletions
+34
View File
@@ -0,0 +1,34 @@
module Billing
class ClubQuote < ApplicationRecord
self.table_name = "billing_club_quotes"
PLAN_SLUGS = %w[premium_light premium_full].freeze
INTERVALS = Billing::Stripe::PriceCatalog::INTERVALS
belongs_to :club
belongs_to :created_by_admin, class_name: "AdminAccount", optional: true
validates :plan_slug, inclusion: { in: PLAN_SLUGS }
validates :billing_interval, inclusion: { in: INTERVALS }
validates :amount_cents, numericality: { greater_than: 0 }
validates :currency, presence: true
scope :active, -> { where(active: true) }
def matches?(plan_slug, interval)
self.plan_slug == plan_slug.to_s && billing_interval == interval.to_s
end
def plan
Plan[plan_slug]
end
def formatted_amount
Billing::Stripe::PriceCatalog.format_eur(amount_cents)
end
def price_label
Billing::Stripe::PriceCatalog.format_interval_price(amount_cents, billing_interval)
end
end
end