Skip to content

Commit bc900cb

Browse files
Fix structure of VANotify recipient_identifier arg (#21161)
1 parent 7f494c9 commit bc900cb

File tree

4 files changed

+36
-9
lines changed

4 files changed

+36
-9
lines changed

modules/claims_api/app/sidekiq/claims_api/va_notify_accepted_job.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ def handle_failure(poa_id, error, process)
4949

5050
def individual_accepted_email_contents(poa, rep)
5151
{
52-
recipient_identifier: icn_for_vanotify(poa.auth_headers),
52+
recipient_identifier: {
53+
id_type: 'ICN',
54+
id_value: icn_for_vanotify(poa.auth_headers)
55+
},
5356
personalisation: {
5457
first_name: value_or_default_for_field(claimant_first_name(poa)),
5558
rep_first_name: value_or_default_for_field(rep.first_name),
@@ -66,7 +69,10 @@ def individual_accepted_email_contents(poa, rep)
6669

6770
def organization_accepted_email_contents(poa, org)
6871
{
69-
recipient_identifier: icn_for_vanotify(poa.auth_headers),
72+
recipient_identifier: {
73+
id_type: 'ICN',
74+
id_value: icn_for_vanotify(poa.auth_headers)
75+
},
7076
personalisation: {
7177
first_name: value_or_default_for_field(claimant_first_name(poa)),
7278
org_name: value_or_default_for_field(org.name),

modules/claims_api/app/sidekiq/claims_api/va_notify_declined_job.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def send_declined_notification(ptcpnt_id:, first_name:, representative:)
4444

4545
def send_organization_notification(ptcpnt_id:, first_name:)
4646
content = {
47-
recipient_identifier: ptcpnt_id,
47+
recipient_identifier: {
48+
id_type: 'PID',
49+
id_value: ptcpnt_id
50+
},
4851
personalisation: {
4952
first_name: first_name || '',
5053
form_type: 'Appointment of Veterans Service Organization as Claimantʼs Representative (VA Form 21-22)'
@@ -59,7 +62,10 @@ def send_representative_notification(ptcpnt_id:, first_name:, representative_typ
5962
representative_type_text = get_representative_type_text(representative_type:)
6063

6164
content = {
62-
recipient_identifier: ptcpnt_id,
65+
recipient_identifier: {
66+
id_type: 'PID',
67+
id_value: ptcpnt_id
68+
},
6369
personalisation: {
6470
first_name: first_name || '',
6571
representative_type: representative_type_text || 'representative',

modules/claims_api/spec/sidekiq/va_notify_accepted_job_spec.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@
7979

8080
let(:ind_expected_params) do
8181
{
82-
recipient_identifier: rep_poa.auth_headers[notification_key],
82+
recipient_identifier: {
83+
id_type: 'ICN',
84+
id_value: org_poa.auth_headers[notification_key]
85+
},
8386
personalisation: {
8487
first_name: rep_poa.auth_headers['va_eauth_firstName'],
8588
rep_first_name: va_notify_rep.first_name,
@@ -119,7 +122,10 @@
119122

120123
let(:dependent_expected_params) do
121124
{
122-
recipient_identifier: rep_dep_poa.auth_headers[notification_key],
125+
recipient_identifier: {
126+
id_type: 'ICN',
127+
id_value: org_poa.auth_headers[notification_key]
128+
},
123129
personalisation: {
124130
first_name: dependent_poa.auth_headers['va_eauth_firstName'],
125131
rep_first_name: va_notify_rep.first_name,
@@ -159,7 +165,10 @@
159165

160166
let(:org_expected_params) do
161167
{
162-
recipient_identifier: org_poa.auth_headers[notification_key],
168+
recipient_identifier: {
169+
id_type: 'ICN',
170+
id_value: org_poa.auth_headers[notification_key]
171+
},
163172
personalisation: {
164173
first_name: organization_poa.auth_headers['va_eauth_firstName'],
165174
org_name: va_notify_org.name,

modules/claims_api/spec/sidekiq/va_notify_declined_job_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
it 'sends a declined service organization notification' do
2525
expect(vanotify_service).to receive(:send_email)
2626
.with({
27-
recipient_identifier: ptcpnt_id,
27+
recipient_identifier: {
28+
id_type: 'PID',
29+
id_value: ptcpnt_id
30+
},
2831
personalisation: {
2932
first_name:,
3033
form_type: 'Appointment of Veterans Service Organization as Claimantʼs Representative (VA Form 21-22)'
@@ -52,7 +55,10 @@
5255
it 'sends a declined individual/representative notification' do
5356
expect(vanotify_service).to receive(:send_email)
5457
.with({
55-
recipient_identifier: ptcpnt_id,
58+
recipient_identifier: {
59+
id_type: 'PID',
60+
id_value: ptcpnt_id
61+
},
5662
personalisation: {
5763
first_name:,
5864
representative_type: 'claims agent',

0 commit comments

Comments
 (0)