Class: OffsitePayments::Integrations::Citrus::Helper
- Defined in:
- lib/offsite_payments/integrations/citrus.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.
54 55 56 57 58 |
# File 'lib/offsite_payments/integrations/citrus.rb', line 54 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 OffsitePayments::Helper
Instance Method Details
#credential_based_url ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/offsite_payments/integrations/citrus.rb', line 40 def credential_based_url pmt_url = @fields['pmt_url'] case OffsitePayments.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
60 61 62 |
# File 'lib/offsite_payments/integrations/citrus.rb', line 60 def form_fields @fields.merge(mappings[:checksum] => generate_checksum) end |
#generate_checksum ⇒ Object
64 65 66 67 |
# File 'lib/offsite_payments/integrations/citrus.rb', line 64 def generate_checksum checksum_fields = @fields["pmt_url"] + @fields["orderAmount"].to_s + @fields["merchantTxnId"] + @fields["currency"] Citrus.checksum(@fields["secret_key"], checksum_fields ) end |