Sha256: 79ddb7c3113bbf8569ea7d65355f8ca3c668bd0995493f20f3bf1706c8b20ef3

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

Contents

class Kaui::ChargesController < Kaui::EngineController

  def new
    @account_id = params[:account_id]
    @invoice_id = params[:invoice_id]
    begin
      @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
    rescue => e
      flash[:error] = "Error while creating a charge: #{as_string(e)}"
    end
  end

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

    if charge.present?
      begin
        Kaui::KillbillHelper::create_charge(charge, params[:requested_date], current_user, nil, params[:comment])
        flash[:info] = "Charge created"
        redirect_to kaui_engine.account_timeline_path(:id => charge.account_id)
      rescue => e
        flash[:error] = "Error while creating a charge: #{as_string(e)}"
      end
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
kaui-0.2.6 app/controllers/kaui/charges_controller.rb
kaui-0.2.5 app/controllers/kaui/charges_controller.rb
kaui-0.2.4 app/controllers/kaui/charges_controller.rb
kaui-0.2.3 app/controllers/kaui/charges_controller.rb
kaui-0.2.2 app/controllers/kaui/charges_controller.rb
kaui-0.2.1 app/controllers/kaui/charges_controller.rb
kaui-0.2.0 app/controllers/kaui/charges_controller.rb
kaui-0.1.18 app/controllers/kaui/charges_controller.rb
kaui-0.1.17 app/controllers/kaui/charges_controller.rb
kaui-0.1.16 app/controllers/kaui/charges_controller.rb
kaui-0.1.15 app/controllers/kaui/charges_controller.rb
kaui-0.1.14 app/controllers/kaui/charges_controller.rb
kaui-0.1.12 app/controllers/kaui/charges_controller.rb
kaui-0.1.11 app/controllers/kaui/charges_controller.rb
kaui-0.1.10 app/controllers/kaui/charges_controller.rb
kaui-0.1.9 app/controllers/kaui/charges_controller.rb