Sha256: 7db3fcae0b4e02c1be65e34a36c424e82250cb5170c0ca941547e3dda2c09879

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

module AbtainBilling #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Gestpay
        module Common
          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'
          }
          
          def parse_response(response)
            case response
            when /#cryptstring#(.*)#\/cryptstring#/, /#decryptstring#(.*)#\/decryptstring#/
              $1
            when /#error#(.*)#\/error#/
              raise StandardError, "An error occurred retrieving the encrypted string from GestPay: #{$1}"
            else
              raise StandardError, "No response was received by GestPay"
            end
          end
          
          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
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
abtain_billing-1.03 lib/abtain_billing/billing/integrations/gestpay/common.rb
abtain_billing-1.02 lib/abtain_billing/billing/integrations/gestpay/common.rb