app/models/consumer_role.rb
# collect all verification types user can have based on information he provided
collect all verification types user can have based on information he provided
collect all verification types user can have based on information he provided
def ensure_verification_types
    if person
      live_types = []
      live_types << LOCATION_RESIDENCY if EnrollRegistry.feature_enabled?(:location_residency_verification_type)
      live_types << 'Social Security Number' if ssn
      if EnrollRegistry.feature_enabled?(:indian_alaskan_tribe_details)
        live_types << 'American Indian Status' if !(tribal_state.nil? || tribal_state.empty?) && !(tribal_name.nil? || tribal_name.empty?)
      else
        live_types << 'American Indian Status' unless tribal_id.nil? || tribal_id.empty?
      end
      if us_citizen
        live_types << 'Citizenship'
      else
        live_types << 'Immigration status' if us_citizen != nil
      end
      inactive = verification_types.map(&:type_name) - live_types
      new_types = live_types - verification_types.active.map(&:type_name)
      person.deactivate_types(inactive)
      new_types.each do |new_type|
        person.add_new_verification_type(new_type)
      end
      person.families.each do |family|
        family.update_family_document_status!
      end
    end
  end
def ensure_verification_types if person live_types = [ ] live_types << LOCATION_RESIDENCY if EnrollRegistry . feature_enabled? ( :location_residency_verification_type ) live_types << 'Social Security Number' if ssn if EnrollRegistry . feature_enabled? ( :indian_alaskan_tribe_details ) live_types << 'American Indian Status' if ! ( tribal_state . nil? || tribal_state . empty? ) && ! ( tribal_name . nil? || tribal_name . empty? ) else live_types << 'American Indian Status' unless tribal_id . nil? || tribal_id . empty? end if us_citizen live_types << 'Citizenship' else live_types << 'Immigration status' if us_citizen != nil end inactive = verification_types . map ( & :type_name ) - live_types new_types = live_types - verification_types . active . map ( & :type_name ) person . deactivate_types ( inactive ) new_types . each do | new_type | person . add_new_verification_type ( new_type ) end person . families . each do | family | family . update_family_document_status! end end end
collect all verification types user can have based on information he provided
collect all verification types user can have based on information he provided