Class: ActiveMerchant::Billing::Integrations::Epay::Helper
- Defined in:
- lib/active_merchant/billing/integrations/epay/helper.rb
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
- #form_fields ⇒ Object
-
#format_order_number(number) ⇒ Object
Limited to 20 digits max.
- #generate_md5hash ⇒ Object
- #generate_md5string ⇒ Object
-
#initialize(order, merchantnumber, options = {}) ⇒ Helper
constructor
A new instance of Helper.
- #md5secret(value) ⇒ Object
Methods inherited from Helper
#add_field, #add_fields, #add_raw_html_field, #billing_address, mapping, #raw_html_fields, #shipping_address, #test?
Constructor Details
#initialize(order, merchantnumber, options = {}) ⇒ Helper
Returns a new instance of Helper.
7 8 9 10 11 12 13 |
# File 'lib/active_merchant/billing/integrations/epay/helper.rb', line 7 def initialize(order, merchantnumber, = {}) super add_field('windowstate', 3) add_field('language', '0') add_field('orderid', format_order_number(order)) @fields = Hash[@fields.sort] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveMerchant::Billing::Integrations::Helper
Instance Method Details
#form_fields ⇒ Object
19 20 21 |
# File 'lib/active_merchant/billing/integrations/epay/helper.rb', line 19 def form_fields @fields.merge('hash' => generate_md5hash) end |
#format_order_number(number) ⇒ Object
Limited to 20 digits max
32 33 34 |
# File 'lib/active_merchant/billing/integrations/epay/helper.rb', line 32 def format_order_number(number) number.to_s.gsub(/[^\w_]/, '').rjust(4, "0")[0...20] end |
#generate_md5hash ⇒ Object
27 28 29 |
# File 'lib/active_merchant/billing/integrations/epay/helper.rb', line 27 def generate_md5hash Digest::MD5.hexdigest(generate_md5string) end |
#generate_md5string ⇒ Object
23 24 25 |
# File 'lib/active_merchant/billing/integrations/epay/helper.rb', line 23 def generate_md5string @fields.sort.each.map { |key, value| key != 'hash' ? value.to_s : ''} * "" + @md5secret end |
#md5secret(value) ⇒ Object
15 16 17 |
# File 'lib/active_merchant/billing/integrations/epay/helper.rb', line 15 def md5secret(value) @md5secret = value end |