Class: ActiveMerchant::Billing::Integrations::Universal::Helper

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

Instance Attribute Summary

Attributes inherited from Helper

#fields

Instance Method Summary collapse

Methods inherited from Helper

#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_method, inherited, mapping, #raw_html_fields, #shipping_address, #test?

Constructor Details

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

Returns a new instance of Helper.



6
7
8
9
10
11
12
13
14
# File 'lib/active_merchant/billing/integrations/universal/helper.rb', line 6

def initialize(order, , options = {})
  super
  @forward_url = options[:forward_url]
  @key = options[:credential2]
  self.country = options[:country]
  self. = options[:account_name]
  self.transaction_type = options[:transaction_type]
  add_field 'x_test', @test.to_s
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveMerchant::Billing::Integrations::Helper

Instance Method Details

#credential_based_urlObject



16
17
18
# File 'lib/active_merchant/billing/integrations/universal/helper.rb', line 16

def credential_based_url
  @forward_url
end

#form_fieldsObject



20
21
22
# File 'lib/active_merchant/billing/integrations/universal/helper.rb', line 20

def form_fields
  sign_fields
end

#generate_signatureObject



28
29
30
# File 'lib/active_merchant/billing/integrations/universal/helper.rb', line 28

def generate_signature
  Universal.sign(@fields, @key)
end

#sign_fieldsObject



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

def sign_fields
  @fields.merge!('x_signature' => generate_signature)
end