lib/bitkassa/payment_result.rb
def valid?
      return false if raw_payload.nil? || raw_payload.empty?
      return false if raw_authentication.nil? || raw_authentication.empty?
      return false unless json_valid?

      Authentication.valid?(raw_authentication, json_payload)
    end
def valid?
      return false if raw_payload.nil? || raw_payload.empty?
      return false if raw_authentication.nil? || raw_authentication.empty?
      return false unless json_valid?

      Authentication.valid?(raw_authentication, json_payload)
    end
Wether or not this payment result can be considered valid.
 Authentication is checked, payload and authentication should be available
 and the decoded JSON should be valid JSON.
 When the result is valid, it is safe to assume no-one tampered with it
 and that it was sent by Bitkassa.