module OffsitePayments::Integrations::Gestpay::Common

Constants

CURRENCY_MAPPING
DECRYPTION_PATH
DELIMITER
ENCRYPTION_PATH
GestpayEncryptionResponseError
VERSION

Public Instance Methods

parse_response(response) click to toggle source
# File lib/offsite_payments/integrations/gestpay.rb, line 36
def parse_response(response)
  case response
  when /#cryptstring#(.*)#\/cryptstring#/, /#decryptstring#(.*)#\/decryptstring#/
    $1
  when /#error#(.*)#\/error#/
    raise GestpayEncryptionResponseError, "An error occurred retrieving the encrypted string from GestPay: #{$1}"
  else
    raise GestpayEncryptionResponseError, "No response was received by GestPay"
  end
end
ssl_get(url, path) click to toggle source
# File lib/offsite_payments/integrations/gestpay.rb, line 47
def ssl_get(url, path)
  uri = URI.parse(url)
  site = Net::HTTP.new(uri.host, uri.port)
  site.use_ssl = true
  site.verify_mode    = OpenSSL::SSL::VERIFY_NONE
  site.get(path).body
rescue Timeout::Error, Errno::ECONNRESET, Errno::ETIMEDOUT
  raise ActionViewHelperError, "Error occured while contacting payment gateway. Please try again."
end