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

Api 43135 poa updated notification dependent #19972

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mchristiansonVA
Copy link
Contributor

@mchristiansonVA mchristiansonVA commented Dec 19, 2024

Summary

  • This work is behind a feature toggle (flipper): YES
  • Note new VANotify for dependent claimant functionality is behind flipper lighthouse_claims_api_v2_poa_va_notify
  • Sends an email notification to dependent claimants for successfully updated individual or organization POA assignment
  • Uses the dependent claimant ICN for VANotify, as well as the dependent's first name in the email salutation.
  • Calls job from poa_assign_dependent_claimant job when that is successful
  • This workflow only applies to v2 POA

Related issue(s)

API-43135

Testing done

  • New code is covered by unit tests
  • Previously, no notification email was sent to dependent claimants upon successful individual or organization POA assignment.
    switching the job to use new.perform is not strictly required, but wll make it easier to step through and see.

you will need to switch out so the template sends to your email: email_address: 'you.email@here' replaces recipient_identifier: icn_for_vanotify(poa.auth_headers), for whichever you are sending
Change line 100 in the power_of_attorney/base_controller to use new.perform
Change lines 35 & 37 in the v2 PoaFormBuilderJob to use new.perform
Change line 33 in poa_assign_dependent_claimant_job.rb to use new.perform
Submit a v2 2122 or 2122a with a dependent claimant; email will be sent upon successful assignation of POA for individual or organization. The titles are: ORG: We processed your form to appoint a VSO & Rep: We processed your form to appoint an accredited representative
Confirm the resulting email includes the dependent claimant's first name in the salutation.

Screenshots

Individual/rep email
Screenshot 2024-12-19 at 4 38 44 PM
Organization email
Screenshot 2024-12-19 at 4 37 57 PM

What areas of the site does it impact?

(Describe what parts of the site are impacted andifcode touched other areas)

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

@mchristiansonVA mchristiansonVA added the claimsApi modules/claims_api label Dec 19, 2024
@mchristiansonVA mchristiansonVA self-assigned this Dec 19, 2024
@mchristiansonVA mchristiansonVA marked this pull request as ready for review December 20, 2024 16:26
@mchristiansonVA mchristiansonVA requested a review from a team as a code owner December 20, 2024 16:26
Copy link
Contributor

@tycol7 tycol7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Minor feedback (id vs object in the sidekiq params).

@@ -4,7 +4,7 @@ module ClaimsApi
class PoaAssignDependentClaimantJob < ClaimsApi::ServiceBase
LOG_TAG = 'poa_assign_dependent_claimant_job'

def perform(poa_id)
def perform(poa_id, rep)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing the rep object, should we plumb the rep ID and query the database again in VANotifyAcceptedJob? Have been burned before passing objects between sidekiq jobs.

Comment on lines +231 to +235
if Flipper.enabled?(:lighthouse_claims_api_v2_poa_va_notify)
auth_headers.key?(ClaimsApi::V2::Veterans::PowerOfAttorney::BaseController::VA_NOTIFY_KEY) && rep.present?
else
false
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
if Flipper.enabled?(:lighthouse_claims_api_v2_poa_va_notify)
auth_headers.key?(ClaimsApi::V2::Veterans::PowerOfAttorney::BaseController::VA_NOTIFY_KEY) && rep.present?
else
false
end
Flipper.enabled?(:lighthouse_claims_api_v2_poa_va_notify) &&
auth_headers.key?(ClaimsApi::V2::Veterans::PowerOfAttorney::BaseController::VA_NOTIFY_KEY) && rep.present?

@@ -228,11 +228,11 @@ def user_profile
end

def icn_for_vanotify
params[:veteranId]
dependent_claimant_icn = claimant_icn
dependent_claimant_icn || params[:veteranId]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could make our intent clearer with presence.

Suggested change
dependent_claimant_icn || params[:veteranId]
dependent_claimant_icn.presence || params[:veteranId]

@@ -114,7 +114,7 @@ def set_auth_headers
if allow_dependent_claimant?
add_dependent_to_auth_headers(headers)
else
auth_headers
headers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I missed this subtlety earlier, but we shouldnʼt need the intermediate headers variable since Ruby modifies hashes in-place. We could simplify these two methods as:

def set_auth_headers
  auth_headers.merge!(VA_NOTIFY_KEY => icn_for_vanotify)

  add_dependent_to_auth_headers if allow_dependent_claimant?

  auth_headers
end

def add_dependent_to_auth_headers
  claimant = user_profile.profile

  auth_headers.merge!({
                        dependent: {
                          participant_id: claimant.participant_id,
                          ssn: claimant.ssn,
                          first_name: claimant.given_names[0],
                          last_name: claimant.family_name
                        }
                      })
end

Comment on lines +176 to +181
claimant = poa.form_data['claimant'].present?
if claimant
poa.form_data['claimant']['firstName']
else
poa.auth_headers['va_eauth_firstName']
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
claimant = poa.form_data['claimant'].present?
if claimant
poa.form_data['claimant']['firstName']
else
poa.auth_headers['va_eauth_firstName']
end
poa.form_data.dig('claimant', 'firstName').presence || poa.auth_headers['va_eauth_firstName']

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -105,7 +105,7 @@
end
end

context 'when the flipper is on' do
context 'when the flipper is off' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
claimsApi modules/claims_api test-failure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants