Sha256: adf64a1e4beaa1d269e84052856f6186facaab0109444ee685070ac600b99268

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

require 'kaui/killbill_helper'

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

  def show
    @payment_methods = []
    begin
      @payment_methods << Kaui::KillbillHelper.get_payment_method(params[:id])
    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])
      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

3 entries across 3 versions & 1 rubygems

Version Path
kaui-0.2.5 app/controllers/kaui/payment_methods_controller.rb
kaui-0.2.4 app/controllers/kaui/payment_methods_controller.rb
kaui-0.2.3 app/controllers/kaui/payment_methods_controller.rb