class OffsitePayments::Integrations::Gestpay::Helper
def currency=(currency_code)
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
def customer(params = {})
def customer(params = {}) add_field(mappings[:customer][:email], params[:email]) add_field('PAY1_CHNAME', "#{params[:first_name]} #{params[:last_name]}") end
def encryption_query_string
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
def form_fields
def form_fields @encrypted_data ||= get_encrypted_string { 'a' => @fields['ShopLogin'], 'b' => @encrypted_data } end
def get_encrypted_string
def get_encrypted_string response = ssl_get(Gestpay.service_url, encryption_query_string) parse_response(response) rescue GestpayEncryptionResponseError => e raise ActionViewHelperError.new(e) end
def initialize(order, account, options = {})
French => 4
Spanish => 3
English => 2
Italian => 1
Valid language codes
def initialize(order, account, options = {}) super add_field('PAY1_IDLANGUAGE', 2) end