Sha256: 4eee8c0a92994a6875cd66dde48a9ac8a6d5325c075c41909f7f4e71502b80ae

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

class Kaui::ChargesController < Kaui::EngineController

  def new
    @account_id = params[:account_id]
    @invoice_id = params[:invoice_id]

    @account = Kaui::KillbillHelper::get_account(@account_id)

    if @invoice_id.present?
      @invoice = Kaui::KillbillHelper::get_invoice(@invoice_id)
      @charge = Kaui::Charge.new("accountId" => @account_id, "invoiceId" => @invoice_id)
    else
      @charge = Kaui::Charge.new("accountId" => @account_id)
    end

  end

  def create
    charge = Kaui::Charge.new(params[:charge])

    if charge.present?
      success = Kaui::KillbillHelper::create_charge(charge, params[:requested_date], current_user, nil, params[:comment])
      if success
        flash[:info] = "Charge created"
      end
    else
      flash[:error] = "No charge to process"
    end
    redirect_to account_timeline_path(:id => charge.account_id)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kaui-0.1.3 app/controllers/kaui/charges_controller.rb
kaui-0.1.2 app/controllers/kaui/charges_controller.rb