Module: PaymentMethodHelper

Defined in:
app/helpers/payment_method_helper.rb

Instance Method Summary collapse

Instance Method Details

#available_payment_options_iconsObject



15
16
17
18
19
# File 'app/helpers/payment_method_helper.rb', line 15

def available_payment_options_icons
  PaymentMethod.order('id desc').map do |pm|
    call_engineized_method(pm, :available_payment_options_icons)
  end.compact.flatten
end

#call_engineized_method(payment_method, method_name, *args) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'app/helpers/payment_method_helper.rb', line 41

def call_engineized_method(payment_method, method_name, *args)
  method_name_in_engine = engineized_name(payment_method, method_name)
  if self.respond_to?(method_name_in_engine)
    if args.any?
      self.send(method_name_in_engine, *args)
    else
      self.send(method_name_in_engine)
    end
  end
end

#engineized_name(payment_method, method_name) ⇒ Object



37
38
39
# File 'app/helpers/payment_method_helper.rb', line 37

def engineized_name(payment_method, method_name)
  "nimbleshop_#{payment_method.demodulized_underscore}_#{method_name}".intern
end

#icon_for_order_payment(order) ⇒ Object



21
22
23
24
25
# File 'app/helpers/payment_method_helper.rb', line 21

def icon_for_order_payment(order)
  if pm = order.payment_method
    call_engineized_method(pm, :icon_for_order_payment, order)
  end
end

#next_payment_processing_action(order) ⇒ Object



3
4
5
6
7
# File 'app/helpers/payment_method_helper.rb', line 3

def next_payment_processing_action(order)
  if pm = order.payment_method
    call_engineized_method(pm, :next_payment_processing_action, order)
  end
end

#nimbleshop_crud_form(payment_method) ⇒ Object



33
34
35
# File 'app/helpers/payment_method_helper.rb', line 33

def nimbleshop_crud_form(payment_method)
  call_engineized_method(payment_method, :crud_form)
end

#order_show_extra_info(order) ⇒ Object



9
10
11
12
13
# File 'app/helpers/payment_method_helper.rb', line 9

def order_show_extra_info(order)
  if pm = order.payment_method
    call_engineized_method(pm, :order_show_extra_info, order)
  end
end

#payment_info_for_buyer(order) ⇒ Object



27
28
29
30
31
# File 'app/helpers/payment_method_helper.rb', line 27

def payment_info_for_buyer(order)
  if pm = order.payment_method
    call_engineized_method(pm, :payment_info_for_buyer, order)
  end
end