Module: MpayHelper

Defined in:
app/helpers/mpay_helper.rb

Instance Method Summary collapse

Instance Method Details

#humanize_p_type(p_type) ⇒ Object



2
3
4
5
6
7
8
9
# File 'app/helpers/mpay_helper.rb', line 2

def humanize_p_type(p_type)
  case p_type
  when "CC"
    t('CC')
  else
    t('Uknown')
  end
end

#payment_method(order) ⇒ Object



11
12
13
14
15
16
17
18
# File 'app/helpers/mpay_helper.rb', line 11

def payment_method(order)
  return "" unless order
  return "" if order.checkout.payments.empty?
  return "" if order.checkout.payment.source.nil?
  return "" unless order.checkout.payment.source.is_a?(MPaySource)
  
  "#{humanize_p_type(order.checkout.payment.source.p_type)}: #{order.checkout.payment.source.brand}"
end