Class: EVSS::DisabilityCompensationForm::Form0781DocumentUploadFailureEmail
- Inherits:
-
Job
- Object
- Job
- EVSS::DisabilityCompensationForm::Form0781DocumentUploadFailureEmail
- Defined in:
- app/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email.rb
Constant Summary collapse
- STATSD_METRIC_PREFIX =
'api.form_526.veteran_notifications.form0781_upload_failure_email'
- ZSF_DD_TAG_FUNCTION =
'526_form_0781_failure_email_queuing'
Constants included from Sidekiq::Form526JobStatusTracker::JobTracker
Sidekiq::Form526JobStatusTracker::JobTracker::STATSD_KEY_PREFIX
Instance Method Summary collapse
- #log_mailer_dispatch(submission, log_info, email_response = {}) ⇒ Object private
- #perform(form526_submission_id) ⇒ Object
- #retryable_error_handler(error) ⇒ Object private
- #send_notification_mailer(submission) ⇒ Object private
Methods inherited from Job
Methods included from Sidekiq::Form526JobStatusTracker::JobTracker
#error_message, #job_success, #job_try, #klass, #log_error, #log_info, #metrics, #non_retryable_error_handler, #update_background_job_errors, #upsert_job_status, #with_tracking
Methods included from Sidekiq::Form526JobStatusTracker::BackupSubmission
#send_backup_submission_if_enabled
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Instance Method Details
#log_mailer_dispatch(submission, log_info, email_response = {}) ⇒ Object (private)
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'app/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email.rb', line 112 def log_mailer_dispatch(submission, log_info, email_response = {}) StatsD.increment("#{STATSD_METRIC_PREFIX}.success") Rails.logger.info('Form0781DocumentUploadFailureEmail notification dispatched', log_info) cl = caller_locations.first call_location = Logging::CallLocation.new(ZSF_DD_TAG_FUNCTION, cl.path, cl.lineno) zsf_monitor = ZeroSilentFailures::Monitor.new(Form526Submission::ZSF_DD_TAG_SERVICE) zsf_monitor.log_silent_failure_avoided( log_info.merge(email_confirmation_id: email_response&.id), submission&.user_account_id, call_location: ) end |
#perform(form526_submission_id) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'app/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email.rb', line 73 def perform(form526_submission_id) submission = Form526Submission.find(form526_submission_id) with_tracking('Form0781DocumentUploadFailureEmail', submission.saved_claim_id, form526_submission_id) do send_notification_mailer(submission) end rescue => e retryable_error_handler(e) end |
#retryable_error_handler(error) ⇒ Object (private)
85 86 87 88 89 90 |
# File 'app/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email.rb', line 85 def retryable_error_handler(error) # Needed to log the error properly in the Sidekiq::Form526JobStatusTracker::JobTracker, # which is included near the top of this job's inheritance tree in EVSS::DisabilityCompensationForm::JobStatus super(error) raise error end |
#send_notification_mailer(submission) ⇒ Object (private)
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'app/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email.rb', line 92 def send_notification_mailer(submission) email_address = submission.veteran_email_address first_name = submission.get_first_name date_submitted = 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.form0781_upload_failure_notification_template_id notify_response = notify_client.send_email( email_address:, template_id:, personalisation: { first_name:, date_submitted: } ) log_info = { form526_submission_id: submission.id, timestamp: Time.now.utc } log_mailer_dispatch(submission, log_info, notify_response) end |