Skip to content

Commit

Permalink
Api 27356 27357 docs service and logging (#12974)
Browse files Browse the repository at this point in the history
* adds generic logging

* return empty supporting docs if errored

* update to error for display
  • Loading branch information
FonzMP authored Jun 13, 2023
1 parent 93ece3e commit 1ed6a25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ def build_target_veteran(veteran_id:, loa:) # rubocop:disable Metrics/MethodLeng
found_record = target_veteran.mpi_record?(user_key: veteran_id)

unless found_record
log_message_to_sentry("Claims v2 Veteran record not found - Veteran ICN: #{veteran_id}",
:warning)
raise ::Common::Exceptions::ResourceNotFound.new(detail:
"Unable to locate Veteran's ID/ICN in Master Person Index (MPI). " \
'Please submit an issue at ask.va.gov or call 1-800-MyVA411 (800-698-2411) for assistance.')
Expand All @@ -164,13 +166,17 @@ def build_target_veteran(veteran_id:, loa:) # rubocop:disable Metrics/MethodLeng
mpi_profile = target_veteran&.mpi&.mvi_response&.profile || {}

if mpi_profile[:participant_id].blank?
log_message_to_sentry("Claims v2 Veteran PID not found - Veteran ICN: #{veteran_id}",
:warning)
raise ::Common::Exceptions::UnprocessableEntity.new(detail:
"Unable to locate Veteran's Participant ID in Master Person Index (MPI). " \
'Please submit an issue at ask.va.gov or call 1-800-MyVA411 (800-698-2411) for assistance.')
end

target_veteran[:first_name] = mpi_profile[:given_names]&.first
if target_veteran[:first_name].nil?
log_message_to_sentry("Claims v2 Veteran First Name not found - Veteran ICN: #{veteran_id}",
:warning)
raise ::Common::Exceptions::UnprocessableEntity.new(detail: 'Missing first name')
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,14 @@ def tracked_item_req_date(tracked_item, item)
date_present(item[:date_open] || tracked_item[:req_dt] || tracked_item[:create_dt])
end

def get_evss_documents(claim_id)
evss_docs_service.get_claim_documents(claim_id).body
rescue => e
log_message_to_sentry('Error in Claims v2 show calling EVSS Doc Service',
:error,
body: e.message)
end

def build_supporting_docs(bgs_claim)
return [] if bgs_claim.nil?

Expand All @@ -501,7 +509,7 @@ def build_supporting_docs(bgs_claim)
docs = if sandbox?
{ documents: ClaimsApi::V2::MockDocumentsService.new.generate_documents }.with_indifferent_access
else
evss_docs_service.get_claim_documents(bgs_claim[:benefit_claim_details_dto][:benefit_claim_id]).body
get_evss_documents(bgs_claim[:benefit_claim_details_dto][:benefit_claim_id])
end
return [] if docs.nil? || docs['documents'].blank?

Expand Down

0 comments on commit 1ed6a25

Please sign in to comment.