mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
Plug a leak for customers with no subscription
This commit is contained in:
parent
f5faa8877c
commit
5296e486e6
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,12 @@ get '/plan/?' do
|
|||
if parent_site && parent_site.unconverted_legacy_supporter?
|
||||
customer = Stripe::Customer.retrieve(parent_site.stripe_customer_id)
|
||||
subscription = customer.subscriptions.first
|
||||
|
||||
# Subscription was deleted, add to free plan.
|
||||
if subscription.nil?
|
||||
subscription = customer.subscriptions.create plan: 'free'
|
||||
end
|
||||
|
||||
parent_site.stripe_subscription_id = subscription.id
|
||||
parent_site.plan_type = subscription.plan.id
|
||||
parent_site.save_changes
|
||||
|
|
Loading…
Add table
Reference in a new issue