Skip to content

Commit

Permalink
feat: add form 1990meb confirmation email trigger
Browse files Browse the repository at this point in the history
* getting started with emis

* make emis work for veteran status

* handle errors, refactor services, make all services

* Add Josh to EDU Daily stats mailer

* fixes the issue with vets-api not passing through params (#917)

* Add Claim IDs to the logs so we can track them down more quickly if needed

* Update vets json schema (#914)

* update vets json schema

* add previous benefits va file number to 5490 spool

* Evss failed upload job (#919)

* add aws gem

* add failed claims report and mailer

* job will send email

* add entry in sidekiq scheduler

* report mailer spec

* lint

* failed claims report spec

* lint

* Update vets json schema (#922)

* update json schema

* fix 5495 spec

* add training end date 5495

* Route EDU claims based on the school being applied to and applicant address

* Route EDU claims based on disbursement location, then vet location

* Update edu benefits api documentation (#925)

* Update edu-benefits.md

* Update edu-benefits.md

* Update Routing for the 1995 and 5495

* Swagger documentation (#910)

* Swagger documentation

* subclass the controller correctly

* and now the actual correct class

* no auth for api docs

* add the rest of the responses

* bunch of emis fixes

* finalize emis

* remove unused module

* refactor SSL configs for SOAP configurations

* remove cruft

* fix coverage

* no more openstruct

* add tests for error conditions

Verify veteran status (#992)

* extracted response caching to CacheAside concern

* adding veteran status delegate (eMIS veteran status) to user

* updated user serializer to return veteran status

rerun tests

Update veteran status determination, VIC eligibility (#1536)

* Updated veteran eligibility logic and corresponding ID card changes

Military service episodes may have a nil end date. Treat as ending in (#1567)

future for sorting purposes.

VCR cassette reflecting a collection of multiple service episodes

An episode is inside of an `militaryServiceEpisode` element.

Sibling `militaryServiceEpisode` elements reflect a collection of these episodes.  Meaning, nothing is nested in an array, etc., to illustrate a collection.

Siblings of this `militaryServiceEpisode` type indicate a collection of them.

And if there is just one `militaryServiceEpisode`, then the collection contains only one episode.

Add reserves guard to prefill (#2108)

* Add retrieving reserves information to military_information model

* Add reserves/guard date period to 526ez prefill

Update vets-json-schema version (#2937)

Correct gemfile (#3239)

* revert changes to Gemfile.lock #3200

* don't change bundler version

Create v2 of eMIS payment service to get pay grade history data (#3499)

* Create v2 of eMIS payment service to get pay grade history data
* Change settings file to split apart payment service v1 and v2 config

Upgrade eMIS Military Information Service to v2 (#3590)

* Create eMIS Military Information Service V2

* Create tests for Military Information Service V2

* Create v2 response and model

* Test v2 response

* Add version to service_name for breakers

* Fix casettes

* Add attribute expectations

* Update response v2 file name

* Add ability to use v2 response to eMIS services

* Extract get_endpoint_attributes method

Create Veteran Confirmation /status endpoint (#3676)

* Add the implementation for an endpoint in the Veteran Confirmation API which queries MVI and eMIS with passed in attributes to return veteran status

Co-authored-by: Katherine Rodriguez <edmkitty@users.noreply.github.com>

Add deployments method to MilitaryInformationServiceV2 (#4014)

* Add deployment method to MilitaryInformationServiceV2 to retrieve pay grade information

* Added more detailed deployment expects

* Fixed spacing lint issue.

Co-authored-by: drown-va <derek.brown5@va.gov>

Update to Concatenate Pay Plan and Pay Grade (#4054)

* Update to Concatenate Pay Plan and Pay Grade

* Added null & blank checking.

* Added unit testing.

* Removed unnecessary return statements

* Fixed lint issue

* Corrected spec schemas expected json

* Added missing pay plan unit test.

* Corrected minor swagger spacing issue

Co-authored-by: dbrown-va <derek.brown5@va.gov>

Service history pact tests (#5052)

* build_user_and_stub_session allows passed in user

* working on service history pact

* add at least one entry in the service history exists state

* one service history entry spec working

* no service history records spec

* finish not a veteran spec

* lint

* dont need to pass anything into build_user_and_stub_session

Mobile API docs: update user, add address update (#4980)

All emis services are converted to soap 1.2 (#5216)

* All emis services are converted to soap 1.2

* linting

* changed emis vcr_cassettes to reflect change to soap 1.2

* Reverted Gemfile.lock

21584 mobile delete email fix (#6229)

* call merge on controller params to properly add effective_end_date

* cast controller params to hash first

Add simple last name and social stamp to hlr v2 form (#6987)

Created Check for service history null dates (#7300)

* Created Check for service history null dates

* new logic will order service history episodes from earliest to latest so spec needed to be changed

* created test for end_date null

* fixed service history episode spec

Api 9107 service history gras integration (#7685)

* added Gras V2 endpoint

* added guard_reserve_service_periods

* basic implementation of gras filtering

* Added personnel_organization_code and personnel_segment_identifier to military service episode v2 response

* added key data to guard reserver service period v2

* map episode to guard service by key data

* Will filter out if guar.trainin indicator code is Y

* fixed linting issues

* added end_date check for episode period matching

* default tests wil not be service guard

* added intial tests

* Cleaned up unit tests

* added emis guard v2 to betamocks config

* fixed tests

* new gras logic

* fixed tests

* modified service history v0 tests

* branch of service logic for guard

* fixed bug

* fixed test

* Linting

Co-authored-by: Derek Brown <derek.brown@libertyits.com>

Api 12952 vba docs kevin daily report update (#8976)

* Logging for the action_mailer

* Adding Processing column to daily report

* Lint adjustments

* Lint adjustments

RRD: increase RRD job retry limit (#9670)

* increase RRD job retry limit
* consistent hash keys

Bump google-protobuf from 3.21.12 to 3.22.0 (#11878)

Bumps [google-protobuf](https://github.com/protocolbuffers/protobuf) from 3.21.12 to 3.22.0.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/generate_changelog.py)
- [Commits](protocolbuffers/protobuf@v3.21.12...v3.22.0)

---
updated-dependencies:
- dependency-name: google-protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Adds tracked items status to oas (#11909)

fix spec (#12037)

fix failure (#12043)

fix failing test (#12075)

fix failing test (#12076)

API 27878 secondary dsabilities not requred (#13270)

Removes min-items indicator for secondaryDisabilities property
* Updates 526.jsn, request.json and submssion.json to remove the mnItems indicator for secondary disabilities
* Updates swagger docs to reflect change
Changes to be committed:
	modified:   modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json
	modified:   modules/claims_api/config/schemas/v2/526.json
	modified:   modules/claims_api/config/schemas/v2/request_bodies/disability_compensation/request.json
	modified:   spec/support/schemas/claims_api/v2/forms/disability/submission.json

feat: add form 1990meb confirmation email trigger

Update logic to handle separate templates

Lint

Split out logic for retrieving template id

Move confirmation email to separate sidekiq job

Lint

Re-lint

Fix education benefits spec

Move sidekiq job to meb_api module

Also updates job to take relevant data rather than entire form

Move email logic to separate method

remove invalid files
  • Loading branch information
aub authored and tsr-rise8 committed Dec 11, 2023
1 parent 4a40d6c commit 8f45596
Show file tree
Hide file tree
Showing 8 changed files with 344 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ features:
actor_type: user
description: Enables form 21-4142 email submission confirmation (VaNotify)
enable_in_development: true
form1990meb_confirmation_email:
actor_type: user
description: Enables form 1990meb email submission confirmation (VaNotify)
enable_in_development: true
form5490_confirmation_email:
actor_type: user
description: Enables form 5490 email submission confirmation (VaNotify)
Expand Down
3 changes: 3 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,9 @@ vanotify:
form0994_extra_action_confirmation_email: form0994_extra_action_confirmation_email_template_id
form1990_confirmation_email: form1990_confirmation_email_template_id
form1990e_confirmation_email: form1990e_confirmation_email_template_id
form1990meb_approved_confirmation_email: form1990meb_approved_confirmation_email_template_id
form1990meb_offramp_confirmation_email: form1990meb_offramp_confirmation_email_template_id
form1990meb_denied_confirmation_email: form1990meb_denied_confirmation_email_template_id
form1995_confirmation_email: form1995_confirmation_email_template_id
form21_0972_confirmation_email: form21_0972_confirmation_email_template_id
form21_10203_confirmation_email: form21_10203_confirmation_email_template_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def submit_claim

clear_saved_form(params[:form_id]) if params[:form_id]

send_confirmation_email if response.ok? && Flipper.enabled?(:form1990meb_confirmation_email)

render json: {
data: {
'status': response.status
Expand Down Expand Up @@ -139,6 +141,18 @@ def enrollment_service
def exclusion_period_service
MebApi::DGI::ExclusionPeriod::Service.new(@current_user)
end

def send_confirmation_email
form_data = params[:education_benefit]
email = form_data.dig('claimant', 'contact_info', 'email_address')
first_name = form_data.dig('claimant', 'first_name')&.upcase.presence

if email.present?
MebApi::V0::Submit1990MEBFormConfirmation.perform_async(
@current_user.uuid, email, first_name
)
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

require 'sidekiq'
require 'dgi/claimant/service'
require 'dgi/status/service'

module MebApi
module V0
class Submit1990MEBFormConfirmation
include Sidekiq::Worker
include SentryLogging
sidekiq_options retry: 14

def perform(user_uuid, email, first_name)
@current_user = User.find(user_uuid)

VANotify::EmailJob.perform_async(
email,
confirmation_email_template_id,
{
'first_name' => first_name,
'date_submitted' => Time.zone.today.strftime('%B %d, %Y')
}
)
end

private

def confirmation_email_template_id
claimant_service = MebApi::DGI::Claimant::Service.new(@current_user)
claimant_response = claimant_service.get_claimant_info
claimant_id = claimant_response['claimant_id']
claim_status_service = MebApi::DGI::Status::Service.new(@current_user)
claim_status_response = claim_status_service.get_claim_status({ latest: false }, claimant_id)
claim_status = claim_status_response['claim_status']

if claim_status.eql? 'ELIGIBLE'
Settings.vanotify.services.va_gov.template_id.form1990meb_approved_confirmation_email
elsif claim_status.eql? 'DENIED'
Settings.vanotify.services.va_gov.template_id.form1990meb_denied_confirmation_email
else
Settings.vanotify.services.va_gov.template_id.form1990meb_offramp_confirmation_email
end
end
end
end
end
108 changes: 108 additions & 0 deletions modules/meb_api/spec/requests/meb_api/v0/education_benefits_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,113 @@
end
end
end

describe 'POST /meb_api/v0/submit_claim' do
let(:claimant_params) do
{
form_id: 1,
education_benefit: {
claimant: {
first_name: 'Herbert',
middle_name: 'Hoover',
last_name: 'Hoover',
date_of_birth: '1980-03-11',
contact_info: {
address_line1: '503 upper park',
address_line2: '',
city: 'falls church',
zipcode: '22046',
email_address: 'hhover@test.com',
address_type: 'DOMESTIC',
mobile_phone_number: '4409938894',
country_code: 'US',
state_code: 'VA'
},
notification_method: 'EMAIL'
}
},
relinquished_benefit: {
eff_relinquish_date: '2021-10-15',
relinquished_benefit: 'Chapter30'
},
additional_considerations: {
active_duty_kicker: 'N/A',
academy_rotc_scholarship: 'YES',
reserve_kicker: 'N/A',
senior_rotc_scholarship: 'YES',
active_duty_dod_repay_loan: 'YES'
},
comments: {
disagree_with_service_period: false
},
direct_deposit: {
account_number: '123123123123',
account_type: 'savings',
routing_number: '123123123'
}
}
end

context 'confirmation email' do
it 'delegates to submit_0994_form_confirmation job' do
VCR.use_cassette('dgi/submit_claim') do
allow(MebApi::V0::Submit1990MEBFormConfirmation).to receive(:perform_async)

post '/meb_api/v0/submit_claim', params: claimant_params

expect(MebApi::V0::Submit1990MEBFormConfirmation).to have_received(:perform_async)
.with('b2fab2b5-6af0-45e1-a9e2-394347af91ef', 'hhover@test.com', 'HERBERT')
end
end

it 'does not delegate when claim submission fails' do
VCR.use_cassette('dgi/submit_claim_failure') do
allow(MebApi::V0::Submit1990MEBFormConfirmation).to receive(:perform_async)

response = post '/meb_api/v0/submit_claim', params: claimant_params

expect(response).to be(503)
expect(MebApi::V0::Submit1990MEBFormConfirmation).not_to have_received(:perform_async)
end
end

it 'does not delegate when feature is disabled' do
VCR.use_cassette('dgi/submit_claim') do
allow(MebApi::V0::Submit1990MEBFormConfirmation).to receive(:perform_async)
Flipper.disable(:form1990meb_confirmation_email)

post '/meb_api/v0/submit_claim', params: claimant_params

expect(MebApi::V0::Submit1990MEBFormConfirmation).not_to have_received(:perform_async)

Flipper.enable(:form1990meb_confirmation_email)
end
end

it 'does not delegate when email is missing' do
VCR.use_cassette('dgi/submit_claim') do
claimant_params_without_email = {
**claimant_params,
education_benefit: {
**claimant_params[:education_benefit],
claimant: {
**claimant_params[:education_benefit][:claimant],
contact_info: {
**claimant_params[:education_benefit][:claimant][:contact_info],
email_address: nil
}
}
}
}

allow(MebApi::V0::Submit1990MEBFormConfirmation).to receive(:perform_async)

post '/meb_api/v0/submit_claim', params: claimant_params_without_email

expect(MebApi::V0::Submit1990MEBFormConfirmation).not_to have_received(:perform_async)
end
end
end
end
end
end
67 changes: 67 additions & 0 deletions spec/support/vcr_cassettes/dgi/get_claim_status_denied.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions spec/support/vcr_cassettes/dgi/get_claim_status_in_progress.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions spec/support/vcr_cassettes/dgi/submit_claim_failure.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8f45596

Please sign in to comment.