Module: EffectiveCcbillHelper

Defined in:
app/helpers/effective_ccbill_helper.rb

Instance Method Summary collapse

Instance Method Details

#ccbill_customer_name(order, name = :full_name) ⇒ Object



17
18
19
20
21
22
23
# File 'app/helpers/effective_ccbill_helper.rb', line 17

def ccbill_customer_name(order, name = :full_name)
  if order.user.present? && order.user.try(name).present?
    order.user.public_send(name)
  elsif order.billing_address.present?
    order.billing_address.public_send(name)
  end
end

#ccbill_form_digest(order) ⇒ Object



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

def ccbill_form_digest(order)
  digested_variables = [
    ccbill_price(order.total),
    EffectiveOrders.ccbill[:form_period],
    EffectiveOrders.ccbill[:currency_code],
    EffectiveOrders.ccbill[:dynamic_pricing_salt]
  ]
  string = digested_variables.join('')
  Digest::MD5.hexdigest(string)
end

#ccbill_price(price) ⇒ Object



13
14
15
# File 'app/helpers/effective_ccbill_helper.rb', line 13

def ccbill_price(price)
  number_to_currency(price/100.0, unit: '')
end