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-3.2.3 app/helpers/effective_ccbill_helper.rb
effective_orders-3.2.2 app/helpers/effective_ccbill_helper.rb
effective_orders-3.2.1 app/helpers/effective_ccbill_helper.rb
effective_orders-3.2.0 app/helpers/effective_ccbill_helper.rb
effective_orders-3.1.7 app/helpers/effective_ccbill_helper.rb
effective_orders-3.1.6 app/helpers/effective_ccbill_helper.rb
effective_orders-3.1.4 app/helpers/effective_ccbill_helper.rb
effective_orders-3.1.3 app/helpers/effective_ccbill_helper.rb
effective_orders-3.1.0 app/helpers/effective_ccbill_helper.rb
effective_orders-3.0.4 app/helpers/effective_ccbill_helper.rb
effective_orders-3.0.3 app/helpers/effective_ccbill_helper.rb
effective_orders-3.0.2 app/helpers/effective_ccbill_helper.rb
effective_orders-3.0.1 app/helpers/effective_ccbill_helper.rb
effective_orders-3.0.0 app/helpers/effective_ccbill_helper.rb
effective_orders-2.2.4 app/helpers/effective_ccbill_helper.rb
effective_orders-2.2.3 app/helpers/effective_ccbill_helper.rb
effective_orders-2.2.2 app/helpers/effective_ccbill_helper.rb
effective_orders-2.2.1 app/helpers/effective_ccbill_helper.rb
effective_orders-2.2.0 app/helpers/effective_ccbill_helper.rb
effective_orders-2.1.17 app/helpers/effective_ccbill_helper.rb