def validate_callback(payment_transaction, callback_response)
      validate_query_config payment_transaction
      validate_signature payment_transaction, callback_response

      unless allowed_statuses.include? callback_response.status
        raise ValidationError, "Invalid callback status: '#{callback_response.status}'"
      end

      error_message   = ''
      missed_fields   = []
      unequal_fields  = []

      callback_fields_definition.each do |field_name, property_path|
        if callback_response.fetch(field_name, nil).nil?
          missed_fields << field_name
        elsif property_path
          property_value = PropertyAccessor.get_value payment_transaction, property_path, false
          callback_value = callback_response.fetch field_name

          if property_value.to_s != callback_value.to_s
            unequal_fields << "CallbackResponse field '#{field_name}' value '#{callback_value}' does not " +
                              "equal PaymentTransaction property '#{property_path}' value '#{property_value}'."
          end
        end
      end

      unless missed_fields.empty?
        error_message << "Some required fields missed or empty in CallbackResponse: \n#{missed_fields.join(', ')}. \n"
      end

      unless unequal_fields.empty?
        error_message << "Some fields from CallbackResponse unequal properties " +
                         "from PaymentTransaction: \n#{unequal_fields.join(" \n")}"
      end

      unless error_message.empty?
        raise ValidationError, error_message
      end
    end
def validate_callback(payment_transaction, callback_response)
      validate_query_config payment_transaction
      validate_signature payment_transaction, callback_response

      unless allowed_statuses.include? callback_response.status
        raise ValidationError, "Invalid callback status: '#{callback_response.status}'"
      end

      error_message   = ''
      missed_fields   = []
      unequal_fields  = []

      callback_fields_definition.each do |field_name, property_path|
        if callback_response.fetch(field_name, nil).nil?
          missed_fields << field_name
        elsif property_path
          property_value = PropertyAccessor.get_value payment_transaction, property_path, false
          callback_value = callback_response.fetch field_name

          if property_value.to_s != callback_value.to_s
            unequal_fields << "CallbackResponse field '#{field_name}' value '#{callback_value}' does not " +
                              "equal PaymentTransaction property '#{property_path}' value '#{property_value}'."
          end
        end
      end

      unless missed_fields.empty?
        error_message << "Some required fields missed or empty in CallbackResponse: \n#{missed_fields.join(', ')}. \n"
      end

      unless unequal_fields.empty?
        error_message << "Some fields from CallbackResponse unequal properties " +
                         "from PaymentTransaction: \n#{unequal_fields.join(" \n")}"
      end

      unless error_message.empty?
        raise ValidationError, error_message
      end
    end
Validates callback

 @param    payment_transaction   [PaymentTransaction]    Payment transaction
 @param    callback_response     [CallbackResponse]      Callback from PaynetEasy