diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb index b1516dd201c..85856fdb6a8 100644 --- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb +++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb @@ -30,7 +30,9 @@ def perform(power_of_attorney_id, rep = nil) # rubocop:disable Metrics/MethodLen ClaimsApi::VANotifyJob.perform_async(poa_form.id, rep) if vanotify?(poa_form.auth_headers, rep) - ClaimsApi::PoaVBMSUpdater.perform_async(poa_form.id) if enable_vbms_access?(poa_form:) + if enable_vbms_access?(poa_form:) && poa_form.auth_headers['dependent'].blank? + ClaimsApi::PoaVBMSUpdater.perform_async(poa_form.id) + end else poa_form.status = ClaimsApi::PowerOfAttorney::ERRORED poa_form.vbms_error_message = "BGS Error: update_birls_record failed with code #{response[:return_code]}" diff --git a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb index 4bbed181432..cc08687dfdf 100644 --- a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb +++ b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb @@ -111,6 +111,37 @@ end end + context 'deciding to call PoaVBMSUpdater' do + before do + create_mock_lighthouse_service + end + + let(:poa) { create_poa } + + context 'when the dependent header key is present' do + it 'does not call PoaVBMSUpdater' do + expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async) + + poa.auth_headers.merge!({ dependent: { first_name: 'Test' } }) + poa.form_data.merge!({ recordConsent: true, consentLimits: [] }) + poa.save! + + subject.new.perform(poa.id, 'Rep Data') + end + end + + context 'when the dependent header key is not present' do + it 'does call PoaVBMSUpdater' do + expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async) + + poa.form_data.merge!({ recordConsent: true, consentLimits: [] }) + poa.save! + + subject.new.perform(poa.id, 'Rep Data') + end + end + end + context 'deciding to send a VA Notify email' do before do create_mock_lighthouse_service