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,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
|
||||
Reference in New Issue
Block a user