app/services/form1010cg/service.rb
def icn_for(form_subject)
      cached_icn = @cache[:icns][form_subject]
      return cached_icn unless cached_icn.nil?

      form_subject_data = claim.parsed_form[form_subject]

      if form_subject_data['ssnOrTin'].nil?
        log_mpi_search_result form_subject, :skipped
        return @cache[:icns][form_subject] = NOT_FOUND
      end

      response = mpi_service.find_profile(build_user_identity_for(form_subject_data))

      if response.status == 'OK'
        log_mpi_search_result form_subject, :found
        return @cache[:icns][form_subject] = response.profile.icn
      end

      if response.status == 'NOT_FOUND'
        log_mpi_search_result form_subject, :not_found
        return @cache[:icns][form_subject] = NOT_FOUND
      end

      raise response.error if response.error

      @cache[:icns][form_subject] = NOT_FOUND
    end
# Will search MVI for the provided form subject and return (1) the matching profile's ICN or (2) `NOT_FOUND`.
# The result will be cached and subsequent calls will return the cached value, preventing additional api requests.
#
# @param form_subject [String] The key in the claim's data that contains this person's info (ex: "veteran")
# @return [String | NOT_FOUND] Returns the icn of the form subject if found, and NOT_FOUND otherwise.
Will search MVI for the provided form subject and return (1) the matching profile's ICN or (2) `NOT_FOUND`.
The result will be cached and subsequent calls will return the cached value, preventing additional api requests.
Will search MVI for the provided form subject and return ( 1 ) the matching profile ' s ICN or ( 2 ) ` NOT_FOUND ` . The result will be cached and subsequent calls will return the cached value preventing additional api requests .
def icn_for(form_subject)
      cached_icn = @cache[:icns][form_subject]
      return cached_icn unless cached_icn.nil?
      form_subject_data = claim.parsed_form[form_subject]
      if form_subject_data['ssnOrTin'].nil?
        log_mpi_search_result form_subject, :skipped
        return @cache[:icns][form_subject] = NOT_FOUND
      end
      response = mpi_service.find_profile(build_user_identity_for(form_subject_data))
      if response.status == 'OK'
        log_mpi_search_result form_subject, :found
        return @cache[:icns][form_subject] = response.profile.icn
      end
      if response.status == 'NOT_FOUND'
        log_mpi_search_result form_subject, :not_found
        return @cache[:icns][form_subject] = NOT_FOUND
      end
      raise response.error if response.error
      @cache[:icns][form_subject] = NOT_FOUND
    end
def icn_for ( form_subject ) cached_icn = @cache [ :icns ] [ form_subject ] return cached_icn unless cached_icn . nil? form_subject_data = claim . parsed_form [ form_subject ] if form_subject_data [ 'ssnOrTin' ] . nil? log_mpi_search_result form_subject , :skipped return @cache [ :icns ] [ form_subject ] = NOT_FOUND end response = mpi_service . find_profile ( build_user_identity_for ( form_subject_data ) ) if response . status == 'OK' log_mpi_search_result form_subject , :found return @cache [ :icns ] [ form_subject ] = response . profile . icn end if response . status == 'NOT_FOUND' log_mpi_search_result form_subject , :not_found return @cache [ :icns ] [ form_subject ] = NOT_FOUND end raise response . error if response . error @cache [ :icns ] [ form_subject ] = NOT_FOUND end
Will search MVI for the provided form subject and return (1) the matching profile's ICN or (2) `NOT_FOUND`.
Will search MVI for the provided form subject and return ( 1 ) the matching profile ' s ICN or ( 2 ) ` NOT_FOUND ` .
Returns the icn of the form subject if found, and NOT_FOUND otherwise.
Returns the icn of the form subject if found and NOT_FOUND otherwise .
String | NOT_FOUND
form_subject
The key in the claim's data that contains this person's info (ex: "veteran")
The key in the claim ' s data that contains this person ' s info ( ex : " veteran " )