Module: Kaui::AccountHelper
- Defined in:
- app/helpers/kaui/account_helper.rb
Instance Method Summary collapse
- #account_closed? ⇒ Boolean
- #billing_info_margin ⇒ Object
- #deposit_plugin_available? ⇒ Boolean
- #email_notifications_plugin_available? ⇒ Boolean
- #pretty_account_identifier ⇒ Object
Instance Method Details
#account_closed? ⇒ 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 account_closed? 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_user, session)) rescue StandardError [] end is_account_closed = false blocking_states.each do |blocking_state| if blocking_state.state_name.eql?('CLOSE_ACCOUNT') is_account_closed = true break end end is_account_closed end |
#billing_info_margin ⇒ Object
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
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_user, session)).first rescue StandardError false end |
#email_notifications_plugin_available? ⇒ 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_user, session)).first rescue StandardError false end |
#pretty_account_identifier ⇒ Object
5 6 7 8 9 |
# File 'app/helpers/kaui/account_helper.rb', line 5 def pretty_account_identifier return nil if @account.nil? Kaui.pretty_account_identifier.call(@account) end |