Skip to content

Commit

Permalink
Merge branch 'master' into 84372-decision-review-vanotify-on-form-error
Browse files Browse the repository at this point in the history
  • Loading branch information
dfong-adh authored Oct 16, 2024
2 parents 95bd52d + 9ec411d commit ca4295d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/services/sign_in/attribute_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ def handle_error(error_message, error_code, error: nil)

def mpi_response_profile
@mpi_response_profile ||=
if idme_uuid
if mhv_correlation_id
mpi_service.find_profile_by_identifier(identifier: mhv_correlation_id,
identifier_type: MPI::Constants::MHV_UUID)&.profile
elsif idme_uuid
mpi_service.find_profile_by_identifier(identifier: idme_uuid,
identifier_type: MPI::Constants::IDME_UUID)&.profile
elsif logingov_uuid
Expand Down
3 changes: 2 additions & 1 deletion lib/mpi/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module Constants

IDME_FULL_IDENTIFIER = 'PN^200VIDM^USDVA^A'
LOGINGOV_FULL_IDENTIFIER = 'PN^200VLGN^USDVA^A'
MHV_FULL_IDENTIFIER = 'PI^200MHS^USVHA^A'
DSLOGON_FULL_IDENTIFIER = 'NI^200DOD^USDOD^A'

ACTIVE_VHA_IDENTIFIER = 'USVHA^A'
Expand All @@ -42,6 +43,6 @@ module Constants
FIND_PROFILE_BY_ATTRIBUTES_ORCH_SEARCH_TYPE = 'find_profile_by_attributes_orch_search'
FIND_PROFILE_BY_FACILITY_TYPE = 'find_profile_by_facility'

QUERY_IDENTIFIERS = [ICN = 'ICN', IDME_UUID = 'idme', LOGINGOV_UUID = 'logingov'].freeze
QUERY_IDENTIFIERS = [ICN = 'ICN', IDME_UUID = 'idme', LOGINGOV_UUID = 'logingov', MHV_UUID = 'mhv'].freeze
end
end
2 changes: 2 additions & 0 deletions lib/mpi/messages/find_profile_by_identifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def correlation_identifier
"#{identifier}^#{Constants::IDME_FULL_IDENTIFIER}"
when Constants::LOGINGOV_UUID
"#{identifier}^#{Constants::LOGINGOV_FULL_IDENTIFIER}"
when Constants::MHV_UUID
"#{identifier}^#{Constants::MHV_FULL_IDENTIFIER}"
end
end

Expand Down
7 changes: 7 additions & 0 deletions spec/lib/mpi/messages/find_profile_by_identifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
it_behaves_like 'successfully built request'
end

context 'when identifier type is MHV_UUID' do
let(:identifier_type) { MPI::Constants::MHV_UUID }
let(:expected_identifier) { "#{identifier}^#{MPI::Constants::MHV_FULL_IDENTIFIER}" }

it_behaves_like 'successfully built request'
end

context 'when identifier type is an arbitrary value' do
let(:identifier_type) { 'some-identifier-type' }
let(:expected_error_message) { "Identifier type is not supported, identifier_type=#{identifier_type}" }
Expand Down
15 changes: 14 additions & 1 deletion spec/services/sign_in/attribute_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@
let(:add_person_response) { 'some-add-person-response' }
let(:find_profile_response) { 'some-find-profile-response' }
let(:update_profile_response) { 'some-update-profile-response' }
let(:identifier) { idme_uuid }
let(:identifier_type) { MPI::Constants::IDME_UUID }

before do
allow_any_instance_of(MPI::Service).to receive(:add_person_implicit_search).and_return(add_person_response)
allow_any_instance_of(MPI::Service).to receive(:find_profile_by_identifier).and_return(find_profile_response)
allow_any_instance_of(MPI::Service)
.to receive(:find_profile_by_identifier)
.with(identifier:, identifier_type:)
.and_return(find_profile_response)
allow_any_instance_of(MPI::Service).to receive(:update_profile).and_return(update_profile_response)
allow(Rails.logger).to receive(:info)
end
Expand Down Expand Up @@ -361,6 +366,8 @@
let(:address) { nil }
let(:mhv_correlation_id) { 'some-mhv-correlation-id' }
let(:email) { 'some-email' }
let(:identifier) { mhv_correlation_id }
let(:identifier_type) { MPI::Constants::MHV_UUID }

context 'and credential is missing mhv icn' do
let(:mhv_icn) { nil }
Expand Down Expand Up @@ -485,6 +492,8 @@
let(:country) { 'USA' }
let(:birth_date) { '1930-01-01' }
let(:email) { 'some-email' }
let(:identifier) { logingov_uuid }
let(:identifier_type) { MPI::Constants::LOGINGOV_UUID }

context 'and credential is missing email' do
let(:email) { nil }
Expand Down Expand Up @@ -606,6 +615,8 @@
let(:ssn) { '444444758' }
let(:birth_date) { '1930-01-01' }
let(:email) { 'some-email' }
let(:identifier) { idme_uuid }
let(:identifier_type) { MPI::Constants::IDME_UUID }

context 'and credential is missing email' do
let(:email) { nil }
Expand Down Expand Up @@ -662,6 +673,8 @@
let(:country) { 'USA' }
let(:birth_date) { '1930-01-01' }
let(:email) { 'some-email' }
let(:identifier) { idme_uuid }
let(:identifier_type) { MPI::Constants::IDME_UUID }

context 'and credential is missing email' do
let(:email) { nil }
Expand Down

0 comments on commit ca4295d

Please sign in to comment.