Class: Payola::SubscriptionsController
Instance Method Summary
collapse
#create_object, #object_status, #show_object
#render_payola_status
#find_affiliate
Instance Method Details
#change_plan ⇒ Object
28
29
30
31
32
33
|
# File 'app/controllers/payola/subscriptions_controller.rb', line 28
def change_plan
@subscription = Subscription.find_by!(guid: params[:guid])
Payola::ChangeSubscriptionPlan.call(@subscription, @plan, @quantity, @coupon, @trial_end)
confirm_with_message(t('payola.subscriptions.plan_updated'))
end
|
#change_quantity ⇒ Object
35
36
37
38
39
40
41
|
# File 'app/controllers/payola/subscriptions_controller.rb', line 35
def change_quantity
find_quantity
@subscription = Subscription.find_by!(guid: params[:guid])
Payola::ChangeSubscriptionQuantity.call(@subscription, @quantity)
confirm_with_message(t('payola.subscriptions.quantity_updated'))
end
|
#create ⇒ Object
18
19
20
|
# File 'app/controllers/payola/subscriptions_controller.rb', line 18
def create
create_object(Subscription, CreateSubscription, nil, :plan, @plan)
end
|
#destroy ⇒ Object
22
23
24
25
26
|
# File 'app/controllers/payola/subscriptions_controller.rb', line 22
def destroy
subscription = Subscription.find_by!(guid: params[:guid])
Payola::CancelSubscription.call(subscription, at_period_end: to_boolean(params[:at_period_end]))
redirect_to confirm_subscription_path(subscription)
end
|
#show ⇒ Object
10
11
12
|
# File 'app/controllers/payola/subscriptions_controller.rb', line 10
def show
show_object(Subscription)
end
|
#status ⇒ Object
14
15
16
|
# File 'app/controllers/payola/subscriptions_controller.rb', line 14
def status
object_status(Subscription)
end
|
#update_card ⇒ Object
43
44
45
46
47
48
|
# File 'app/controllers/payola/subscriptions_controller.rb', line 43
def update_card
@subscription = Subscription.find_by!(guid: params[:guid])
Payola::UpdateCard.call(@subscription, params[:stripeToken])
confirm_with_message(t('payola.subscriptions.card_updated'))
end
|