Module: Admin::PaymentsHelper

Defined in:
app/helpers/admin/payments_helper.rb

Instance Method Summary collapse

Instance Method Details

#payment_method_name(payment) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/admin/payments_helper.rb', line 2

def payment_method_name(payment)
  # hack to allow us to retrieve the name of a "deleted" payment method
  id = payment.payment_method_id
  # hack because the payment method is not set in the mpay confirmation controller. fix it
  if id == nil then
    PaymentMethod.find_by_id(842616224).name
  else
   
    # TODO: include destroyed payment methods
    method = PaymentMethod.find_by_id(id)

    # somehow we've got invalid payment methods in our system
    if method.nil?
      PaymentMethod.find_by_id(842616224).name
    else
      method.name
    end
  end
end