Class: ActiveMerchant::Billing::Integrations::Pay19::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/pay19/helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(order, account, options = {}) ⇒ Helper

Returns a new instance of Helper.



17
18
19
20
21
22
# File 'lib/active_merchant/billing/integrations/pay19/helper.rb', line 17

def initialize(order, , options = {})
  super(order, ACCOUNT, options)
  add_field('version_id', '2.00')
  add_field('order_date', DateTime.now.strftime("%Y%m%d"))
  add_field('pc_id', '') # Keep empty if pm_id is empty
end

Instance Method Details

#form_fieldsObject



24
25
26
# File 'lib/active_merchant/billing/integrations/pay19/helper.rb', line 24

def form_fields
  @fields.merge('verifystring' => sign)
end

#signObject



28
29
30
31
32
33
# File 'lib/active_merchant/billing/integrations/pay19/helper.rb', line 28

def sign
  Digest::MD5.hexdigest(%w(version_id merchant_id order_date order_id
    amount currency returl pm_id pc_id).collect{
      |name| "#{name}=#{@fields[name]}"
    }.join('&') + "&merchant_key=#{KEY}")
end