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
@@ -0,0 +1,27 @@
require "rails_helper"
RSpec.describe ExpireEndedSubscriptionsJob do
let(:club) do
c = Club.create!(name: "Expire BT", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff")
load Rails.root.join("db/seeds/plans.rb")
c
end
it "passa a Free un piano pagato con bonifico scaduto" do
Billing::AssignPlan.call(
club: club,
plan_slug: "premium_light",
status: "active",
stripe_attrs: {
billing_interval: "monthly",
current_period_start: 2.months.ago,
current_period_end: 1.day.ago,
cancel_at_period_end: true
}
)
described_class.new.perform
expect(club.reload.subscription.plan.slug).to eq("free")
end
end