Sha256: 1609fba10596e2b3a9e3e01a4b9648194a0381dfae46eede153d76cfe8fdddff

Contents?: true

Size: 877 Bytes

Versions: 3

Compression:

Stored size: 877 Bytes

Contents

class Kaui::PaymentsController < Kaui::EngineController

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

    @payment = Kaui::Payment.new("invoiceId" => @invoice_id)

    @account = Kaui::KillbillHelper::get_account(@account_id)
    @invoice = Kaui::KillbillHelper::get_invoice(@invoice_id)
  end

  def create
    external_payment = Kaui::Payment.new(params[:external_payment])

    if external_payment.present?
      success = Kaui::KillbillHelper::create_external_payment(payment, current_user, params[:reason], params[:comment])
      if success
        flash[:info] = "External Payment created"
      # else
      #   flash[:error] = "Error while creating external payment"
      end
    else
      flash[:error] = "No external payment to process"
    end
    redirect_to account_timeline_path(:id => params[:account_id])
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kaui-0.1.0 app/controllers/kaui/payments_controller.rb
kaui-0.0.9 app/controllers/kaui/payments_controller.rb
kaui-0.0.8 app/controllers/kaui/payments_controller.rb