Module: OffsitePayments::Integrations::Gestpay::Common
- Included in:
- Helper, Notification
- Defined in:
- lib/offsite_payments/integrations/gestpay.rb
Constant Summary collapse
- GestpayEncryptionResponseError =
Class.new(StandardError)
- VERSION =
"2.0"
- ENCRYPTION_PATH =
"/CryptHTTPS/Encrypt.asp"
- DECRYPTION_PATH =
"/CryptHTTPS/Decrypt.asp"
- DELIMITER =
'*P1*'
- CURRENCY_MAPPING =
{ 'EUR' => '242', 'ITL' => '18', 'BRL' => '234', 'USD' => '1', 'JPY' => '71', 'HKD' => '103' }
Instance Method Summary collapse
Instance Method Details
#parse_response(response) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# 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) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# 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 |