Sha256: ab2dd9a3e747fcf9d1dccdb33e9d8f37b1f86bd7e0d003b5781d5b6ad6b30fe0

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 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 account_timeline_path(:id => payment.account_id)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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