Sha256: 08eeecd198160b6af22e21a0e15fd2401443b8b696745f60bacfe93e3cf96a7c
Contents?: true
Size: 1.13 KB
Versions: 7
Compression:
Stored size: 1.13 KB
Contents
require_dependency "wbase/application_controller" module Wbase class SubscriptionsController < ApplicationController before_action :require_login! layout 'wbase/auth' def new if current_user.trial? redirect_to '/' return end if params[:plan] current_user.selected_plan = params[:plan] current_user.save end end def create # Does the user have a subscription? # - if so see if it matches the planid that was passed service = StartSubscription.new(current_user, subscription_params) service.call if service.valid? login(service.user) AdminMailer.new_subscription(service.user).deliver_later # ActivateDripSubscriberJob.perform_later(service.user) redirect_to '/subscribed' else flash.now[:errors] = service.errors render :new end end private def subscription_params params .require(:subscription) .permit( :plan_id, :stripe_id, :credit_card_token, :card_type, :last_four ) end end end
Version data entries
7 entries across 7 versions & 1 rubygems