Sha256: e65e9fb84e8f510399e989b05cd165ce661c7892784ef739b4161800980d86f9

Contents?: true

Size: 684 Bytes

Versions: 38

Compression:

Stored size: 684 Bytes

Contents

module EffectiveCcbillHelper
  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

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

  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
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
effective_orders-2.1.16 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.15 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.14 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.13 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.12 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.10 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.9 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.8 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.7 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.6 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.5 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.4 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.3 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.2 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.1 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.0 app/helpers/effective_ccbill_helper.rb
effective_orders-2.0.1 app/helpers/effective_ccbill_helper.rb
effective_orders-2.0.0 app/helpers/effective_ccbill_helper.rb