Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ndbex/69209 ch36 to benefits intake #16351

Merged
merged 30 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
215c63d
level set
micahaspyr Jan 31, 2024
f2ab811
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Feb 6, 2024
526214a
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Feb 9, 2024
b1e2257
level set with master
micahaspyr Feb 13, 2024
925bac7
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Feb 13, 2024
88cf373
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Feb 21, 2024
f09ecb4
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Mar 25, 2024
6550e34
removing yarn.lock
micahaspyr Mar 27, 2024
c9525f8
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Mar 27, 2024
927c26c
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Mar 28, 2024
7c877c3
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Mar 29, 2024
551e3f8
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Mar 29, 2024
cf21265
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Apr 3, 2024
93ce141
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Apr 4, 2024
076416b
placeholder
micahaspyr Apr 5, 2024
ad5af25
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Apr 11, 2024
90d7d8c
Renaming and restructuring ecc job and dependencies
micahaspyr Apr 11, 2024
a55a260
Added new feature flag name
micahaspyr Apr 11, 2024
42b5787
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Apr 11, 2024
1a2441e
SMall change to ecc claim model spec
micahaspyr Apr 11, 2024
0b0b37e
Tests may not be tested properly
micahaspyr Apr 11, 2024
81563c0
Fixed failing tests due to improperly calling perform_async when it s…
micahaspyr Apr 15, 2024
dc0e724
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Apr 15, 2024
95d19e8
ECC model claim file was not listed in codeowners file
micahaspyr Apr 15, 2024
728b8a4
Another codeowners change to have backend-review-group in it
micahaspyr Apr 15, 2024
0fa6124
Test and call update for ECC
micahaspyr Apr 15, 2024
f4c9c4a
CODEOWNERS change and removing sentry calls in the job
micahaspyr Apr 16, 2024
1c15c40
Rubocop
micahaspyr Apr 16, 2024
2f9c9b0
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
micahaspyr Apr 16, 2024
0f34618
log message tweaks
micahaspyr Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
micahaspyr marked this conversation as resolved.
Show resolved Hide resolved
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ app/models/session.rb @department-of-veterans-affairs/octo-identity
app/models/saved_claim/burial.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/pensions @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/saved_claim/pension.rb @department-of-veterans-affairs/pensions @department-of-veterans-affairs/backend-review-group
app/models/saved_claim/veteran_readiness_employment_claim.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/saved_claim/education_career_counseling_claim.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/sign_in @department-of-veterans-affairs/octo-identity
app/models/single_logout_request.rb @department-of-veterans-affairs/octo-identity
app/models/spool_file_event.rb @department-of-veterans-affairs/my-education-benefits @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create
raise Common::Exceptions::ValidationErrors, claim
end

CentralMail::SubmitCareerCounselingJob.perform_async(claim.id, @current_user&.uuid)
Lighthouse::SubmitCareerCounselingJob.perform_async(claim.id, @current_user&.uuid)

Rails.logger.info "ClaimID=#{claim.confirmation_number} Form=#{claim.class::FORM}"
clear_saved_form(claim.form_id)
Expand Down
8 changes: 6 additions & 2 deletions app/models/saved_claim/education_career_counseling_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def regional_office
[]
end

def send_to_central_mail!
def send_to_benefits_intake!
form_copy = parsed_form

if form_copy['veteranSocialSecurityNumber'].blank?
Expand All @@ -27,7 +27,11 @@ def process_attachments!
files = PersistentAttachment.where(guid: refs.map(&:confirmationCode))
files.find_each { |f| f.update(saved_claim_id: id) }

CentralMail::SubmitSavedClaimJob.new.perform(id)
if Flipper.enabled?(:ecc_benefits_intake_submission)
Lighthouse::SubmitBenefitsIntakeClaim.new.perform(id)
else
CentralMail::SubmitSavedClaimJob.new.perform(id)
end
end

def business_line
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# frozen_string_literal: true

module CentralMail
module Lighthouse
class SubmitCareerCounselingJob
include Sidekiq::Job
include SentryLogging
RETRY = 14

STATSD_KEY_PREFIX = 'worker.central_mail.submit_career_counseling_job'
STATSD_KEY_PREFIX = 'worker.lighthouse.submit_career_counseling_job'

sidekiq_options retry: RETRY

sidekiq_retries_exhausted do |msg, _ex|
Rails.logger.error(
"Failed all retries on CentralMail::SubmitCareerCounselingJob, last error: #{msg['error_message']}"
"Failed all retries on SubmitCareerCounselingJob, last error: #{msg['error_message']}"
)
StatsD.increment("#{STATSD_KEY_PREFIX}.exhausted")
end

def perform(claim_id, user_uuid = nil)
begin
@claim = SavedClaim.find(claim_id)
@claim.send_to_central_mail!
@claim.send_to_benefits_intake!
send_confirmation_email(user_uuid)
rescue => e
log_message_to_sentry('CentralMail::SubmitCareerCounselingJob failed, retrying...', :warn,
log_message_to_sentry('SubmitCareerCounselingJob failed, retrying...', :warn,
micahaspyr marked this conversation as resolved.
Show resolved Hide resolved
generate_sentry_details(e))
raise
end
Expand Down
3 changes: 3 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,9 @@ features:
central_mail_benefits_intake_submission:
actor_type: user
description: Enable central mail claims submission uses Benefits Intake API
ecc_benefits_intake_submission:
actor_type: user
description: Enable education and career counseling claim submissions to use Benefits Intake API
virtual_agent_enable_param_error_detection:
actor_type: user
description: If enabled, Allows for the detection of errors in the chatbot params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

it 'calls successfully submits the career counseling job' do
expect(CentralMail::SubmitCareerCounselingJob).to receive(:perform_async)
expect(Lighthouse::SubmitCareerCounselingJob).to receive(:perform_async)

post(:create, params: form_params)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,40 @@
end
end

describe '#send_to_central_mail!' do
it 'formats data before sending to central mail' do
describe '#send_to_benefits_intake!' do
it 'formats data before sending to central mail or benefits intake' do
allow(claim).to receive(:process_attachments!)

expect(claim).to receive(:update).with(form: a_string_including('"veteranSocialSecurityNumber":"333224444"'))

claim.send_to_central_mail!
claim.send_to_benefits_intake!
end

it 'calls process_attachments! method' do
expect(claim).to receive(:process_attachments!)
claim.send_to_central_mail!
claim.send_to_benefits_intake!
end

context 'Feature ecc_benefits_intake_submission is true' do
before do
Flipper.enable(:ecc_benefits_intake_submission)
end

it 'calls Lighthouse::SubmitBenefitsIntakeClaim job' do
expect_any_instance_of(Lighthouse::SubmitBenefitsIntakeClaim).to receive(:perform).with(claim.id)
claim.send_to_benefits_intake!
end
end

context 'Feature ecc_benefits_intake_submission is false' do
before do
Flipper.disable(:ecc_benefits_intake_submission)
end

it 'calls CentralMail::SubmitSavedClaimJob job' do
expect_any_instance_of(CentralMail::SubmitSavedClaimJob).to receive(:perform).with(claim.id)
claim.send_to_benefits_intake!
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

require 'rails_helper'

RSpec.describe CentralMail::SubmitCareerCounselingJob do
RSpec.describe Lighthouse::SubmitCareerCounselingJob do
let(:claim) { create(:education_career_counseling_claim) }
let(:job) { described_class.new }

describe '#perform' do
it 'sends to central mail' do
expect_any_instance_of(SavedClaim::EducationCareerCounselingClaim).to receive(:send_to_central_mail!)
expect_any_instance_of(SavedClaim::EducationCareerCounselingClaim).to receive(:send_to_benefits_intake!)

job.perform(claim.id)
end

it 'sends confirmation email' do
allow_any_instance_of(SavedClaim::EducationCareerCounselingClaim).to receive(:send_to_central_mail!)
allow_any_instance_of(SavedClaim::EducationCareerCounselingClaim).to receive(:send_to_benefits_intake!)

expect(job).to receive(:send_confirmation_email).with(nil)

Expand Down Expand Up @@ -60,11 +60,11 @@

describe 'sidekiq_retries_exhausted block' do
it 'logs error when retries are exhausted' do
CentralMail::SubmitCareerCounselingJob.within_sidekiq_retries_exhausted_block do
Lighthouse::SubmitCareerCounselingJob.within_sidekiq_retries_exhausted_block do
expect(Rails.logger).to receive(:error).exactly(:once).with(
'Failed all retries on CentralMail::SubmitCareerCounselingJob, last error: An error occured'
'Failed all retries on SubmitCareerCounselingJob, last error: An error occured'
)
expect(StatsD).to receive(:increment).with('worker.central_mail.submit_career_counseling_job.exhausted')
expect(StatsD).to receive(:increment).with('worker.lighthouse.submit_career_counseling_job.exhausted')
end
end
end
Expand Down
Loading