Class: Kaui::PaymentsController
- Inherits:
-
EngineController
- Object
- ApplicationController
- EngineController
- Kaui::PaymentsController
- Defined in:
- app/controllers/kaui/payments_controller.rb
Instance Method Summary collapse
Methods inherited from EngineController
Methods included from ErrorHelper
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/kaui/payments_controller.rb', line 17 def create payment = Kaui::Payment.new(params[:payment]) if payment.present? payment.external = (payment.external == "1") begin Kaui::KillbillHelper::create_payment(payment, payment.external, current_user, params[:reason], params[:comment]) flash[:info] = "Payment created" rescue => e flash[:error] = "Error while creating a new payment: #{as_string(e)}" end end redirect_to kaui_engine.account_timeline_path(:id => payment.account_id) end |
#new ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/kaui/payments_controller.rb', line 3 def new @account_id = params[:account_id] @invoice_id = params[:invoice_id] begin @invoice = Kaui::KillbillHelper::get_invoice(@invoice_id) @account = Kaui::KillbillHelper::get_account(@account_id) rescue => e flash[:error] = "Error while creating a new payment: #{as_string(e)}" redirect_to kaui_engine.account_timeline_path(:id => payment.account_id) end @payment = Kaui::Payment.new("accountId" => @account_id, "invoiceId" => @invoice_id, "amount" => @invoice.balance) end |