From e0ab3c3ae971428e0711a8447d79df3d384dd3d1 Mon Sep 17 00:00:00 2001 From: Evan Smith Date: Thu, 12 Dec 2024 21:14:02 -0500 Subject: [PATCH 1/7] notes for 674 change --- lib/bgs/form674.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/bgs/form674.rb b/lib/bgs/form674.rb index 977e40c5d9e..e57fba764a4 100644 --- a/lib/bgs/form674.rb +++ b/lib/bgs/form674.rb @@ -22,6 +22,7 @@ def initialize(user, saved_claim) @saved_claim = saved_claim @end_product_name = '130 - Automated School Attendance 674' @end_product_code = '130SCHATTEBN' + @proc_state = 'Ready' end def submit(payload) @@ -32,7 +33,9 @@ def submit(payload) vnp_benefit_claim = VnpBenefitClaim.new(proc_id:, veteran:, user:) vnp_benefit_claim_record = vnp_benefit_claim.create - set_claim_type('MANUAL_VAGOV') # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 + #note - do we ever need to do manual 674? if so, set state here in a get_state_type_method + + #set_claim_type('MANUAL_VAGOV') # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 # temporary logging to troubleshoot log_message_to_sentry("#{proc_id} - #{@end_product_code}", :warn, '', { team: 'vfs-ebenefits' }) @@ -45,10 +48,12 @@ def submit(payload) # we only want to add a note if the claim is being set to MANUAL_VAGOV # but for now we are temporarily always setting to MANUAL_VAGOV for 674 # when that changes, we need to surround this block of code in an IF statement - note_text = 'Claim set to manual by VA.gov: This application needs manual review because a 674 was submitted.' - bgs_service.create_note(benefit_claim_record[:benefit_claim_id], note_text) + if @proc_state == 'MANUAL_VAGOV' + note_text = 'Claim set to manual by VA.gov: This application needs manual review because a 674 was submitted.' + bgs_service.create_note(benefit_claim_record[:benefit_claim_id], note_text) - bgs_service.update_proc(proc_id, proc_state: 'MANUAL_VAGOV') + bgs_service.update_proc(proc_id, proc_state: 'MANUAL_VAGOV') + end rescue log_submit_failure(error) end From ec949bddfbb50bfe9db0df8b8adcc2b1d3aaa4dc Mon Sep 17 00:00:00 2001 From: Evan Smith Date: Wed, 18 Dec 2024 11:36:35 -0500 Subject: [PATCH 2/7] add new flipper for 674 work --- config/features.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/features.yml b/config/features.yml index d5c078a18a9..3b6708d45b7 100644 --- a/config/features.yml +++ b/config/features.yml @@ -1482,6 +1482,9 @@ features: va_dependents_new_fields_for_pdf: actor_typer: user description: Allows us to toggle the new fields on the front end for 686C-674 + va_dependents_submit_674: + actor_type: user + description: Allows submission of 674 without MANUAL_VAGOV flag va_online_scheduling_enable_OH_cancellations: actor_type: user enable_in_development: true From 81f1ab80164f5f6eb9234abf2f90a9140104189b Mon Sep 17 00:00:00 2001 From: Evan Smith Date: Wed, 18 Dec 2024 12:02:07 -0500 Subject: [PATCH 3/7] add flipper statements in form674 --- lib/bgs/form674.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bgs/form674.rb b/lib/bgs/form674.rb index e57fba764a4..6c2fc5c3ff7 100644 --- a/lib/bgs/form674.rb +++ b/lib/bgs/form674.rb @@ -22,7 +22,7 @@ def initialize(user, saved_claim) @saved_claim = saved_claim @end_product_name = '130 - Automated School Attendance 674' @end_product_code = '130SCHATTEBN' - @proc_state = 'Ready' + @proc_state = 'Ready' if Flipper.enabled?(:va_dependents_submit_674) end def submit(payload) @@ -35,7 +35,8 @@ def submit(payload) #note - do we ever need to do manual 674? if so, set state here in a get_state_type_method - #set_claim_type('MANUAL_VAGOV') # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 + # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 + set_claim_type('MANUAL_VAGOV') unless Flipper.enabled?(:va_dependents_submit_674) # temporary logging to troubleshoot log_message_to_sentry("#{proc_id} - #{@end_product_code}", :warn, '', { team: 'vfs-ebenefits' }) From d48726d52e2a3d6627ec9fc651a320ccdd6a72a7 Mon Sep 17 00:00:00 2001 From: Evan Smith Date: Thu, 19 Dec 2024 13:08:38 -0500 Subject: [PATCH 4/7] assign proc_state manually if the flipper is not flipped --- lib/bgs/form674.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/bgs/form674.rb b/lib/bgs/form674.rb index 6c2fc5c3ff7..005f06bd36b 100644 --- a/lib/bgs/form674.rb +++ b/lib/bgs/form674.rb @@ -36,7 +36,10 @@ def submit(payload) #note - do we ever need to do manual 674? if so, set state here in a get_state_type_method # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 - set_claim_type('MANUAL_VAGOV') unless Flipper.enabled?(:va_dependents_submit_674) + if !Flipper.enabled?(:va_dependents_submit_674) + set_claim_type('MANUAL_VAGOV') + @proc_state = 'MANUAL_VAGOV' + end # temporary logging to troubleshoot log_message_to_sentry("#{proc_id} - #{@end_product_code}", :warn, '', { team: 'vfs-ebenefits' }) From 8b62078d0c9e591012aca3a1918689472deeaa9b Mon Sep 17 00:00:00 2001 From: Evan Smith Date: Thu, 19 Dec 2024 17:48:53 -0500 Subject: [PATCH 5/7] if the claim is a submittable 686, then it must be manual again --- lib/bgs/form674.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bgs/form674.rb b/lib/bgs/form674.rb index 005f06bd36b..7593e6d23d0 100644 --- a/lib/bgs/form674.rb +++ b/lib/bgs/form674.rb @@ -36,7 +36,7 @@ def submit(payload) #note - do we ever need to do manual 674? if so, set state here in a get_state_type_method # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 - if !Flipper.enabled?(:va_dependents_submit_674) + if !Flipper.enabled?(:va_dependents_submit_674) || @saved_claim.submittable_686? set_claim_type('MANUAL_VAGOV') @proc_state = 'MANUAL_VAGOV' end From 235cff096e3c11932c137aff85aee52bfaea45d4 Mon Sep 17 00:00:00 2001 From: Evan Smith Date: Fri, 20 Dec 2024 10:34:11 -0500 Subject: [PATCH 6/7] rewrite unit tests --- lib/bgs/form674.rb | 2 +- spec/factories/dependency_claim.rb | 83 ++++++++++++++++++++++++++++++ spec/lib/bgs/form674_spec.rb | 40 ++++++-------- 3 files changed, 101 insertions(+), 24 deletions(-) diff --git a/lib/bgs/form674.rb b/lib/bgs/form674.rb index 7593e6d23d0..5dcb3e6cdd5 100644 --- a/lib/bgs/form674.rb +++ b/lib/bgs/form674.rb @@ -37,7 +37,7 @@ def submit(payload) # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 if !Flipper.enabled?(:va_dependents_submit_674) || @saved_claim.submittable_686? - set_claim_type('MANUAL_VAGOV') + set_claim_type('MANUAL_VAGOV') @proc_state = 'MANUAL_VAGOV' end diff --git a/spec/factories/dependency_claim.rb b/spec/factories/dependency_claim.rb index 66d33efc99f..ff1601c653c 100644 --- a/spec/factories/dependency_claim.rb +++ b/spec/factories/dependency_claim.rb @@ -143,4 +143,87 @@ }.to_json } end + factory :dependency_claim_674_only, class: 'SavedClaim::DependencyClaim' do + form_id { '686C-674' } + + form { + { + 'view:selectable686_options': { + report674: true + }, + add_child: false, + privacy_agreementAccepted: true, + veteran_information: { + full_name: { + first: 'Mark', + middle: 'A', + last: 'Webb', + suffix: 'Jr.' + }, + ssn: '796104437', + va_file_number: '796104437', + service_number: '12345678', + birth_date: '1950-10-04' + }, + dependents_application: { + veteran_information: { + full_name: { + first: 'Mark', + middle: 'A', + last: 'Webb', + suffix: 'Jr.' + }, + ssn: '796104437', + va_file_number: '796104437', + service_number: '12345678', + birth_date: '1950-10-04' + }, + veteran_contact_information: { + veteran_address: { + country_name: 'USA', + address_line1: '8200 DOBY LN', + city: 'PASADENA', + stateCode: 'CA', + zip_code: '21122' + }, + phone_number: '1112223333', + email_address: 'vets.gov.user+228@gmail.com' + }, + student_name_and_ssn: { + full_name: { + first: 'Juan', + last: 'Barrett' + }, + ssn: '333224444', + birth_date: '2001-10-06' + }, + student_address_marriage_tuition: { + address: { + country_name: 'USA', + address_line1: '1900 W Olney Ave.', + city: 'Philadelphia', + state_code: 'PA', + zip_code: '19141' + }, + was_married: false, + tuition_is_paid_by_gov_agency: false + }, + program_information: { + student_is_enrolled_full_time: true + }, + school_information: { + name: 'University of Pennsylvania', + address: { + country_name: 'USA', + address_line1: '4201 Henry Ave', + city: 'Philadelphia', + state_code: 'PA', + zip_code: '19144' + } + }, + student_did_attend_school_last_term: false + } + }.to_json + } + end end diff --git a/spec/lib/bgs/form674_spec.rb b/spec/lib/bgs/form674_spec.rb index cdbd77c15d2..d5a9e6f0aa1 100644 --- a/spec/lib/bgs/form674_spec.rb +++ b/spec/lib/bgs/form674_spec.rb @@ -7,15 +7,16 @@ let(:user_object) { FactoryBot.create(:evss_user, :loa3) } let(:all_flows_payload) { FactoryBot.build(:form_686c_674_kitchen_sink) } let(:user_struct) { FactoryBot.build(:user_struct) } - let(:saved_claim) { create(:dependency_claim_no_vet_information) } + let(:saved_claim) { create(:dependency_claim) } + let(:saved_claim_674_only) { create(:dependency_claim_674_only) } before do allow(Flipper).to receive(:enabled?).and_call_original end - context 'The flipper is turned on' do + context 'The automated 674 flipper is turned on' do before do - allow(Flipper).to receive(:enabled?).with(:dependents_enqueue_with_user_struct).and_return(true) + allow(Flipper).to receive(:enabled?).with(:va_dependents_submit_674).and_return(true) end # @TODO: may want to return something else @@ -38,25 +39,18 @@ end end - it 'calls all methods in flow' do + it 'calls all methods in flow and submits an automated claim' do VCR.use_cassette('bgs/form674/submit') do - VCR.use_cassette('bid/awards/get_awards_pension') do - expect_any_instance_of(BGS::Service).to receive(:create_proc).and_call_original - expect_any_instance_of(BGS::Service).to receive(:create_proc_form).and_call_original - expect_any_instance_of(BGS::VnpVeteran).to receive(:create).and_call_original - expect_any_instance_of(BGS::BenefitClaim).to receive(:create).and_call_original - expect_any_instance_of(BGS::StudentSchool).to receive(:create).and_call_original - expect_any_instance_of(BGS::VnpBenefitClaim).to receive(:create).and_call_original - expect_any_instance_of(BGS::VnpBenefitClaim).to receive(:update).and_call_original - expect_any_instance_of(BGS::VnpRelationships).to receive(:create_all).and_call_original - expect_any_instance_of(BID::Awards::Service).to receive(:get_awards_pension).and_call_original - expect_any_instance_of(BGS::Service).to receive(:create_note).with( - '600209223', - 'Claim set to manual by VA.gov: This application needs manual review because a 674 was submitted.' - ) - - BGS::Form674.new(user_struct, saved_claim).submit(all_flows_payload) - end + expect_any_instance_of(BGS::Service).to receive(:create_proc).and_call_original + expect_any_instance_of(BGS::Service).to receive(:create_proc_form).and_call_original + expect_any_instance_of(BGS::VnpVeteran).to receive(:create).and_call_original + expect_any_instance_of(BGS::BenefitClaim).to receive(:create).and_call_original + expect_any_instance_of(BGS::StudentSchool).to receive(:create).and_call_original + expect_any_instance_of(BGS::VnpBenefitClaim).to receive(:create).and_call_original + expect_any_instance_of(BGS::VnpBenefitClaim).to receive(:update).and_call_original + expect_any_instance_of(BGS::VnpRelationships).to receive(:create_all).and_call_original + + BGS::Form674.new(user_struct, saved_claim_674_only).submit(all_flows_payload) end end @@ -84,9 +78,9 @@ end end - context 'The flipper is turned off' do + context 'The automated 674 flipper is turned off' do before do - allow(Flipper).to receive(:enabled?).with(:dependents_enqueue_with_user_struct).and_return(false) + allow(Flipper).to receive(:enabled?).with(:va_dependents_submit_674).and_return(false) end # @TODO: may want to return something else From 57a353316402371977bb3cb9318643db6f3a1cd9 Mon Sep 17 00:00:00 2001 From: Evan Smith Date: Fri, 20 Dec 2024 10:59:23 -0500 Subject: [PATCH 7/7] rename flipper for rubocop rules. --- config/features.yml | 2 +- lib/bgs/form674.rb | 6 ++---- spec/lib/bgs/form674_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/config/features.yml b/config/features.yml index 901a2990c86..96bddf603c6 100644 --- a/config/features.yml +++ b/config/features.yml @@ -1485,7 +1485,7 @@ features: va_dependents_new_fields_for_pdf: actor_typer: user description: Allows us to toggle the new fields on the front end for 686C-674 - va_dependents_submit_674: + va_dependents_submit674: actor_type: user description: Allows submission of 674 without MANUAL_VAGOV flag va_online_scheduling_enable_OH_cancellations: diff --git a/lib/bgs/form674.rb b/lib/bgs/form674.rb index 5dcb3e6cdd5..12b9019cf4c 100644 --- a/lib/bgs/form674.rb +++ b/lib/bgs/form674.rb @@ -22,7 +22,7 @@ def initialize(user, saved_claim) @saved_claim = saved_claim @end_product_name = '130 - Automated School Attendance 674' @end_product_code = '130SCHATTEBN' - @proc_state = 'Ready' if Flipper.enabled?(:va_dependents_submit_674) + @proc_state = 'Ready' if Flipper.enabled?(:va_dependents_submit674) end def submit(payload) @@ -33,10 +33,8 @@ def submit(payload) vnp_benefit_claim = VnpBenefitClaim.new(proc_id:, veteran:, user:) vnp_benefit_claim_record = vnp_benefit_claim.create - #note - do we ever need to do manual 674? if so, set state here in a get_state_type_method - # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 - if !Flipper.enabled?(:va_dependents_submit_674) || @saved_claim.submittable_686? + if !Flipper.enabled?(:va_dependents_submit674) || @saved_claim.submittable_686? set_claim_type('MANUAL_VAGOV') @proc_state = 'MANUAL_VAGOV' end diff --git a/spec/lib/bgs/form674_spec.rb b/spec/lib/bgs/form674_spec.rb index d5a9e6f0aa1..5e045c27f6e 100644 --- a/spec/lib/bgs/form674_spec.rb +++ b/spec/lib/bgs/form674_spec.rb @@ -16,7 +16,7 @@ context 'The automated 674 flipper is turned on' do before do - allow(Flipper).to receive(:enabled?).with(:va_dependents_submit_674).and_return(true) + allow(Flipper).to receive(:enabled?).with(:va_dependents_submit674).and_return(true) end # @TODO: may want to return something else @@ -80,7 +80,7 @@ context 'The automated 674 flipper is turned off' do before do - allow(Flipper).to receive(:enabled?).with(:va_dependents_submit_674).and_return(false) + allow(Flipper).to receive(:enabled?).with(:va_dependents_submit674).and_return(false) end # @TODO: may want to return something else