diff --git a/app/controllers/v1/sessions_controller.rb b/app/controllers/v1/sessions_controller.rb index bdf9d5cfe6f..07b957e1a27 100644 --- a/app/controllers/v1/sessions_controller.rb +++ b/app/controllers/v1/sessions_controller.rb @@ -154,12 +154,12 @@ def user_login(saml_response) user_session_form = UserSessionForm.new(saml_response) raise_saml_error(user_session_form) unless user_session_form.valid? mhv_unverified_validation(user_session_form.user) - create_user_verification(user_session_form.user) + user_verification = create_user_verification(user_session_form.user_identity) @current_user, @session_object = user_session_form.persist set_cookies after_login_actions - if @current_user.needs_accepted_terms_of_use + if user_verification.user_account.needs_accepted_terms_of_use? redirect_to url_service.terms_of_use_redirect_url else redirect_to url_service.login_redirect_url @@ -167,14 +167,14 @@ def user_login(saml_response) login_stats(:success) end - def create_user_verification(user) - user_verifier_object = OpenStruct.new({ sign_in: user.identity.sign_in, - mhv_correlation_id: user.mhv_correlation_id, - idme_uuid: user.idme_uuid, - edipi: user.identity.edipi, - logingov_uuid: user.logingov_uuid, - icn: user.icn }) - Login::UserVerifier.new(user_verifier_object).perform + def create_user_verification(user_identity) + Login::UserVerifier.new(login_type: user_identity.sign_in&.dig(:service_name), + auth_broker: user_identity.sign_in&.dig(:auth_broker), + mhv_uuid: user_identity.mhv_credential_uuid, + idme_uuid: user_identity.idme_uuid, + dslogon_uuid: user_identity.edipi, + logingov_uuid: user_identity.logingov_uuid, + icn: user_identity.icn).perform end def mhv_unverified_validation(user) diff --git a/app/models/user.rb b/app/models/user.rb index 207cf45d36d..57c82db75c3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -153,6 +153,7 @@ def mhv_account_type end def mhv_correlation_id + return unless can_create_mhv_account? return mhv_user_account.id if mhv_user_account.present? mpi_mhv_correlation_id if active_mhv_ids&.one? @@ -473,12 +474,12 @@ def create_mhv_account_async MHV::AccountCreatorJob.perform_async(user_verification_id) end + private + def can_create_mhv_account? loa3? && !needs_accepted_terms_of_use end - private - def mpi_profile return nil unless identity && mpi diff --git a/app/services/login/user_verifier.rb b/app/services/login/user_verifier.rb index a001bb30d1f..e537aeb04d0 100644 --- a/app/services/login/user_verifier.rb +++ b/app/services/login/user_verifier.rb @@ -2,14 +2,20 @@ module Login class UserVerifier - def initialize(user) - @login_type = user.sign_in&.dig(:service_name) - @auth_broker = user.sign_in&.dig(:auth_broker) - @mhv_uuid = user.mhv_credential_uuid - @idme_uuid = user.idme_uuid - @dslogon_uuid = user.edipi - @logingov_uuid = user.logingov_uuid - @icn = user.icn.presence + def initialize(login_type:, # rubocop:disable Metrics/ParameterLists + auth_broker:, + mhv_uuid:, + idme_uuid:, + dslogon_uuid:, + logingov_uuid:, + icn:) + @login_type = login_type + @auth_broker = auth_broker + @mhv_uuid = mhv_uuid + @idme_uuid = idme_uuid + @dslogon_uuid = dslogon_uuid + @logingov_uuid = logingov_uuid + @icn = icn.presence @deprecated_log = nil @user_account_mismatch_log = nil end diff --git a/app/services/sign_in/user_code_map_creator.rb b/app/services/sign_in/user_code_map_creator.rb index bc3de6fb069..c2f7aeccf1a 100644 --- a/app/services/sign_in/user_code_map_creator.rb +++ b/app/services/sign_in/user_code_map_creator.rb @@ -66,15 +66,6 @@ def device_sso state_payload.scope == Constants::Auth::DEVICE_SSO end - def user_verifier_object - @user_verifier_object ||= OpenStruct.new({ idme_uuid:, - logingov_uuid:, - sign_in:, - edipi:, - mhv_credential_uuid:, - icn: verified_icn }) - end - def user_code_map @user_code_map ||= UserCodeMap.new(login_code:, type: state_payload.type, @@ -84,7 +75,13 @@ def user_code_map end def user_verification - @user_verification ||= Login::UserVerifier.new(user_verifier_object).perform + @user_verification ||= Login::UserVerifier.new(login_type: sign_in[:service_name], + auth_broker: sign_in[:auth_broker], + mhv_uuid: mhv_credential_uuid, + idme_uuid:, + dslogon_uuid: edipi, + logingov_uuid:, + icn: verified_icn).perform end def user_account diff --git a/app/sidekiq/education_form/forms/va_1995.rb b/app/sidekiq/education_form/forms/va_1995.rb index 2dd919618f3..4ac1c6b2267 100644 --- a/app/sidekiq/education_form/forms/va_1995.rb +++ b/app/sidekiq/education_form/forms/va_1995.rb @@ -26,7 +26,7 @@ def form_benefit end def header_form_type - @applicant.rudisillReview == 'Yes' ? 'V1995R' : 'V1995' + @applicant.rudisillReview == 'Yes' ? '1995R' : 'V1995' end end end diff --git a/app/sidekiq/education_form/templates/1995.erb b/app/sidekiq/education_form/templates/1995.erb index eca258a2673..98b3b80e739 100644 --- a/app/sidekiq/education_form/templates/1995.erb +++ b/app/sidekiq/education_form/templates/1995.erb @@ -5,7 +5,7 @@ <%= form_benefit %> <% end -%> *START* -VA Form 22-1995<%= @applicant.rudisillReview == "Yes" ? "R" : "" %> +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/modules/claims_api/app/controllers/concerns/claims_api/disability_compensation_validations.rb b/modules/claims_api/app/controllers/concerns/claims_api/disability_compensation_validations.rb index 0d73d59f291..e5f86145ea7 100644 --- a/modules/claims_api/app/controllers/concerns/claims_api/disability_compensation_validations.rb +++ b/modules/claims_api/app/controllers/concerns/claims_api/disability_compensation_validations.rb @@ -411,30 +411,44 @@ def validate_form_526_disability_secondary_disabilities! end def validate_form_526_disability_classification_code! - return if (form_attributes['disabilities'].pluck('classificationCode') - [nil]).blank? + form_attributes['disabilities'].each_with_index do |disability, index| + classification_code = disability['classificationCode'] + next if classification_code.nil? || classification_code.blank? + + if bgs_classification_ids.include?(classification_code) + validate_form_526_disability_classification_code_end_date!(classification_code, index) + else + raise ::Common::Exceptions::InvalidFieldValue.new("disabilities.#{index}.classificationCode", + classification_code) + end + end + end - form_attributes['disabilities'].each do |disability| - next if disability['classificationCode'].blank? - next if bgs_classification_ids.include?(disability['classificationCode']) + def validate_form_526_disability_classification_code_end_date!(classification_code, index) + bgs_disability = contention_classification_type_code_list.find { |d| d[:clsfcn_id] == classification_code } + end_date = bgs_disability[:end_dt] if bgs_disability - raise ::Common::Exceptions::InvalidFieldValue.new('disabilities.classificationCode', - disability['classificationCode']) - end + return if end_date.nil? + + return if Date.parse(end_date) >= Time.zone.today + + raise ::Common::Exceptions::InvalidFieldValue.new("disabilities.#{index}.classificationCode", classification_code) + end + + def contention_classification_type_code_list + @contention_classification_type_code_list ||= if Flipper.enabled?(:claims_api_526_validations_v1_local_bgs) + service = ClaimsApi::StandardDataService.new( + external_uid: Settings.bgs.external_uid, + external_key: Settings.bgs.external_key + ) + service.get_contention_classification_type_code_list + else + bgs_service.data.get_contention_classification_type_code_list + end end def bgs_classification_ids - return @bgs_classification_ids if @bgs_classification_ids.present? - - contention_classification_type_codes = if Flipper.enabled?(:claims_api_526_validations_v1_local_bgs) - contention_service = ClaimsApi::StandardDataService.new( - external_uid: Settings.bgs.external_uid, - external_key: Settings.bgs.external_key - ) - contention_service.get_contention_classification_type_code_list - else - bgs_service.data.get_contention_classification_type_code_list - end - @bgs_classification_ids = contention_classification_type_codes.pluck(:clsfcn_id) + contention_classification_type_code_list.pluck(:clsfcn_id) end def validate_form_526_disability_approximate_begin_date! diff --git a/modules/claims_api/app/controllers/concerns/claims_api/v2/claims_requests/tracked_items.rb b/modules/claims_api/app/controllers/concerns/claims_api/v2/claims_requests/tracked_items.rb index 226fcb98e8e..e160cf6de8a 100644 --- a/modules/claims_api/app/controllers/concerns/claims_api/v2/claims_requests/tracked_items.rb +++ b/modules/claims_api/app/controllers/concerns/claims_api/v2/claims_requests/tracked_items.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'bgs_service/tracked_item_service' module ClaimsApi module V2 module ClaimsRequests @@ -9,7 +10,7 @@ module TrackedItems def find_tracked_items!(claim_id) return if claim_id.blank? - @tracked_items = local_bgs_service.find_tracked_items(claim_id)[:dvlpmt_items] || [] + @tracked_items = tracked_item_service.find_tracked_items(claim_id)[:dvlpmt_items] || [] end def find_tracked_item(id) @@ -100,6 +101,15 @@ def build_tracked_item(tracked_item, status, item, wwsnfy: false) uploads_allowed: } end + + private + + def tracked_item_service + @tracked_item_service ||= ClaimsApi::TrackedItemService.new( + external_uid: target_veteran.participant_id, + external_key: target_veteran.participant_id + ) + end end end end diff --git a/modules/claims_api/lib/bgs_service/tracked_item_service.rb b/modules/claims_api/lib/bgs_service/tracked_item_service.rb new file mode 100644 index 00000000000..9b55111e246 --- /dev/null +++ b/modules/claims_api/lib/bgs_service/tracked_item_service.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module ClaimsApi + class TrackedItemService < ClaimsApi::LocalBGS + def bean_name + 'TrackedItemService/TrackedItemService' + end + + def find_tracked_items(id) + body = Nokogiri::XML::DocumentFragment.parse <<~EOXML + #{id} + EOXML + + make_request(endpoint: 'TrackedItemService/TrackedItemService', action: 'findTrackedItems', body:, + key: 'BenefitClaim') + end + end +end diff --git a/modules/claims_api/spec/concerns/claims_api/v2/claims_requests/tracked_items_spec.rb b/modules/claims_api/spec/concerns/claims_api/v2/claims_requests/tracked_items_spec.rb index 0d18fc9028b..f02a37a0171 100644 --- a/modules/claims_api/spec/concerns/claims_api/v2/claims_requests/tracked_items_spec.rb +++ b/modules/claims_api/spec/concerns/claims_api/v2/claims_requests/tracked_items_spec.rb @@ -1,13 +1,14 @@ # frozen_string_literal: true require 'rails_helper' +require 'bgs_service/tracked_item_service' class FakeController include ClaimsApi::V2::ClaimsRequests::TrackedItems include ClaimsApi::V2::ClaimsRequests::TrackedItemsAssistance - def local_bgs_service - @local_bgs_service ||= ClaimsApi::LocalBGS.new( + def tracked_item_service + @tracked_item_service ||= ClaimsApi::TrackedItemService.new( external_uid: target_veteran.participant_id, external_key: target_veteran.participant_id ) diff --git a/modules/claims_api/spec/requests/metadata_spec.rb b/modules/claims_api/spec/requests/metadata_spec.rb index cbc67ff8baf..642fedbcc1a 100644 --- a/modules/claims_api/spec/requests/metadata_spec.rb +++ b/modules/claims_api/spec/requests/metadata_spec.rb @@ -6,6 +6,7 @@ require 'bgs_service/e_benefits_bnft_claim_status_web_service' require 'bgs_service/org_web_service' require 'bgs_service/intent_to_file_web_service' +require 'bgs_service/tracked_item_service' require 'bgs_service/person_web_service' RSpec.describe 'ClaimsApi::Metadata', type: :request do @@ -58,9 +59,8 @@ expect(result['mpi']['success']).to eq(false) end - local_bgs_services = %i[claimant trackeditem].freeze - local_bgs_methods = %i[find_poa_by_participant_id - find_tracked_items].freeze + local_bgs_services = %i[claimant].freeze + local_bgs_methods = %i[find_poa_by_participant_id].freeze local_bgs_services.each do |local_bgs_service| it "returns the correct status when the local bgs #{local_bgs_service} is not healthy" do local_bgs_methods.each do |local_bgs_method| @@ -73,6 +73,16 @@ end end + local_tracked_item_service = %i[trackeditem].freeze + local_tracked_item_method = %i[find_tracked_items].freeze + it "returns the correct status when the tracked item service #{local_tracked_item_service} is not healthy" do + allow_any_instance_of(ClaimsApi::TrackedItemService).to receive(local_tracked_item_method.first.to_sym) + .and_return(Struct.new(:healthy?).new(false)) + get "/services/claims/#{version}/upstream_healthcheck" + result = JSON.parse(response.body) + expect(result['localbgs-trackeditem']['success']).to eq(false) + end + local_bgs_claims_status_services = %i[ebenefitsbenftclaim] local_bgs_claims_status_methods = %i[find_benefit_claims_status_by_ptcpnt_id] local_bgs_claims_status_services.each do |local_bgs_claims_status_service| diff --git a/modules/claims_api/spec/requests/v1/forms/526_spec.rb b/modules/claims_api/spec/requests/v1/forms/526_spec.rb index e87fde5440d..86c94499f4a 100644 --- a/modules/claims_api/spec/requests/v1/forms/526_spec.rb +++ b/modules/claims_api/spec/requests/v1/forms/526_spec.rb @@ -267,7 +267,7 @@ end end - context "when 'treatments[].center.country' is too long'" do + context "when 'treatments[].center.country' is too long" do let(:treated_disability_names) { ['PTSD (post traumatic stress disorder)'] } it 'returns a bad request' do @@ -1286,7 +1286,7 @@ def obj.class end context 'when consumer is representative' do - it 'returns an unprocessible entity status' do + it 'returns an unprocessable entity status' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) @@ -1391,7 +1391,7 @@ def obj.class stub_mpi(build(:mpi_profile, birls_id: nil, birth_date: '19560506')) end - it 'returns an unprocessible entity status' do + it 'returns an unprocessable entity status' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) @@ -1407,7 +1407,7 @@ def obj.class stub_mpi(build(:mpi_profile, birls_id: nil, birth_date: '19560506')) end - it 'returns an unprocessible entity status' do + it 'returns an unprocessable entity status' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do VCR.use_cassette('claims_api/bgs/claims/claims') do @@ -1992,7 +1992,7 @@ def obj.class context "when 'amount' is below the minimum" do let(:military_retired_payment_amount) { 0 } - it 'responds with an unprocessible entity' do + it 'responds with an unprocessable entity' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do json_data = JSON.parse data @@ -2008,7 +2008,7 @@ def obj.class context "when 'amount' is above the maximum" do let(:military_retired_payment_amount) { 1_000_000 } - it 'responds with an unprocessible entity' do + it 'responds with an unprocessable entity' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do @@ -2059,7 +2059,7 @@ def obj.class } end - it 'responds with an unprocessible entity' do + it 'responds with an unprocessable entity' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do json_data = JSON.parse data @@ -2122,7 +2122,7 @@ def obj.class context "when 'amount' is below the minimum" do let(:separation_payment_amount) { 0 } - it 'responds with an unprocessible entity' do + it 'responds with an unprocessable entity' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do json_data = JSON.parse data @@ -2138,7 +2138,7 @@ def obj.class context "when 'amount' is above the maximum" do let(:separation_payment_amount) { 1_000_000 } - it 'responds with an unprocessible entity' do + it 'responds with an unprocessable entity' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do @@ -2272,7 +2272,7 @@ def obj.class end end - context "when 'disabilites.secondaryDisabilities.classificationCode' is invalid" do + context "when 'disabilities.secondaryDisabilities.classificationCode' is invalid" do let(:classification_type_codes) { [{ clsfcn_id: '1111' }] } [true, false].each do |flipped| @@ -2318,7 +2318,7 @@ def obj.class end end - context "when 'disabilites.secondaryDisabilities.classificationCode' does not match name" do + context "when 'disabilities.secondaryDisabilities.classificationCode' does not match name" do let(:classification_type_codes) { [{ clsfcn_id: '1111' }] } [true, false].each do |flipped| @@ -2364,7 +2364,7 @@ def obj.class end end - context "when 'disabilites.secondaryDisabilities.approximateBeginDate' is present" do + context "when 'disabilities.secondaryDisabilities.approximateBeginDate' is present" do it 'raises an exception if date is invalid' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do @@ -2420,7 +2420,7 @@ def obj.class end end - context "when 'disabilites.secondaryDisabilities.classificationCode' is not present" do + context "when 'disabilities.secondaryDisabilities.classificationCode' is not present" do it 'raises an exception if name is not valid structure' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do @@ -2477,24 +2477,24 @@ def obj.class end end - describe "'disabilites' validations" do + describe "'disabilities' validations" do describe "'disabilities.classificationCode' validations" do [true, false].each do |flipped| context "when feature flag is #{flipped}" do before do allow(Flipper).to receive(:enabled?).with(:claims_api_526_validations_v1_local_bgs).and_return(flipped) if flipped - expect_any_instance_of(ClaimsApi::StandardDataService) + allow_any_instance_of(ClaimsApi::StandardDataService) .to receive(:get_contention_classification_type_code_list).and_return(classification_type_codes) else - expect_any_instance_of(BGS::StandardDataService) + allow_any_instance_of(BGS::StandardDataService) .to receive(:get_contention_classification_type_code_list).and_return(classification_type_codes) end end - let(:classification_type_codes) { [{ clsfcn_id: '1111' }] } + let(:classification_type_codes) { [{ clsfcn_id: '1111', end_dt: 1.year.from_now.iso8601 }] } - context "when 'disabilites.classificationCode' is valid" do + context "when 'disabilities.classificationCode' is valid and expires in the future" do it 'returns a successful response' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do @@ -2517,11 +2517,52 @@ def obj.class end end - context "when 'disabilites.classificationCode' is invalid" do + context "when 'disabilities.classificationCode' is valid but expires in the past" do + before do + if Flipper.enabled?(:claims_api_526_validations_v1_local_bgs) + allow_any_instance_of(ClaimsApi::StandardDataService) + .to receive(:get_contention_classification_type_code_list) + .and_return([{ + clsfcn_id: '1111', + end_dt: 1.year.ago.iso8601 + }]) + else + allow_any_instance_of(BGS::StandardDataService) + .to receive(:get_contention_classification_type_code_list) + .and_return([{ + clsfcn_id: '1111', + end_dt: 1.year.ago.iso8601 + }]) + end + end + + it 'responds with a bad request' do + mock_acg(scopes) do |auth_header| + VCR.use_cassette('claims_api_bgs/claims/claims') do + VCR.use_cassette('claims_api/brd/countries') do + json_data = JSON.parse data + params = json_data + disabilities = [ + { + disabilityActionType: 'NEW', + name: 'PTSD (post traumatic stress disorder)', + classificationCode: '1111' + } + ] + params['data']['attributes']['disabilities'] = disabilities + post path, params: params.to_json, headers: headers.merge(auth_header) + expect(response).to have_http_status(:bad_request) + end + end + end + end + end + + context "when 'disabilities.classificationCode' is invalid" do it 'responds with a bad request' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do - VCR.use_cassette('claims_api/bgs/stadard_service_data') do + VCR.use_cassette('claims_api/bgs/standard_service_data') do json_data = JSON.parse data params = json_data disabilities = [ @@ -2544,9 +2585,9 @@ def obj.class end describe "'disabilities.ratedDisabilityId' validations" do - context "when 'disabilites.disabilityActionType' equals 'INCREASE'" do + context "when 'disabilities.disabilityActionType' equals 'INCREASE'" do context "and 'disabilities.ratedDisabilityId' is not provided" do - it 'returns an unprocessible entity status' do + it 'returns an unprocessable entity status' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do @@ -2593,7 +2634,7 @@ def obj.class end context "and 'disabilities.diagnosticCode' is not provided" do - it 'returns an unprocessible entity status' do + it 'returns an unprocessable entity status' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do json_data = JSON.parse data @@ -2614,10 +2655,10 @@ def obj.class end end - context "when 'disabilites.disabilityActionType' equals 'NONE'" do - context "and 'disabilites.secondaryDisabilities' is defined" do - context "and 'disabilites.diagnosticCode is not provided" do - it 'returns an unprocessible entity status' do + context "when 'disabilities.disabilityActionType' equals 'NONE'" do + context "and 'disabilities.secondaryDisabilities' is defined" do + context "and 'disabilities.diagnosticCode is not provided" do + it 'returns an unprocessable entity status' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do @@ -2648,7 +2689,7 @@ def obj.class end end - context "when 'disabilites.disabilityActionType' equals value other than 'INCREASE'" do + context "when 'disabilities.disabilityActionType' equals value other than 'INCREASE'" do context "and 'disabilities.ratedDisabilityId' is not provided" do it 'responds with a 200' do mock_acg(scopes) do |auth_header| @@ -2674,7 +2715,7 @@ def obj.class end end - describe "'disabilites.approximateBeginDate' validations" do + describe "'disabilities.approximateBeginDate' validations" do let(:disabilities) do [ { @@ -2727,7 +2768,7 @@ def obj.class end end - describe "'disabilites.specialIssues' validations" do + describe "'disabilities.specialIssues' validations" do let(:disabilities) do [ { @@ -2882,7 +2923,7 @@ def obj.class end end - context "when 'specialIssues' are provided for some 'disabilites'" do + context "when 'specialIssues' are provided for some 'disabilities'" do let(:disabilities) do [ { diff --git a/modules/claims_api/spec/requests/v2/veterans/claims_spec.rb b/modules/claims_api/spec/requests/v2/veterans/claims_spec.rb index 403fd5ab6ac..0f66a800c91 100644 --- a/modules/claims_api/spec/requests/v2/veterans/claims_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/claims_spec.rb @@ -6,6 +6,7 @@ require 'bgs_service/local_bgs' require 'bgs_service/person_web_service' require 'bgs_service/e_benefits_bnft_claim_status_web_service' +require 'bgs_service/tracked_item_service' require 'concerns/claims_api/v2/claims_requests/supporting_documents' RSpec.describe 'ClaimsApi::V2::Veterans::Claims', type: :request do diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_claims_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_claims_spec.rb index 591285ded3d..017343e7f77 100644 --- a/modules/claims_api/spec/requests/v2/veterans/rswag_claims_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/rswag_claims_spec.rb @@ -4,6 +4,8 @@ require 'rails_helper' require_relative '../../../rails_helper' require 'bgs_service/local_bgs' +require 'bgs_service/tracked_item_service' +require 'bgs_service/e_benefits_bnft_claim_status_web_service' describe 'Claims', openapi_spec: Rswag::TextHelpers.new.claims_api_docs do diff --git a/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb b/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb index 6297706941d..e3fd922df09 100644 --- a/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb +++ b/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb @@ -129,11 +129,11 @@ def handle264555 if Flipper.enabled?(:simple_forms_email_confirmations) case status when 'VALIDATED', 'ACCEPTED' - send_sahsha_email(parsed_form_data, reference_number, :confirmation) + send_sahsha_email(parsed_form_data, :confirmation, reference_number) when 'REJECTED' - send_sahsha_email(parsed_form_data, reference_number, :rejected) + send_sahsha_email(parsed_form_data, :rejected) when 'DUPLICATE' - send_sahsha_email(parsed_form_data, reference_number, :duplicate) + send_sahsha_email(parsed_form_data, :duplicate) end end @@ -339,7 +339,7 @@ def send_intent_received_email(parsed_form_data, confirmation_number, expiration notification_email.send end - def send_sahsha_email(parsed_form_data, confirmation_number, notification_type) + def send_sahsha_email(parsed_form_data, notification_type, confirmation_number = nil) config = { form_data: parsed_form_data, form_number: 'vba_26_4555', diff --git a/modules/simple_forms_api/app/services/simple_forms_api/notification_email.rb b/modules/simple_forms_api/app/services/simple_forms_api/notification_email.rb index 016862eadf7..0d274317b9a 100644 --- a/modules/simple_forms_api/app/services/simple_forms_api/notification_email.rb +++ b/modules/simple_forms_api/app/services/simple_forms_api/notification_email.rb @@ -100,10 +100,12 @@ def send(at: nil) private def check_missing_keys(config) - missing_keys = %i[form_data form_number confirmation_number date_submitted].select { |key| config[key].nil? } - if config[:form_number] == 'vba_21_0966_intent_api' && config[:expiration_date].nil? - missing_keys << :expiration_date - end + all_keys = %i[form_data form_number date_submitted] + all_keys << :confirmation_number if needs_confirmation_number?(config) + all_keys << :expiration_date if config[:form_number] == 'vba_21_0966_intent_api' + + missing_keys = all_keys.select { |key| config[key].nil? || config[key].to_s.strip.empty? } + if missing_keys.any? StatsD.increment('silent_failure', tags: statsd_tags) if error_notification? raise ArgumentError, "Missing keys: #{missing_keys.join(', ')}" @@ -280,6 +282,7 @@ def get_personalization(first_name) default_personalization(first_name) end personalization.except!('lighthouse_updated_at') unless lighthouse_updated_at + personalization.except!('confirmation_number') unless confirmation_number personalization end @@ -431,5 +434,9 @@ def statsd_tags def error_notification? notification_type == :error end + + def needs_confirmation_number?(config) + config[:form_number] != 'vba_26_4555' && %w[REJECTED DUPLICATE].exclude?(config[:notification_type]) + end end end diff --git a/modules/simple_forms_api/spec/requests/simple_forms_api/v1/simple_forms_spec.rb b/modules/simple_forms_api/spec/requests/simple_forms_api/v1/simple_forms_spec.rb index 774d8f4c6d1..d84d1e08c6c 100644 --- a/modules/simple_forms_api/spec/requests/simple_forms_api/v1/simple_forms_spec.rb +++ b/modules/simple_forms_api/spec/requests/simple_forms_api/v1/simple_forms_spec.rb @@ -1016,9 +1016,8 @@ end context 'rejected' do - let(:reference_number) { 'some-reference-number' } let(:body_status) { 'REJECTED' } - let(:body) { { 'reference_number' => reference_number, 'status' => body_status } } + let(:body) { { 'status' => body_status } } let(:status) { 200 } let(:lgy_response) { double(body:, status:) } @@ -1039,17 +1038,15 @@ 'form26_4555_rejected_email_template_id', { 'first_name' => 'Veteran', - 'date_submitted' => Time.zone.today.strftime('%B %d, %Y'), - 'confirmation_number' => reference_number + 'date_submitted' => Time.zone.today.strftime('%B %d, %Y') } ) end end context 'duplicate' do - let(:reference_number) { 'some-reference-number' } let(:body_status) { 'DUPLICATE' } - let(:body) { { 'reference_number' => reference_number, 'status' => body_status } } + let(:body) { { 'status' => body_status } } let(:status) { 200 } let(:lgy_response) { double(body:, status:) } @@ -1070,8 +1067,7 @@ 'form26_4555_duplicate_email_template_id', { 'first_name' => 'Veteran', - 'date_submitted' => Time.zone.today.strftime('%B %d, %Y'), - 'confirmation_number' => reference_number + 'date_submitted' => Time.zone.today.strftime('%B %d, %Y') } ) end diff --git a/modules/simple_forms_api/spec/services/notification_email_spec.rb b/modules/simple_forms_api/spec/services/notification_email_spec.rb index b4ac437443e..40e0f172ad6 100644 --- a/modules/simple_forms_api/spec/services/notification_email_spec.rb +++ b/modules/simple_forms_api/spec/services/notification_email_spec.rb @@ -28,6 +28,28 @@ end end + context '26-4555' do + let(:config) do + { form_data: {}, form_number: 'vba_26_4555', date_submitted: Time.zone.today.strftime('%B %d, %Y') } + end + + context 'notification_type is duplicate' do + let(:notification_type) { :duplicate } + + it 'does not require the confirmation_number' do + expect { described_class.new(config, notification_type:) }.not_to raise_error(ArgumentError) + end + end + + context 'notification_type is rejeceted' do + let(:notification_type) { :rejected } + + it 'does not require the confirmation_number' do + expect { described_class.new(config, notification_type:) }.not_to raise_error(ArgumentError) + end + end + end + context 'missing form_data' do let(:config) do { form_number: 'vba_21_10210', confirmation_number: 'confirmation_number', diff --git a/modules/va_notify/app/models/va_notify/notification.rb b/modules/va_notify/app/models/va_notify/notification.rb index 67201095372..e82a12bca7c 100644 --- a/modules/va_notify/app/models/va_notify/notification.rb +++ b/modules/va_notify/app/models/va_notify/notification.rb @@ -3,5 +3,8 @@ module VANotify class Notification < ApplicationRecord self.table_name = 'va_notify_notifications' + + has_kms_key + has_encrypted :to, migrating: true, key: :kms_key, **lockbox_options end end diff --git a/spec/controllers/v0/sign_in_controller_spec.rb b/spec/controllers/v0/sign_in_controller_spec.rb index 0d8eb541b83..05eb39b0097 100644 --- a/spec/controllers/v0/sign_in_controller_spec.rb +++ b/spec/controllers/v0/sign_in_controller_spec.rb @@ -3036,7 +3036,8 @@ context 'when successfully authenticated' do let(:access_token) { SignIn::AccessTokenJwtEncoder.new(access_token: access_token_object).perform } let(:authorization) { "Bearer #{access_token}" } - let!(:user_account) { Login::UserVerifier.new(user.identity).perform.user_account } + let(:user_verification) { create(:idme_user_verification, idme_uuid: user.idme_uuid) } + let(:user_account) { user_verification.user_account } let(:user) { create(:user, :loa3) } let(:user_uuid) { user.uuid } let(:oauth_session) { create(:oauth_session, user_account:) } diff --git a/spec/fixtures/education_benefits_claims/1995/ch1606.spl b/spec/fixtures/education_benefits_claims/1995/ch1606.spl index a9fcfbbd56b..fc6ca752b99 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch1606.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch1606.spl @@ -4,12 +4,12 @@ JOE TESTER2 334445555 334445555 -V1995R +1995R Chapter30 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/fixtures/education_benefits_claims/1995/ch30.spl b/spec/fixtures/education_benefits_claims/1995/ch30.spl index 23850da829e..e1366adecd3 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch30.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch30.spl @@ -4,12 +4,12 @@ JOE TESTER 223334444 223334444 -V1995R +1995R Chapter1606 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated.spl b/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated.spl index 6bc72294b03..1154b9df15c 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated.spl @@ -4,12 +4,12 @@ JOE TESTER 223334444 223334444 -V1995R +1995R Chapter1606 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated_sponsor.spl b/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated_sponsor.spl index 0cf4b12c511..56d51fa8d2c 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated_sponsor.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch30_guardian_graduated_sponsor.spl @@ -4,12 +4,12 @@ JOE TESTER 123456789 223334444 -V1995R +1995R Chapter35 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/fixtures/education_benefits_claims/1995/ch30_guardian_not_graduated.spl b/spec/fixtures/education_benefits_claims/1995/ch30_guardian_not_graduated.spl index e6ab106c6d7..684b6642667 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch30_guardian_not_graduated.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch30_guardian_not_graduated.spl @@ -4,12 +4,12 @@ JOE TESTER 223334444 223334444 -V1995R +1995R Chapter30 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/fixtures/education_benefits_claims/1995/ch33_fry.spl b/spec/fixtures/education_benefits_claims/1995/ch33_fry.spl index 84d799aa4cd..722fe09794a 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch33_fry.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch33_fry.spl @@ -4,12 +4,12 @@ MIDDLE LAST 111223333 111223333 -V1995R +1995R SCHOOL NAME Chapter1606 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/fixtures/education_benefits_claims/1995/ch33_fry_noncollege.spl b/spec/fixtures/education_benefits_claims/1995/ch33_fry_noncollege.spl index 97d53b84dde..c66681f7766 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch33_fry_noncollege.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch33_fry_noncollege.spl @@ -4,12 +4,12 @@ MIDDLE LAST 111223333 111223333 -V1995R +1995R SCHOOL NAME Chapter1606 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/fixtures/education_benefits_claims/1995/ch33_post911.spl b/spec/fixtures/education_benefits_claims/1995/ch33_post911.spl index cbdd1653702..72f0b1fe95f 100644 --- a/spec/fixtures/education_benefits_claims/1995/ch33_post911.spl +++ b/spec/fixtures/education_benefits_claims/1995/ch33_post911.spl @@ -4,12 +4,12 @@ MIDDLE LAST 111223333 111223333 -V1995R +1995R SCHOOL NAME Chapter1606 *START* -VA Form 22-1995R +VA Form 22-1995 OMB Control #: 2900-0074 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 45fa5aebb13..12261f4423d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -537,36 +537,61 @@ let(:mpi_profile) { build(:mpi_profile, active_mhv_ids:) } let(:mhv_account_id) { 'some-id' } let(:active_mhv_ids) { [mhv_account_id] } + let(:needs_accepted_terms_of_use) { false } - context 'when mhv_user_account is present' do - before do - allow(user).to receive(:mhv_user_account).and_return(mhv_user_account) - end + context 'when the user is loa3' do + let(:user) { build(:user, :loa3, needs_accepted_terms_of_use:, mpi_profile:) } - it 'returns the user_profile_id from the mhv_user_account' do - expect(user.mhv_correlation_id).to eq(mhv_account_id) - end - end + context 'and the user has accepted the terms of use' do + let(:needs_accepted_terms_of_use) { false } - context 'when mhv_user_account is not present' do - before do - allow(user).to receive(:mhv_user_account).and_return(nil) - end + context 'and mhv_user_account is present' do + before do + allow(user).to receive(:mhv_user_account).and_return(mhv_user_account) + end - context 'when the user has one active_mhv_ids' do - it 'returns the active_mhv_id' do - expect(user.mhv_correlation_id).to eq(active_mhv_ids.first) + it 'returns the user_profile_id from the mhv_user_account' do + expect(user.mhv_correlation_id).to eq(mhv_account_id) + end + end + + context 'and mhv_user_account is not present' do + before do + allow(user).to receive(:mhv_user_account).and_return(nil) + end + + context 'and the user has one active_mhv_ids' do + it 'returns the active_mhv_id' do + expect(user.mhv_correlation_id).to eq(active_mhv_ids.first) + end + end + + context 'and the user has multiple active_mhv_ids' do + let(:active_mhv_ids) { %w[some-id another-id] } + + it 'returns nil' do + expect(user.mhv_correlation_id).to be_nil + end + end end end - context 'when the user has multiple active_mhv_ids' do - let(:active_mhv_ids) { %w[some-id another-id] } + context 'and the user has not accepted the terms of use' do + let(:needs_accepted_terms_of_use) { true } it 'returns nil' do expect(user.mhv_correlation_id).to be_nil end end end + + context 'when the user is not loa3' do + let(:user) { build(:user, needs_accepted_terms_of_use:) } + + it 'returns nil' do + expect(user.mhv_correlation_id).to be_nil + end + end end describe '#mhv_ids' do @@ -1144,16 +1169,20 @@ edipi:, mhv_credential_uuid:, authn_context:) ) end - let(:user_verifier_object) do - OpenStruct.new({ idme_uuid:, logingov_uuid:, sign_in: user.identity_sign_in, - edipi:, mhv_credential_uuid: }) - end let(:authn_context) { LOA::IDME_LOA1_VETS } let(:logingov_uuid) { 'some-logingov-uuid' } let(:idme_uuid) { 'some-idme-uuid' } let(:edipi) { 'some-edipi' } let(:mhv_credential_uuid) { 'some-mhv-credential-uuid' } - let!(:user_verification) { Login::UserVerifier.new(user_verifier_object).perform } + let!(:user_verification) do + Login::UserVerifier.new(login_type: user.identity_sign_in[:service_name], + auth_broker: user.identity_sign_in[:auth_broker], + mhv_uuid: mhv_credential_uuid, + idme_uuid:, + dslogon_uuid: edipi, + logingov_uuid:, + icn: user.icn).perform + end let!(:user_account) { user_verification&.user_account } describe '#user_verification' do @@ -1403,63 +1432,39 @@ end end - describe '#can_create_mhv_account?' do + describe '#create_mhv_account_async' do let(:user) { build(:user, :loa3, needs_accepted_terms_of_use:) } let(:needs_accepted_terms_of_use) { false } + let!(:user_verification) { create(:idme_user_verification, idme_uuid: user.idme_uuid) } + + before { allow(MHV::AccountCreatorJob).to receive(:perform_async) } context 'when the user is loa3' do - context 'when the user is a va_patient' do - context 'when the user has accepted the terms of use' do - it 'returns true' do - expect(user.can_create_mhv_account?).to be true - end - end + let(:user) { build(:user, :loa3, needs_accepted_terms_of_use:) } - context 'when the user has not accepted the terms of use' do - let(:needs_accepted_terms_of_use) { true } + context 'and the user has accepted the terms of use' do + let(:needs_accepted_terms_of_use) { false } - it 'returns false' do - expect(user.can_create_mhv_account?).to be false - end - end - end - end - - context 'when the user is not loa3' do - let(:user) { build(:user, needs_accepted_terms_of_use:) } + it 'enqueues a job to create the MHV account' do + user.create_mhv_account_async - it 'returns false' do - expect(user.can_create_mhv_account?).to be false + expect(MHV::AccountCreatorJob).to have_received(:perform_async).with(user_verification.id) + end end - end - end - - describe '#create_mhv_account_async' do - let(:user) { build(:user) } - let!(:user_verification) do - create(:idme_user_verification, idme_uuid: user.idme_uuid) - end - - before do - allow(MHV::AccountCreatorJob).to receive(:perform_async) - end - context 'when the user can create an MHV account' do - before do - allow(user).to receive(:can_create_mhv_account?).and_return(true) - end + context 'and the user has not accepted the terms of use' do + let(:needs_accepted_terms_of_use) { true } - it 'enqueues a job to create the MHV account' do - user.create_mhv_account_async + it 'does not enqueue a job to create the MHV account' do + user.create_mhv_account_async - expect(MHV::AccountCreatorJob).to have_received(:perform_async).with(user_verification.id) + expect(MHV::AccountCreatorJob).not_to have_received(:perform_async) + end end end - context 'when the user cannot create an MHV account' do - before do - allow(user).to receive(:can_create_mhv_account?).and_return(false) - end + context 'when the user is not loa3' do + let(:user) { build(:user, needs_accepted_terms_of_use:) } it 'does not enqueue a job to create the MHV account' do user.create_mhv_account_async diff --git a/spec/services/login/user_verifier_spec.rb b/spec/services/login/user_verifier_spec.rb index 21cabc7c470..fb7b3cdf93a 100644 --- a/spec/services/login/user_verifier_spec.rb +++ b/spec/services/login/user_verifier_spec.rb @@ -4,31 +4,25 @@ RSpec.describe Login::UserVerifier do describe '#perform' do - subject { described_class.new(user_identity).perform } - - let(:user_identity) do - OpenStruct.new( - { - edipi: edipi_identifier, - sign_in: { service_name: login_value, auth_broker: }, - mhv_credential_uuid: mhv_credential_uuid_identifier, - idme_uuid: idme_uuid_identifier, - logingov_uuid: logingov_uuid_identifier, - icn:, - user_verification_id: nil, - user_account_uuid: nil - } - ) + subject do + described_class.new(login_type:, + auth_broker:, + mhv_uuid:, + idme_uuid:, + dslogon_uuid:, + logingov_uuid:, + icn:).perform end + let(:auth_broker) { 'some-auth-broker' } - let(:edipi_identifier) { 'some-edipi' } - let(:mhv_credential_uuid_identifier) { 'some-credential=uuid' } - let(:idme_uuid_identifier) { 'some-idme-uuid' } - let(:logingov_uuid_identifier) { 'some-logingov-uuid' } + let(:dslogon_uuid) { 'some-edipi' } + let(:mhv_uuid) { 'some-credential-uuid' } + let(:idme_uuid) { 'some-idme-uuid' } + let(:logingov_uuid) { 'some-logingov-uuid' } let(:locked) { false } let(:icn) { nil } - let(:login_value) { nil } + let(:login_type) { nil } let(:time_freeze_time) { '10-10-2021' } before do @@ -41,10 +35,10 @@ shared_examples 'user_verification with nil credential identifier' do let(:authn_identifier) { nil } - let(:edipi_identifier) { authn_identifier } - let(:mhv_credential_uuid_identifier) { authn_identifier } - let(:idme_uuid_identifier) { authn_identifier } - let(:logingov_uuid_identifier) { authn_identifier } + let(:dslogon_uuid) { authn_identifier } + let(:mhv_uuid) { authn_identifier } + let(:idme_uuid) { authn_identifier } + let(:logingov_uuid) { authn_identifier } let(:expected_log) { "[Login::UserVerifier] Nil identifier for type=#{authn_identifier_type}" } let(:expected_error) { Login::Errors::UserVerificationNotCreatedError } @@ -58,11 +52,11 @@ context 'and there is an alternate idme credential identifier' do let(:type) { :idme_uuid } let(:expected_log_idme) do - "[Login::UserVerifier] Attempting alternate type=#{type} identifier=#{idme_uuid_identifier}" + "[Login::UserVerifier] Attempting alternate type=#{type} identifier=#{idme_uuid}" end - let(:idme_uuid_identifier) { 'some-idme-uuid-identifier' } + let(:idme_uuid) { 'some-idme-uuid-identifier' } let!(:user_verification) do - UserVerification.create!(type => idme_uuid_identifier, + UserVerification.create!(type => idme_uuid, backing_idme_uuid:, user_account:, locked:) @@ -86,11 +80,11 @@ let(:icn) { 'some-icn' } let(:expected_log) do '[Login::UserVerifier] New VA.gov user, ' \ - "type=#{login_value}, broker=#{auth_broker}, identifier=#{authn_identifier}, locked=#{locked}" + "type=#{login_type}, broker=#{auth_broker}, identifier=#{authn_identifier}, locked=#{locked}" end context 'and user_verification for user credential already exists' do - let(:user_account) { UserAccount.new(icn: user_identity.icn) } + let(:user_account) { UserAccount.new(icn:) } let!(:user_verification) do UserVerification.create!(authn_identifier_type => authn_identifier, user_account:, @@ -124,7 +118,7 @@ end context 'and user_account with the current user ICN exists' do - let(:user_account) { UserAccount.new(icn: user_identity.icn) } + let(:user_account) { UserAccount.new(icn:) } context 'and this user account is already associated with the user_verification' do it 'does not change user_verification user_account associations' do @@ -140,7 +134,7 @@ end context 'and this user account is not already associated with the user_verification' do - let(:other_user_account) { UserAccount.new(icn: user_identity.icn) } + let(:other_user_account) { UserAccount.new(icn:) } context 'and the current user_verification is not verified' do let(:user_account) { UserAccount.new(icn: nil) } @@ -229,7 +223,7 @@ expect do subject user_account.reload - end.to change(user_account, :icn).from(nil).to(user_identity.icn) + end.to change(user_account, :icn).from(nil).to(icn) end it 'sets the user_verification verified_at time to now' do @@ -249,7 +243,7 @@ let(:expected_verified_at_time) { Time.zone.now } let(:expected_log) do '[Login::UserVerifier] New VA.gov user, ' \ - "type=#{login_value}, broker=#{auth_broker}, identifier=#{authn_identifier}, locked=#{locked}" + "type=#{login_type}, broker=#{auth_broker}, identifier=#{authn_identifier}, locked=#{locked}" end it 'makes a new user log to rails logger' do @@ -271,7 +265,7 @@ it 'sets the current user ICN on the user_account record' do subject account_icn = UserVerification.where(authn_identifier_type => authn_identifier).first.user_account.icn - expect(account_icn).to eq user_identity.icn + expect(account_icn).to eq icn end it 'creates a user_account record attached to the user_verification record' do @@ -330,7 +324,7 @@ let(:icn) { nil } let(:expected_log) do '[Login::UserVerifier] New VA.gov user, ' \ - "type=#{login_value}, broker=#{auth_broker}, identifier=#{authn_identifier}, locked=#{locked}" + "type=#{login_type}, broker=#{auth_broker}, identifier=#{authn_identifier}, locked=#{locked}" end context 'and user_verification for user credential already exists' do @@ -390,10 +384,10 @@ end context 'when user credential is mhv' do - let(:login_value) { SignIn::Constants::Auth::MHV } - let(:authn_identifier) { user_identity.mhv_credential_uuid } + let(:login_type) { SignIn::Constants::Auth::MHV } + let(:authn_identifier) { mhv_uuid } let(:authn_identifier_type) { :mhv_uuid } - let(:backing_idme_uuid) { idme_uuid_identifier } + let(:backing_idme_uuid) { idme_uuid } let(:linked_user_verification_type) { :mhv_user_verification } it_behaves_like 'user_verification with nil credential identifier' @@ -401,18 +395,18 @@ end context 'when user credential is idme' do - let(:login_value) { SignIn::Constants::Auth::IDME } - let(:authn_identifier) { user_identity.idme_uuid } + let(:login_type) { SignIn::Constants::Auth::IDME } + let(:authn_identifier) { idme_uuid } let(:authn_identifier_type) { :idme_uuid } let(:backing_idme_uuid) { nil } let(:linked_user_verification_type) { :idme_user_verification } context 'when credential identifier is nil' do let(:authn_identifier) { nil } - let(:edipi_identifier) { authn_identifier } - let(:mhv_credential_uuid_identifier) { authn_identifier } - let(:idme_uuid_identifier) { authn_identifier } - let(:logingov_uuid_identifier) { authn_identifier } + let(:dslogon_uuid) { authn_identifier } + let(:mhv_uuid) { authn_identifier } + let(:idme_uuid) { authn_identifier } + let(:logingov_uuid) { authn_identifier } let(:expected_log) { "[Login::UserVerifier] Nil identifier for type=#{authn_identifier_type}" } let(:expected_error) { Login::Errors::UserVerificationNotCreatedError } @@ -426,10 +420,10 @@ end context 'when user credential is dslogon' do - let(:login_value) { SignIn::Constants::Auth::DSLOGON } - let(:authn_identifier) { user_identity.edipi } + let(:login_type) { SignIn::Constants::Auth::DSLOGON } + let(:authn_identifier) { dslogon_uuid } let(:authn_identifier_type) { :dslogon_uuid } - let(:backing_idme_uuid) { idme_uuid_identifier } + let(:backing_idme_uuid) { idme_uuid } let(:linked_user_verification_type) { :dslogon_user_verification } it_behaves_like 'user_verification with nil credential identifier' @@ -437,8 +431,8 @@ end context 'when user credential is logingov' do - let(:login_value) { SignIn::Constants::Auth::LOGINGOV } - let(:authn_identifier) { user_identity.logingov_uuid } + let(:login_type) { SignIn::Constants::Auth::LOGINGOV } + let(:authn_identifier) { logingov_uuid } let(:authn_identifier_type) { :logingov_uuid } let(:backing_idme_uuid) { nil } let(:linked_user_verification_type) { :logingov_user_verification }