Sha256: b76cdad4866adda3e2db2fe3f16ea306bc080e05a13ef279e8634bfee62160ab

Contents?: true

Size: 831 Bytes

Versions: 3

Compression:

Stored size: 831 Bytes

Contents

class Kaui::PaymentsController < Kaui::EngineController

  def new
    @account_id = params[:account_id]
    @invoice_id = params[:invoice_id]
    @invoice = Kaui::KillbillHelper::get_invoice(@invoice_id)
    @account = Kaui::KillbillHelper::get_account(@account_id)

    @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?
      success = Kaui::KillbillHelper::create_payment(payment, params[:external], current_user, params[:reason], params[:comment])
      if success
        flash[:info] = "Payment created"
      end
    else
      flash[:error] = "No payment to process"
    end
    redirect_to kaui_engine.account_timeline_path(:id => payment.account_id)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kaui-0.1.6 app/controllers/kaui/payments_controller.rb
kaui-0.1.5 app/controllers/kaui/payments_controller.rb
kaui-0.1.4 app/controllers/kaui/payments_controller.rb