Sha256: 4ecccd4778393d0230db965e8c31c4a62325362e7f9c92685ee0a4bde9d063ea

Contents?: true

Size: 1.01 KB

Versions: 81

Compression:

Stored size: 1.01 KB

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

        # Not cancelled by default.  Overridden in the child class.
        def cancelled?
          false
        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

81 entries across 81 versions & 11 rubygems

Version Path
tanga_activemerchant-1.38.0.5 lib/active_merchant/billing/integrations/return.rb
tanga_activemerchant-1.38.0.4 lib/active_merchant/billing/integrations/return.rb
tanga_activemerchant-1.38.0.3 lib/active_merchant/billing/integrations/return.rb
tanga_activemerchant-1.38.0.2 lib/active_merchant/billing/integrations/return.rb
tanga_activemerchant-1.38.0.1 lib/active_merchant/billing/integrations/return.rb
tanga_activemerchant-1.38.0 lib/active_merchant/billing/integrations/return.rb
tanga_activemerchant-1.37.0 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.43.3 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.43.1 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.43.0 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.9 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.8 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.7 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.6 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.5 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.4 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.3 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.2 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.1 lib/active_merchant/billing/integrations/return.rb
activemerchant-1.42.0 lib/active_merchant/billing/integrations/return.rb