Module: Kaui::AccountHelper

Defined in:
app/helpers/kaui/account_helper.rb

Instance Method Summary collapse

Instance Method Details

#account_closed?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/kaui/account_helper.rb', line 23

def 
  return false if @account.nil?

  # NOTE: we ignore errors here, so that the call doesn't prevent the screen to load. While the error isn't surfaced, if there is an error with the catalog for instance,
  # the AJAX call to compute the next invoice date should hopefully trigger a flash error.
  blocking_states = begin
    @account.blocking_states('ACCOUNT', 'account-service', 'NONE', Kaui.current_tenant_user_options(current_user, session))
  rescue StandardError
    []
  end

   = false
  blocking_states.each do |blocking_state|
    if blocking_state.state_name.eql?('CLOSE_ACCOUNT')
       = true
      break
    end
  end
  
end

#billing_info_marginObject



44
45
46
47
48
49
50
51
52
# File 'app/helpers/kaui/account_helper.rb', line 44

def billing_info_margin
  style = ''
  style = "#{style}margin-top:15px;" unless can?(:trigger, Kaui::Payment) && can?(:credit, Kaui::Account) && can?(:charge, Kaui::Account)

  style = "#{style}margin-bottom:15px;" unless can? :trigger, Kaui::Invoice

  style = "style='#{style}'" unless style.empty?
  style
end

#deposit_plugin_available?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'app/helpers/kaui/account_helper.rb', line 17

def deposit_plugin_available?
  Killbill::Deposit::DepositClient.deposit_plugin_available?(Kaui.current_tenant_user_options(current_user, session)).first
rescue StandardError
  false
end

#email_notifications_plugin_available?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'app/helpers/kaui/account_helper.rb', line 11

def email_notifications_plugin_available?
  Kenui::EmailNotificationService.email_notification_plugin_available?(Kaui.current_tenant_user_options(current_user, session)).first
rescue StandardError
  false
end

#pretty_account_identifierObject



5
6
7
8
9
# File 'app/helpers/kaui/account_helper.rb', line 5

def 
  return nil if @account.nil?

  Kaui..call(@account)
end