Class: ActiveMerchant::Billing::Integrations::Citrus::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/citrus/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, mapping, #raw_html_fields, #shipping_address, #test?

Constructor Details

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

Returns a new instance of Helper.



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

def initialize(order, , options = {})
  super
  add_field 'paymentMode', 'NET_BANKING'
  add_field 'reqtime', (Time.now.to_i * 1000).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

#form_fieldsObject



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

def form_fields
  @fields.merge(mappings[:checksum] => generate_checksum)
end

#generate_checksumObject



32
33
34
35
# File 'lib/active_merchant/billing/integrations/citrus/helper.rb', line 32

def generate_checksum
  checksum_fields = @fields["pmt_url"] + @fields["orderAmount"].to_s + @fields["merchantTxnId"] + @fields["currency"]
  Citrus.checksum(@fields["secret_key"],  checksum_fields )
end