Module: Workarea::Storefront::CreditCardsHelper

Defined in:
app/helpers/workarea/storefront/credit_cards_helper.rb

Instance Method Summary collapse

Instance Method Details

#all_payment_iconsObject



18
19
20
21
22
23
24
# File 'app/helpers/workarea/storefront/credit_cards_helper.rb', line 18

def all_payment_icons
  icons = credit_card_issuers.reduce('') do |memo, issuer|
    memo + credit_card_issuer_icon(issuer.optionize)
  end

  icons.html_safe
end

#card_icon_name(issuer) ⇒ Object



14
15
16
# File 'app/helpers/workarea/storefront/credit_cards_helper.rb', line 14

def card_icon_name(issuer)
  issuer.parameterize.underscore
end

#credit_card_issuer_icon(issuer) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'app/helpers/workarea/storefront/credit_cards_helper.rb', line 4

def credit_card_issuer_icon(issuer)
  icon_path = if card_icon_available?(issuer.optionize)
                "workarea/storefront/payment_icons/#{issuer.systemize}.svg"
              else
                'workarea/storefront/default_card.svg'
              end

  inline_svg(icon_path, class: "payment-icon payment-icon--#{issuer.downcase.dasherize}", title: issuer.humanize)
end