Sha256: 6d4a27a480bb94e9ac36ef984bda3acc299f076cac9be0508485a72e8d789b86

Contents?: true

Size: 1.12 KB

Versions: 18

Compression:

Stored size: 1.12 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, false, false, options_for_klient)

      if @invoice_id.present?
        @invoice = Kaui::KillbillHelper::get_invoice(@invoice_id, true, "NONE", options_for_klient)
        @charge = Kaui::Charge.new("accountId" => @account_id, "invoiceId" => @invoice_id)
      else
        @charge = Kaui::Charge.new("accountId" => @account_id)
      end
    rescue => e
      flash.now[: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, params[:reason], params[:comment], options_for_klient)
        flash[:notice] = "Charge created"
        redirect_to kaui_engine.account_timeline_path(:id => charge.account_id)
      rescue => e
        flash.now[:error] = "Error while creating a charge: #{as_string(e)}"
      end
    end
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
kaui-0.6.6 app/controllers/kaui/charges_controller.rb
kaui-0.6.5 app/controllers/kaui/charges_controller.rb
kaui-0.6.4 app/controllers/kaui/charges_controller.rb
kaui-0.6.3 app/controllers/kaui/charges_controller.rb
kaui-0.6.2 app/controllers/kaui/charges_controller.rb
kaui-0.6.1 app/controllers/kaui/charges_controller.rb
kaui-0.6.0 app/controllers/kaui/charges_controller.rb
kaui-0.5.3 app/controllers/kaui/charges_controller.rb
kaui-0.5.2 app/controllers/kaui/charges_controller.rb
kaui-0.5.1 app/controllers/kaui/charges_controller.rb
kaui-0.5.0 app/controllers/kaui/charges_controller.rb
kaui-0.4.9 app/controllers/kaui/charges_controller.rb
kaui-0.4.8 app/controllers/kaui/charges_controller.rb
kaui-0.4.7 app/controllers/kaui/charges_controller.rb
kaui-0.4.6 app/controllers/kaui/charges_controller.rb
kaui-0.4.5 app/controllers/kaui/charges_controller.rb
kaui-0.4.4 app/controllers/kaui/charges_controller.rb
kaui-0.4.3 app/controllers/kaui/charges_controller.rb