Sha256: ea3d06fc32fd219e99d5ba279884f2e9915cb81749c8018983b04f4359270f63
Contents?: true
Size: 1.9 KB
Versions: 3
Compression:
Stored size: 1.9 KB
Contents
require 'rest_client' require 'json' class Kaui::AccountsController < Kaui::EngineController def index if params[:account_id].present? redirect_to account_path(params[:account_id]) end end def show key = params[:id] if key.present? # support id (UUID) and external key search if key =~ /[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}/ @account = Kaui::KillbillHelper.get_account(key) else @account = Kaui::KillbillHelper.get_account_by_external_key(key) end if @account.present? # TODO: add when payment methods are implemented # @payment_methods = Kaui::KillbillHelper.get_payment_methods(@account_id) # unless @payment_methods.is_a?(Array) # flash[:error] = "No payment methods for account #{@account_id}" # redirect_to :action => :index # end else flash[:error] = "Account #{@account_id} not found" redirect_to :action => :index end else flash[:error] = "No id given" end end def payment_methods @external_key = params[:id] if @external_key.present? @payment_methods = Kaui::KillbillHelper::get_payment_methods(@external_key) unless @payment_methods.is_a?(Array) flash[:notice] = "No payment methods for external_key '#{@external_key}'" redirect_to :action => :index return end else flash[:notice] = "No id given" end end def set_default_payment_method @external_key = params[:id] # TODO redirect_to :back end def delete_payment_method @external_key = params[:id] @payment_method_id = params[:payment_method_id] if @external_key.present? && @payment_method_id.present? Kaui::KillbillHelper::delete_payment_method(@external_key, @payment_method_id) else flash[:notice] = "No id given" end redirect_to :back end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kaui-0.0.5 | app/controllers/kaui/accounts_controller.rb |
kaui-0.0.4 | app/controllers/kaui/accounts_controller.rb |
kaui-0.0.3 | app/controllers/kaui/accounts_controller.rb |