Skip to content

Commit a1cb9d8

Browse files
committed
Remove plan param, not needed for now with only one plan
1 parent 4985bb0 commit a1cb9d8

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

app/controllers/account/subscriptions_controller.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ def show
77
end
88

99
def create
10-
plan = Plan.find(params[:plan])
11-
1210
session = Stripe::Checkout::Session.create \
1311
customer: find_or_create_stripe_customer,
1412
mode: "subscription",
15-
line_items: [{ price: plan.stripe_price_id, quantity: 1 }],
13+
line_items: [ { price: Plan.paid.stripe_price_id, quantity: 1 } ],
1614
success_url: account_subscription_url + "?session_id={CHECKOUT_SESSION_ID}",
1715
cancel_url: account_subscription_url,
18-
metadata: { account_id: @account.id, plan_key: plan.key }
16+
metadata: { account_id: @account.id, plan_key: Plan.paid.key }
1917

2018
redirect_to session.url, allow_other_host: true
2119
end
@@ -47,7 +45,7 @@ def find_stripe_customer
4745

4846
def create_stripe_customer
4947
Stripe::Customer.create(email: Current.user.identity.email_address, name: @account.name, metadata: { account_id: @account.id }).tap do |customer|
50-
@account.create_subscription!(stripe_customer_id: customer.id, plan_key: params[:plan], status: "incomplete")
48+
@account.create_subscription!(stripe_customer_id: customer.id, plan_key: Plan.paid.key, status: "incomplete")
5149
end
5250
end
5351
end

app/views/account/settings/_subscription.html.erb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,4 @@
33
<p><%= subscription_period_end_action(subscription) %>: <strong><%= subscription.current_period_end.to_date.to_fs(:long) %></strong></p>
44
<% end %>
55

6-
<% if subscription.canceled? %>
7-
<%= button_to "Subscribe Again", account_subscription_path(plan: :monthly_v1), class: "btn btn--primary", data: { turbo: false } %>
8-
<% else %>
9-
<%= link_to "Manage Billing", account_billing_portal_path, class: "btn" %>
10-
<% end %>
6+
<%= link_to "Manage Billing", account_billing_portal_path, class: "btn" %>

app/views/account/settings/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<p>Current plan: <strong><%= Current.account.plan.name %></strong></p>
1515

1616
<% if Current.account.plan.free? %>
17-
<%= button_to "Upgrade to Monthly", account_subscription_path(plan: :monthly_v1), class: "btn btn--primary", data: { turbo: false } %>
17+
<%= button_to "Upgrade to Monthly", account_subscription_path, class: "btn btn--primary", data: { turbo: false } %>
1818
<% end %>
1919

2020
<% if Current.account.subscription %>

db/schema.rb

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)