Skip to content

Commit

Permalink
Fix structure of VANotify recipient_identifier arg (#21161)
Browse files Browse the repository at this point in the history
  • Loading branch information
mchristiansonVA authored Mar 7, 2025
1 parent 7f494c9 commit bc900cb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def handle_failure(poa_id, error, process)

def individual_accepted_email_contents(poa, rep)
{
recipient_identifier: icn_for_vanotify(poa.auth_headers),
recipient_identifier: {
id_type: 'ICN',
id_value: icn_for_vanotify(poa.auth_headers)
},
personalisation: {
first_name: value_or_default_for_field(claimant_first_name(poa)),
rep_first_name: value_or_default_for_field(rep.first_name),
Expand All @@ -66,7 +69,10 @@ def individual_accepted_email_contents(poa, rep)

def organization_accepted_email_contents(poa, org)
{
recipient_identifier: icn_for_vanotify(poa.auth_headers),
recipient_identifier: {
id_type: 'ICN',
id_value: icn_for_vanotify(poa.auth_headers)
},
personalisation: {
first_name: value_or_default_for_field(claimant_first_name(poa)),
org_name: value_or_default_for_field(org.name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def send_declined_notification(ptcpnt_id:, first_name:, representative:)

def send_organization_notification(ptcpnt_id:, first_name:)
content = {
recipient_identifier: ptcpnt_id,
recipient_identifier: {
id_type: 'PID',
id_value: ptcpnt_id
},
personalisation: {
first_name: first_name || '',
form_type: 'Appointment of Veterans Service Organization as Claimantʼs Representative (VA Form 21-22)'
Expand All @@ -59,7 +62,10 @@ def send_representative_notification(ptcpnt_id:, first_name:, representative_typ
representative_type_text = get_representative_type_text(representative_type:)

content = {
recipient_identifier: ptcpnt_id,
recipient_identifier: {
id_type: 'PID',
id_value: ptcpnt_id
},
personalisation: {
first_name: first_name || '',
representative_type: representative_type_text || 'representative',
Expand Down
15 changes: 12 additions & 3 deletions modules/claims_api/spec/sidekiq/va_notify_accepted_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@

let(:ind_expected_params) do
{
recipient_identifier: rep_poa.auth_headers[notification_key],
recipient_identifier: {
id_type: 'ICN',
id_value: org_poa.auth_headers[notification_key]
},
personalisation: {
first_name: rep_poa.auth_headers['va_eauth_firstName'],
rep_first_name: va_notify_rep.first_name,
Expand Down Expand Up @@ -119,7 +122,10 @@

let(:dependent_expected_params) do
{
recipient_identifier: rep_dep_poa.auth_headers[notification_key],
recipient_identifier: {
id_type: 'ICN',
id_value: org_poa.auth_headers[notification_key]
},
personalisation: {
first_name: dependent_poa.auth_headers['va_eauth_firstName'],
rep_first_name: va_notify_rep.first_name,
Expand Down Expand Up @@ -159,7 +165,10 @@

let(:org_expected_params) do
{
recipient_identifier: org_poa.auth_headers[notification_key],
recipient_identifier: {
id_type: 'ICN',
id_value: org_poa.auth_headers[notification_key]
},
personalisation: {
first_name: organization_poa.auth_headers['va_eauth_firstName'],
org_name: va_notify_org.name,
Expand Down
10 changes: 8 additions & 2 deletions modules/claims_api/spec/sidekiq/va_notify_declined_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
it 'sends a declined service organization notification' do
expect(vanotify_service).to receive(:send_email)
.with({
recipient_identifier: ptcpnt_id,
recipient_identifier: {
id_type: 'PID',
id_value: ptcpnt_id
},
personalisation: {
first_name:,
form_type: 'Appointment of Veterans Service Organization as Claimantʼs Representative (VA Form 21-22)'
Expand Down Expand Up @@ -52,7 +55,10 @@
it 'sends a declined individual/representative notification' do
expect(vanotify_service).to receive(:send_email)
.with({
recipient_identifier: ptcpnt_id,
recipient_identifier: {
id_type: 'PID',
id_value: ptcpnt_id
},
personalisation: {
first_name:,
representative_type: 'claims agent',
Expand Down

0 comments on commit bc900cb

Please sign in to comment.