Class: ActiveMerchant::Billing::Integrations::Yeepay::Helper

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Helper.



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

def initialize(order, , options = {})
  super(order, , options)
  add_field('p0_Cmd', 'Buy')
end

Instance Method Details

#form_fieldsObject



22
23
24
# File 'lib/active_merchant/billing/integrations/yeepay/helper.rb', line 22

def form_fields
  @fields.merge('hmac' => hmac_md5_hexdigest)
end

#hmac_md5_hexdigestObject



26
27
28
# File 'lib/active_merchant/billing/integrations/yeepay/helper.rb', line 26

def hmac_md5_hexdigest
  OpenSSL::HMAC.hexdigest("md5", KEY, @fields.sort.collect{|s| s[1]}.join)
end