Class: OffsitePayments::Integrations::Platron::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/offsite_payments/integrations/platron.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.



24
25
26
27
28
29
30
31
# File 'lib/offsite_payments/integrations/platron.rb', line 24

def initialize(order, , options = {})
  @secret_key = options.delete(:secret)
  @path = options.delete(:path)
  description = options.delete(:description)
  super
  self.add_field('pg_salt', rand(36**15).to_s(36))
  self.add_field('pg_description', description)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OffsitePayments::Helper

Instance Method Details

#form_fieldsObject



33
34
35
# File 'lib/offsite_payments/integrations/platron.rb', line 33

def form_fields
  @fields.merge('pg_sig' => Common.generate_signature(@fields, @path, @secret_key))
end

#paramsObject



37
38
39
# File 'lib/offsite_payments/integrations/platron.rb', line 37

def params
  @fields
end