@@ -311,27 +311,17 @@ def log_submission_failure_details
311311 def send_failure_email
312312 first_name = parsed_form . dig ( 'veteranFullName' , 'first' )
313313 template_id = Settings . vanotify . services . health_apps_1010 . template_id . form1010_ez_failure_email
314- salutation = first_name ? "Dear #{ first_name } ," : ''
315-
316- callback_metadata = {
317- callback_metadata : {
318- notification_type : 'error' ,
319- form_number : FORM_ID ,
320- statsd_tags : DD_ZSF_TAGS
321- }
322- }
314+ personalisation = { 'salutation' => first_name ? "Dear #{ first_name } ," : '' }
315+ metadata = { callback_metadata : { notification_type : 'error' , form_number : FORM_ID , statsd_tags : DD_ZSF_TAGS } }
323316
324317 if Flipper . enabled? ( :va_notify_v2_health_care_application_model_send_failure_email )
325318 VANotify ::V2 ::QueueEmailJob . enqueue (
326- email ,
327- template_id ,
328- { 'salutation' => salutation } ,
329- 'Settings.vanotify.services.health_apps_1010.api_key' ,
330- callback_metadata
319+ email , template_id , personalisation ,
320+ 'Settings.vanotify.services.health_apps_1010.api_key' , metadata
331321 )
332322 else
333323 api_key = Settings . vanotify . services . health_apps_1010 . api_key
334- VANotify ::EmailJob . perform_async ( email , template_id , { 'salutation' => salutation } , api_key , callback_metadata )
324+ VANotify ::EmailJob . perform_async ( email , template_id , personalisation , api_key , metadata )
335325 end
336326
337327 StatsD . increment ( "#{ HCA ::Service ::STATSD_KEY_PREFIX } .submission_failure_email_sent" )
0 commit comments