components/financial_assistance/app/models/financial_assistance/factories/application_factory.rb
def fetch_matching_applicant(new_application, source_applicant)
        if source_applicant.person_hbx_id.present?
          applicant = new_application.applicants.where(person_hbx_id: source_applicant.person_hbx_id).first
          return applicant if applicant.present?
        end

        search_params = {dob: source_applicant.dob, last_name: source_applicant.last_name, first_name: source_applicant.first_name}
        search_params[:encrypted_ssn] = source_applicant.encrypted_ssn if source_applicant.ssn.present?
        new_application.applicants.where(search_params).first
      end
# First check is to verify if we can find applicant using person_hbx_id,
# and if we are not able to find using this then we want to check using
# a combination of dob, last_name and first_name.
First check is to verify if we can find applicant using person_hbx_id,
and if we are not able to find using this then we want to check using
a combination of dob, last_name and first_name.
First check is to verify if we can find applicant using person_hbx_id and if we are not able to find using this then we want to check using a combination of dob last_name and first_name .
def fetch_matching_applicant(new_application, source_applicant)
        if source_applicant.person_hbx_id.present?
          applicant = new_application.applicants.where(person_hbx_id: source_applicant.person_hbx_id).first
          return applicant if applicant.present?
        end
        search_params = {dob: source_applicant.dob, last_name: source_applicant.last_name, first_name: source_applicant.first_name}
        search_params[:encrypted_ssn] = source_applicant.encrypted_ssn if source_applicant.ssn.present?
        new_application.applicants.where(search_params).first
      end
def fetch_matching_applicant ( new_application , source_applicant ) if source_applicant . person_hbx_id . present? applicant = new_application . applicants . where ( person_hbx_id : source_applicant . person_hbx_id ) . first return applicant if applicant . present? end search_params = { dob : source_applicant . dob , last_name : source_applicant . last_name , first_name : source_applicant . first_name } search_params [ :encrypted_ssn ] = source_applicant . encrypted_ssn if source_applicant . ssn . present? new_application . applicants . where ( search_params ) . first end
First check is to verify if we can find applicant using person_hbx_id,
and if we are not able to find using this then we want to check using
a combination of dob, last_name and first_name.
First check is to verify if we can find applicant using person_hbx_id and if we are not able to find using this then we want to check using a combination of dob last_name and first_name .
new_application
source_applicant