Class: AbtainBilling::Billing::Integrations::Quickpay::Helper
- Defined in:
- lib/abtain_billing/billing/integrations/quickpay/helper.rb
Constant Summary collapse
- MD5_CHECK_FIELDS =
[ :protocol, :msgtype, :merchant, :language, :ordernumber, :amount, :currency, :continueurl, :cancelurl, :callbackurl, :autocapture, :cardtypelock, :description, :ipaddress, :testmode ]
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_md5check ⇒ Object
- #generate_md5string ⇒ Object
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
- #md5secret(value) ⇒ Object
Methods inherited from Helper
#add_field, #add_fields, #billing_address, mapping, #shipping_address
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
7 8 9 10 11 12 13 14 15 |
# File 'lib/abtain_billing/billing/integrations/quickpay/helper.rb', line 7 def initialize(order, account, = {}) super add_field('protocol', '3') add_field('msgtype', 'authorize') add_field('language', 'da') add_field('autocapture', 0) add_field('testmode', 0) add_field('ordernumber', format_order_number(order)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class AbtainBilling::Billing::Integrations::Helper
Instance Method Details
#form_fields ⇒ Object
21 22 23 |
# File 'lib/abtain_billing/billing/integrations/quickpay/helper.rb', line 21 def form_fields @fields.merge('md5check' => generate_md5check) end |
#format_order_number(number) ⇒ Object
Limited to 20 digits max
34 35 36 |
# File 'lib/abtain_billing/billing/integrations/quickpay/helper.rb', line 34 def format_order_number(number) number.to_s.gsub(/[^\w_]/, '').rjust(4, "0")[0...20] end |
#generate_md5check ⇒ Object
29 30 31 |
# File 'lib/abtain_billing/billing/integrations/quickpay/helper.rb', line 29 def generate_md5check Digest::MD5.hexdigest(generate_md5string) end |
#generate_md5string ⇒ Object
25 26 27 |
# File 'lib/abtain_billing/billing/integrations/quickpay/helper.rb', line 25 def generate_md5string MD5_CHECK_FIELDS.map {|key| @fields[key.to_s]} * "" + @md5secret end |
#md5secret(value) ⇒ Object
17 18 19 |
# File 'lib/abtain_billing/billing/integrations/quickpay/helper.rb', line 17 def md5secret(value) @md5secret = value end |