From e55832144304b527606946a6bdf6fdc3fb8583b3 Mon Sep 17 00:00:00 2001 From: Andrew Rodiek <25368370+Dr-Pongo@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:37:08 -0500 Subject: [PATCH] [DD] Initial prefill for digital dispute (#19545) --- .github/CODEOWNERS | 1 + app/models/form_profile.rb | 6 ++-- app/models/form_profiles/dispute_debt.rb | 27 +++++++++++++++++ config/form_profile_mappings/DISPUTE-DEBT.yml | 7 +++++ config/settings.yml | 3 ++ spec/models/form_profile_spec.rb | 29 +++++++++++++++++++ 6 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 app/models/form_profiles/dispute_debt.rb create mode 100644 config/form_profile_mappings/DISPUTE-DEBT.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 31a2d09527b..6ec7d621946 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2131,6 +2131,7 @@ spec/support/vcr_cassettes/veteran @department-of-veterans-affairs/lighthouse-da spec/support/vcr_cassettes/veteran_readiness_employment @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/support/vcr_cassettes/vetext @department-of-veterans-affairs/mobile-api-team spec/support/vcr_cassettes/vha/sharepoint/upload_pdf_400_response.yml @department-of-veterans-affairs/vsa-debt-resolution @department-of-veterans-affairs/backend-review-group +config/form_profile_mappings/DISPUTE-DEBT.yml @department-of-veterans-affairs/vsa-debt-resolution @department-of-veterans-affairs/backend-review-group spec/support/vcr_cassettes/virtual_agent @department-of-veterans-affairs/vfs-virtual-agent-chatbot @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/support/vcr_cassettes/virtual_regional_office @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/support/vcr_cassettes/chip @department-of-veterans-affairs/vsa-healthcare-health-quest-1-backend @department-of-veterans-affairs/patient-check-in @department-of-veterans-affairs/backend-review-group diff --git a/app/models/form_profile.rb b/app/models/form_profile.rb index 7e8b33ab62d..b37d108c0c1 100644 --- a/app/models/form_profile.rb +++ b/app/models/form_profile.rb @@ -105,7 +105,8 @@ class FormProfile ivc_champva: ['10-7959C'], form_upload_flow: ['FORM-UPLOAD-FLOW'], acc_rep_management: %w[21-22 21-22A], - form_mock_ae_design_patterns: ['FORM-MOCK-AE-DESIGN-PATTERNS'] + form_mock_ae_design_patterns: ['FORM-MOCK-AE-DESIGN-PATTERNS'], + dispute_debt: ['DISPUTE-DEBT'] }.freeze FORM_ID_TO_CLASS = { @@ -147,7 +148,8 @@ class FormProfile 'FORM-UPLOAD-FLOW' => ::FormProfiles::FormUploadFlow, '21-22' => ::FormProfiles::VA2122, '21-22A' => ::FormProfiles::VA2122a, - 'FORM-MOCK-AE-DESIGN-PATTERNS' => ::FormProfiles::FormMockAeDesignPatterns + 'FORM-MOCK-AE-DESIGN-PATTERNS' => ::FormProfiles::FormMockAeDesignPatterns, + 'DISPUTE-DEBT' => ::FormProfiles::DisputeDebt }.freeze APT_REGEX = /\S\s+((apt|apartment|unit|ste|suite).+)/i diff --git a/app/models/form_profiles/dispute_debt.rb b/app/models/form_profiles/dispute_debt.rb new file mode 100644 index 00000000000..9ea28528e98 --- /dev/null +++ b/app/models/form_profiles/dispute_debt.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class FormProfiles::DisputeDebt < FormProfile + def metadata + { + version: 0, + prefill: true, + returnUrl: '/personal-information' + } + end + + private + + def va_file_number_last_four + return unless user.authorize :debt, :access? + + file_number = + begin + response = BGS::People::Request.new.find_person_by_participant_id(user:) + response.file_number.presence || user.ssn + rescue + user.ssn + end + + file_number&.last(4) + end +end diff --git a/config/form_profile_mappings/DISPUTE-DEBT.yml b/config/form_profile_mappings/DISPUTE-DEBT.yml new file mode 100644 index 00000000000..3ec9463f653 --- /dev/null +++ b/config/form_profile_mappings/DISPUTE-DEBT.yml @@ -0,0 +1,7 @@ +veteran: + fullName: [identity_information, full_name] + ssn: [identity_information, ssn_last_four] + dateOfBirth: [identity_information, date_of_birth] + homePhone: [contact_information, home_phone] + email: [contact_information, email] + fileNumber: [va_file_number_last_four] diff --git a/config/settings.yml b/config/settings.yml index 5e31e2fa65c..2b509439869 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -147,6 +147,9 @@ mcp: fsr: prefill: true +dispute_debt: + prefill: true + review_instance_slug: ~ sidekiq_admin_panel: false diff --git a/spec/models/form_profile_spec.rb b/spec/models/form_profile_spec.rb index e82eabc0407..c8b83fe80f4 100644 --- a/spec/models/form_profile_spec.rb +++ b/spec/models/form_profile_spec.rb @@ -1034,6 +1034,23 @@ } end + let(:vdispute_debt_expected) do + { + 'veteran' => { + 'fullName' => { + 'first' => user.first_name&.capitalize, + 'last' => user.last_name&.capitalize, + 'suffix' => user.suffix + }, + 'ssn' => '1863', + 'dateOfBirth' => '1809-02-12', + 'homePhone' => '14445551212', + 'email' => user.pciu_email, + 'fileNumber' => '3735' + } + } + end + let(:initialize_va_profile_prefill_military_information_expected) do expected_service_episodes_by_date = [ { @@ -1410,6 +1427,18 @@ def expect_prefilled(form_id) end end + context 'with a user that can prefill DisputeDebt' do + before do + allow_any_instance_of(BGS::People::Service).to( + receive(:find_person_by_participant_id).and_return(BGS::People::Response.new({ file_nbr: '796043735' })) + ) + end + + it 'returns a prefilled DisputeDebt form' do + expect_prefilled('DISPUTE-DEBT') + end + end + context 'with a user that can prefill financial status report' do let(:comp_and_pen_payments) do [