Method: EVSS::DisabilityCompensationForm::Form526DocumentUploadFailureEmail#send_notification_mailer

Defined in:
app/sidekiq/evss/disability_compensation_form/form526_document_upload_failure_email.rb

#send_notification_mailer(submission, supporting_evidence_attachment_guid) ⇒ Object (private)



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'app/sidekiq/evss/disability_compensation_form/form526_document_upload_failure_email.rb', line 89

def send_notification_mailer(submission, supporting_evidence_attachment_guid)
  form_attachment = SupportingEvidenceAttachment.find_by!(guid: supporting_evidence_attachment_guid)

  # We need to obscure the original filename as it may contain PII
  obscured_filename = form_attachment.obscured_filename
  email_address = submission.veteran_email_address
  first_name = submission.get_first_name
   = submission.format_creation_time_for_mailers

  notify_service_bd = Settings.vanotify.services.benefits_disability
  notify_client = VaNotify::Service.new(notify_service_bd.api_key)
  template_id = notify_service_bd.template_id.form526_document_upload_failure_notification_template_id

  notify_response = notify_client.send_email(
    email_address:,
    template_id:,
    personalisation: { first_name:, filename: obscured_filename, date_submitted: }
  )

  log_info = { obscured_filename:, form526_submission_id: submission.id,
               supporting_evidence_attachment_guid:, timestamp: Time.now.utc }

  log_mailer_dispatch(log_info, submission, notify_response)
end