Class: ActiveMerchant::Billing::Integrations::Citrus::Helper
- Defined in:
- lib/active_merchant/billing/integrations/citrus/helper.rb
Constant Summary collapse
- SANDBOX_URL =
'https://sandbox.citruspay.com/'.freeze
- STAGING_URL =
'https://stg.citruspay.com/'.freeze
- PRODUCTION_URL =
'https://www.citruspay.com/'.freeze
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
- #credential_based_url ⇒ Object
- #form_fields ⇒ Object
- #generate_checksum ⇒ 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, inherited, mapping, #raw_html_fields, #shipping_address, #test?
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
39 40 41 42 43 |
# File 'lib/active_merchant/billing/integrations/citrus/helper.rb', line 39 def initialize(order, account, = {}) 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
#credential_based_url ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_merchant/billing/integrations/citrus/helper.rb', line 25 def credential_based_url pmt_url = @fields['pmt_url'] case ActiveMerchant::Billing::Base.integration_mode when :production PRODUCTION_URL + pmt_url when :test SANDBOX_URL + pmt_url when :staging STAGING_URL + pmt_url else raise StandardError, "Integration mode set to an invalid value: #{mode}" end end |
#form_fields ⇒ Object
45 46 47 |
# File 'lib/active_merchant/billing/integrations/citrus/helper.rb', line 45 def form_fields @fields.merge(mappings[:checksum] => generate_checksum) end |
#generate_checksum ⇒ Object
49 50 51 52 |
# File 'lib/active_merchant/billing/integrations/citrus/helper.rb', line 49 def generate_checksum checksum_fields = @fields["pmt_url"] + @fields["orderAmount"].to_s + @fields["merchantTxnId"] + @fields["currency"] Citrus.checksum(@fields["secret_key"], checksum_fields ) end |