-
Notifications
You must be signed in to change notification settings - Fork 66
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
base: master
Are you sure you want to change the base?
Api 43135 poa updated notification dependent #19972
Conversation
…ed-notification-dependent
…ed-notification-dependent
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
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] |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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
claimant = poa.form_data['claimant'].present? | ||
if claimant | ||
poa.form_data['claimant']['firstName'] | ||
else | ||
poa.auth_headers['va_eauth_firstName'] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
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'] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Summary
Related issue(s)
API-43135
Testing done
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
Organization email
What areas of the site does it impact?
(Describe what parts of the site are impacted andifcode touched other areas)
Acceptance criteria