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
+52 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2026_08_13_184100) do
ActiveRecord::Schema[7.2].define(version: 2026_08_18_220000) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@@ -51,6 +51,21 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_13_184100) do
t.index ["username"], name: "index_admin_accounts_on_username", unique: true
end
create_table "billing_club_quotes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "club_id", null: false
t.string "plan_slug", null: false
t.string "billing_interval", null: false
t.integer "amount_cents", null: false
t.string "currency", default: "eur", null: false
t.string "note"
t.boolean "active", default: true, null: false
t.uuid "created_by_admin_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["club_id"], name: "index_billing_club_quotes_active_club", unique: true, where: "(active = true)"
t.index ["created_by_admin_id"], name: "index_billing_club_quotes_on_created_by_admin_id"
end
create_table "billing_invoices", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "club_id", null: false
t.uuid "billing_payment_id"
@@ -87,11 +102,40 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_13_184100) do
t.string "receipt_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "provider", default: "stripe", null: false
t.index ["club_id", "paid_at"], name: "index_billing_payments_on_club_id_and_paid_at"
t.index ["club_id"], name: "index_billing_payments_on_club_id"
t.index ["provider"], name: "index_billing_payments_on_provider"
t.index ["stripe_invoice_id"], name: "index_billing_payments_on_stripe_invoice_id", unique: true, where: "(stripe_invoice_id IS NOT NULL)"
end
create_table "billing_transfer_orders", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "club_id", null: false
t.uuid "billing_club_quote_id"
t.uuid "billing_payment_id"
t.string "plan_slug", null: false
t.string "billing_interval", null: false
t.integer "amount_cents", null: false
t.string "currency", default: "eur", null: false
t.string "kind", null: false
t.string "status", default: "awaiting_payment", null: false
t.string "reference_code", null: false
t.uuid "requested_by_user_id"
t.uuid "confirmed_by_admin_id"
t.datetime "confirmed_at"
t.datetime "cancelled_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["billing_club_quote_id"], name: "index_billing_transfer_orders_on_billing_club_quote_id"
t.index ["billing_payment_id"], name: "index_billing_transfer_orders_on_billing_payment_id"
t.index ["club_id"], name: "index_billing_transfer_orders_awaiting_club", unique: true, where: "((status)::text = 'awaiting_payment'::text)"
t.index ["club_id"], name: "index_billing_transfer_orders_on_club_id"
t.index ["confirmed_by_admin_id"], name: "index_billing_transfer_orders_on_confirmed_by_admin_id"
t.index ["reference_code"], name: "index_billing_transfer_orders_on_reference_code", unique: true
t.index ["requested_by_user_id"], name: "index_billing_transfer_orders_on_requested_by_user_id"
t.index ["status"], name: "index_billing_transfer_orders_on_status"
end
create_table "club_memberships", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "user_id", null: false
t.uuid "club_id", null: false
@@ -427,9 +471,16 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_13_184100) do
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "billing_club_quotes", "admin_accounts", column: "created_by_admin_id"
add_foreign_key "billing_club_quotes", "clubs"
add_foreign_key "billing_invoices", "billing_payments"
add_foreign_key "billing_invoices", "clubs"
add_foreign_key "billing_payments", "clubs"
add_foreign_key "billing_transfer_orders", "admin_accounts", column: "confirmed_by_admin_id"
add_foreign_key "billing_transfer_orders", "billing_club_quotes"
add_foreign_key "billing_transfer_orders", "billing_payments"
add_foreign_key "billing_transfer_orders", "clubs"
add_foreign_key "billing_transfer_orders", "users", column: "requested_by_user_id"
add_foreign_key "club_memberships", "clubs"
add_foreign_key "club_memberships", "users"
add_foreign_key "device_states", "stream_sessions"