Class: ActiveMerchant::Billing::Integrations::PayuIn::Helper
- Defined in:
- lib/active_merchant/billing/integrations/payu_in/helper.rb
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
- #form_fields ⇒ Object
- #generate_checksum(options = {}) ⇒ Object
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
Methods inherited from Helper
#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_method, mapping, #raw_html_fields, #shipping_address, #test?
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
45 46 47 48 |
# File 'lib/active_merchant/billing/integrations/payu_in/helper.rb', line 45 def initialize(order, account, = {}) super self.pg = 'CC' 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
50 51 52 |
# File 'lib/active_merchant/billing/integrations/payu_in/helper.rb', line 50 def form_fields @fields.merge(mappings[:checksum] => generate_checksum) end |
#generate_checksum(options = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/active_merchant/billing/integrations/payu_in/helper.rb', line 54 def generate_checksum( = {} ) checksum_fields = [ :order, :amount, :credential2, { :customer => [ :first_name, :email ] }, { :user_defined => [ :var1, :var2, :var3, :var4, :var5, :var6, :var7, :var8, :var9, :var10 ] } ] checksum_payload_items = checksum_fields.inject( [] ) do | items, field | if Hash === field then key = field.keys.first field[key].inject( items ){ |s,x| items.push( @fields[ mappings[key][x] ] ) } else items.push( @fields[ mappings[field] ] ) end end checksum_payload_items.push( ) PayuIn.checksum(@fields["key"], @fields["productinfo"], *checksum_payload_items ) end |