Sha256: ad18f110bb865bdaffca0e473907ea8dbdd9c39d92b3d27af16c094c9e632d1c

Contents?: true

Size: 922 Bytes

Versions: 12

Compression:

Stored size: 922 Bytes

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      class Return
        attr_accessor :params
        attr_reader :notification
      
        def initialize(query_string, options = {})
          @params  = parse(query_string)
          @options = options
        end
      
        # Successful by default. Overridden in the child class
        def success?
          true
        end
      
        def message
          
        end
        
        def parse(query_string)
          return {} if query_string.blank?
          
          query_string.split('&').inject({}) do |memo, chunk|
            next if chunk.empty?
            key, value = chunk.split('=', 2)
            next if key.empty?
            value = value.nil? ? nil : CGI.unescape(value)
            memo[CGI.unescape(key)] = value
            memo
          end
        end 
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
activemerchant-1.13.0 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.12.1 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.12.0 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.11.0 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.10.0 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.9.4 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.9.3 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.9.2 lib/active_merchant/billing/integrations/return.rb
n8_activemerchant-1.9.3 lib/active_merchant/billing/integrations/return.rb
maedana-activemerchant-1.9.1.1 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.9.1 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.9.0 lib/active_merchant/billing/integrations/return.rb