implement skeuocard and upgrade capability

This commit is contained in:
Kyle Drake 2014-10-24 18:16:00 -07:00
parent f2180b1385
commit d2f46fdf66
41 changed files with 304 additions and 42 deletions

36
app.rb
View file

@ -267,6 +267,42 @@ get '/plan/?' do
erb :'plan/index'
end
post '/plan/update' do
require_login
DB.transaction do
customer = Stripe::Customer.create(
card: params[:stripe_token],
description: "#{parent_site.username} - #{parent_site.id}",
email: (current_site.email || parent_site.email),
plan: params[:plan_type]
)
parent_site.update(
stripe_customer_id: customer.id,
plan_ended: false,
plan_type: params[:plan_type]
)
if current_site.email || parent_site.email
EmailWorker.perform_async({
from: 'web@neocities.org',
reply_to: 'contact@neocities.org',
to: current_site.email || parent_site.email,
subject: "[Neocities] You've become a supporter!",
body: Tilt.new('./views/templates/email_subscription.erb', pretty: true).render(self, plan_name: Site::PLAN_FEATURES[params[:plan_type].to_sym][:name])
})
end
end
redirect '/plan/thanks'
end
get '/plan/thanks' do
require_login
erb :'plan/thanks'
end
=begin
get '/plan/?' do
@title = 'Supporter'