Sha256: 4477f6c70d5e690988a6ee44b1c9edf93def9d57f8dbdebe5ce8d4312f4b0c74

Contents?: true

Size: 1.19 KB

Versions: 16

Compression:

Stored size: 1.19 KB

Contents

require 'kaui/killbill_helper'

class Kaui::PaymentMethodsController < Kaui::EngineController
  def index
    if params[:key]
      params[:key].strip!
      begin
        @payment_methods = Kaui::KillbillHelper.get_payment_methods(params[:key], options_for_klient)
        render :show
      rescue => e
        flash.now[:error] = "Error while retrieving payment method for account: #{params[:key]}: #{as_string(e)}"
      end
    end
  end

  def show
    @payment_methods = []
    begin
      @payment_methods << Kaui::KillbillHelper.get_payment_method(params[:id], options_for_klient)
    rescue => e
      flash.now[:error] = "Error while retrieving payment method #{params[:id]}: #{as_string(e)}"
    end
  end

  def destroy
    payment_method_id = params[:id]
    if payment_method_id.present?
      begin
        Kaui::KillbillHelper.delete_payment_method(payment_method_id, params[:set_auto_pay_off], current_user, params[:reason], params[:comment], options_for_klient)
      rescue => e
        flash[:error] = "Error while deleting payment method #{payment_method_id}: #{as_string(e)}"
      end
    else
      flash[:notice] = 'Did not get the payment method id'
    end
    redirect_to :back
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
kaui-0.5.3 app/controllers/kaui/payment_methods_controller.rb
kaui-0.5.2 app/controllers/kaui/payment_methods_controller.rb
kaui-0.5.1 app/controllers/kaui/payment_methods_controller.rb
kaui-0.5.0 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.9 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.8 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.7 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.6 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.5 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.4 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.3 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.2 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.1 app/controllers/kaui/payment_methods_controller.rb
kaui-0.4.0 app/controllers/kaui/payment_methods_controller.rb
kaui-0.3.1 app/controllers/kaui/payment_methods_controller.rb
kaui-0.3.0 app/controllers/kaui/payment_methods_controller.rb