Sha256: 73f8de3f175180b0ff1d5420ab0923cf53a1bfa077c672ce671200c0d55c1ec3
Contents?: true
Size: 1.08 KB
Versions: 16
Compression:
Stored size: 1.08 KB
Contents
class Kaui::PaymentsController < Kaui::EngineController 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 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 end
Version data entries
16 entries across 16 versions & 1 rubygems