class OffsitePayments::Integrations::Gestpay::Helper
Public Class Methods
new(order, account, options = {})
click to toggle source
Valid language codes
Italian => 1 English => 2 Spanish => 3 French => 4 Tedesco => 5
Calls superclass method
# File lib/offsite_payments/integrations/gestpay.rb, line 66 def initialize(order, account, options = {}) super add_field('PAY1_IDLANGUAGE', 2) end
Public Instance Methods
currency=(currency_code)
click to toggle source
# File lib/offsite_payments/integrations/gestpay.rb, line 91 def currency=(currency_code) code = CURRENCY_MAPPING[currency_code] raise ActionViewHelperError, "Invalid currency code #{currency_code} specified" if code.nil? add_field(mappings[:currency], code) end
customer(params = {})
click to toggle source
# File lib/offsite_payments/integrations/gestpay.rb, line 86 def customer(params = {}) add_field(mappings[:customer][:email], params[:email]) add_field('PAY1_CHNAME', "#{params[:first_name]} #{params[:last_name]}") end
encryption_query_string()
click to toggle source
# File lib/offsite_payments/integrations/gestpay.rb, line 114 def encryption_query_string fields = ['PAY1_AMOUNT', 'PAY1_SHOPTRANSACTIONID', 'PAY1_UICCODE'] encoded_params = fields.collect{ |field| "#{field}=#{CGI.escape(@fields[field])}" }.join(DELIMITER) "#{ENCRYPTION_PATH}?a=" + CGI.escape(@fields['ShopLogin']) + "&b=" + encoded_params + "&c=" + CGI.escape(VERSION) end
form_fields()
click to toggle source
# File lib/offsite_payments/integrations/gestpay.rb, line 98 def form_fields @encrypted_data ||= get_encrypted_string { 'a' => @fields['ShopLogin'], 'b' => @encrypted_data } end
get_encrypted_string()
click to toggle source
# File lib/offsite_payments/integrations/gestpay.rb, line 107 def get_encrypted_string response = ssl_get(Gestpay.service_url, encryption_query_string) parse_response(response) rescue GestpayEncryptionResponseError => e raise ActionViewHelperError.new(e) end