Class: Saasaparilla::PaymentsController
Instance Method Summary
collapse
included, #require_current_billable
Instance Method Details
#create ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'app/controllers/saasaparilla/payments_controller.rb', line 12
def create
@payment = @subscription.payments.build(params[:payment])
if @payment.save
redirect_to edit_subscription_payment_path(@payment)
else
render :action => "new"
end
end
|
#edit ⇒ Object
21
22
23
|
# File 'app/controllers/saasaparilla/payments_controller.rb', line 21
def edit
end
|
#new ⇒ Object
8
9
10
|
# File 'app/controllers/saasaparilla/payments_controller.rb', line 8
def new
@payment = @subscription.payments.build
end
|
#show ⇒ Object
42
43
44
|
# File 'app/controllers/saasaparilla/payments_controller.rb', line 42
def show
@payment = @subscription.payments.find(params[:id])
end
|
#update ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/saasaparilla/payments_controller.rb', line 25
def update
begin
if @payment.update_attributes(params[:payment])
flash[:notice] = "Thank you, your payment has been processed."
redirect_to subscription_payment_path
else
flash[:error] = "An error has occured when trying to process your payment."
render :action => "edit"
end
rescue Exception => e
flash[:error] = e.message
render :action => "edit"
flash.discard
end
end
|