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:
@@ -0,0 +1,42 @@
|
||||
class AddBankTransferBilling < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :billing_club_quotes, id: :uuid do |t|
|
||||
t.references :club, null: false, foreign_key: true, type: :uuid, index: false
|
||||
t.string :plan_slug, null: false
|
||||
t.string :billing_interval, null: false
|
||||
t.integer :amount_cents, null: false
|
||||
t.string :currency, null: false, default: "eur"
|
||||
t.string :note
|
||||
t.boolean :active, null: false, default: true
|
||||
t.references :created_by_admin, foreign_key: { to_table: :admin_accounts }, type: :uuid
|
||||
t.timestamps
|
||||
end
|
||||
add_index :billing_club_quotes, :club_id, unique: true, where: "active = TRUE",
|
||||
name: "index_billing_club_quotes_active_club"
|
||||
|
||||
create_table :billing_transfer_orders, id: :uuid do |t|
|
||||
t.references :club, null: false, foreign_key: true, type: :uuid
|
||||
t.references :billing_club_quote, foreign_key: true, type: :uuid
|
||||
t.references :billing_payment, foreign_key: true, type: :uuid
|
||||
t.string :plan_slug, null: false
|
||||
t.string :billing_interval, null: false
|
||||
t.integer :amount_cents, null: false
|
||||
t.string :currency, null: false, default: "eur"
|
||||
t.string :kind, null: false
|
||||
t.string :status, null: false, default: "awaiting_payment"
|
||||
t.string :reference_code, null: false
|
||||
t.references :requested_by_user, foreign_key: { to_table: :users }, type: :uuid
|
||||
t.references :confirmed_by_admin, foreign_key: { to_table: :admin_accounts }, type: :uuid
|
||||
t.datetime :confirmed_at
|
||||
t.datetime :cancelled_at
|
||||
t.timestamps
|
||||
end
|
||||
add_index :billing_transfer_orders, :reference_code, unique: true
|
||||
add_index :billing_transfer_orders, :status
|
||||
add_index :billing_transfer_orders, :club_id, unique: true, where: "status = 'awaiting_payment'",
|
||||
name: "index_billing_transfer_orders_awaiting_club"
|
||||
|
||||
add_column :billing_payments, :provider, :string, null: false, default: "stripe"
|
||||
add_index :billing_payments, :provider
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user