Skip to content

Commit

Permalink
Dex 97875 submit 674 (#19965)
Browse files Browse the repository at this point in the history
* notes for 674 change

* add new flipper for 674 work

* add flipper statements in form674

* assign proc_state manually if the flipper is not flipped

* if the claim is a submittable 686, then it must be manual again

* rewrite unit tests

* rename flipper for rubocop rules.
  • Loading branch information
evansmith authored Dec 23, 2024
1 parent c9a4f7b commit 6a82d75
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 27 deletions.
3 changes: 3 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,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_submit674:
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
Expand Down
15 changes: 11 additions & 4 deletions lib/bgs/form674.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' if Flipper.enabled?(:va_dependents_submit674)
end

def submit(payload)
Expand All @@ -32,7 +33,11 @@ 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
# we are TEMPORARILY always setting to MANUAL_VAGOV for 674
if !Flipper.enabled?(:va_dependents_submit674) || @saved_claim.submittable_686?
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' })
Expand All @@ -45,10 +50,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
Expand Down
83 changes: 83 additions & 0 deletions spec/factories/dependency_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[email protected]'
},
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
40 changes: 17 additions & 23 deletions spec/lib/bgs/form674_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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_submit674).and_return(true)
end

# @TODO: may want to return something else
Expand All @@ -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

Expand Down Expand Up @@ -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_submit674).and_return(false)
end

# @TODO: may want to return something else
Expand Down

0 comments on commit 6a82d75

Please sign in to comment.