Sha256: 2b2a6c16adc208b0c436afef444357e51b69cb4079019427076f48bf477d37b7

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 KB

Contents

require 'digest/md5'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Valitor
        module ResponseFields
          def success?
            valid?
          end
          alias :complete? :success?
          
          def test?
            @options[:test]
          end
          
          def order
            params['Tilvisunarnumer']
          end
          
          def received_at
            params['Dagsetning']
          end
          
          def transaction_id
            params['VefverslunSalaID']
          end
          
          def status
            "OK"
          end
          
          def card_type
            params['Kortategund']
          end
          
          def card_last_four
            params['KortnumerSidustu']
          end
          
          def authorization_number
            params['Heimildarnumer']
          end
          
          def transaction_number
            params['Faerslunumer']
          end
          
          def customer_name
            params['Nafn']
          end
          
          def customer_address
            params['Heimilisfang']
          end
          
          def customer_zip
            params['Postnumer']
          end
          
          def customer_city
            params['Stadur']
          end
          
          def customer_country
            params['Land']
          end
          
          def customer_email
            params['Tolvupostfang']
          end
          
          def customer_comment
            params['Athugasemdir']
          end
          
          def valid?
            unless @valid
              @valid = if(security_number = @options[:password])
                (params['RafraenUndirskriftSvar'] == Digest::MD5.hexdigest("#{security_number}#{order}"))
              else
                true
              end
            end
            @valid
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activemerchant-1.12.1 lib/active_merchant/billing/integrations/valitor/response_fields.rb
activemerchant-1.12.0 lib/active_merchant/billing/integrations/valitor/response_fields.rb
activemerchant-1.11.0 lib/active_merchant/billing/integrations/valitor/response_fields.rb