Class ActiveMerchant::Billing::Integrations::Gestpay::Helper
In: lib/active_merchant/billing/integrations/gestpay/helper.rb
Parent: ActiveMerchant::Billing::Integrations::Helper

Methods

Included Modules

Common

Public Class methods

Valid language codes

  Italian           => 1
  English               => 2
  Spanish               => 3
  French    => 4
  Tedesco   => 5

[Source]

    # File lib/active_merchant/billing/integrations/gestpay/helper.rb, line 13
13:           def initialize(order, account, options = {})
14:             super
15:             add_field('PAY1_IDLANGUAGE', 2)
16:           end

Public Instance methods

[Source]

    # File lib/active_merchant/billing/integrations/gestpay/helper.rb, line 38
38:           def currency=(currency_code)
39:             code = CURRENCY_MAPPING[currency_code]
40:                                         raise StandardError, "Invalid currency code #{currency_code} specified" if code.nil?
41:                                         
42:                                         add_field(mappings[:currency], code)
43:           end

[Source]

    # File lib/active_merchant/billing/integrations/gestpay/helper.rb, line 33
33:           def customer(params = {})
34:             add_field(mappings[:customer][:email], params[:email])
35:             add_field('PAY1_CHNAME', "#{params[:first_name]} #{params[:last_name]}")
36:           end

[Source]

    # File lib/active_merchant/billing/integrations/gestpay/helper.rb, line 59
59:           def encryption_query_string
60:             fields = ['PAY1_AMOUNT', 'PAY1_SHOPTRANSACTIONID', 'PAY1_UICCODE']
61:           
62:             encoded_params = fields.collect{ |field| "#{field}=#{CGI.escape(@fields[field])}" }.join(DELIMITER)
63:           
64:             "#{ENCRYPTION_PATH}?a=" + CGI.escape(@fields['ShopLogin']) + "&b=" + encoded_params + "&c=" + CGI.escape(VERSION)
65:           end

[Source]

    # File lib/active_merchant/billing/integrations/gestpay/helper.rb, line 45
45:           def form_fields
46:             @encrypted_data ||= get_encrypted_string
47:                       
48:             {
49:               'a' => @fields['ShopLogin'],
50:               'b' => @encrypted_data
51:             }
52:           end

[Source]

    # File lib/active_merchant/billing/integrations/gestpay/helper.rb, line 54
54:           def get_encrypted_string
55:             response = ssl_get(Gestpay.service_url, encryption_query_string)
56:             parse_response(response)
57:           end

[Validate]