Class: VANotifyDdEmailJob
- Inherits:
-
Object
- Object
- VANotifyDdEmailJob
show all
- Extended by:
- SentryLogging
- Includes:
- Sidekiq::Job
- Defined in:
- app/sidekiq/va_notify_dd_email_job.rb
Constant Summary
collapse
- STATSD_ERROR_NAME =
'worker.direct_deposit_confirmation_email.error'
- STATSD_SUCCESS_NAME =
'worker.direct_deposit_confirmation_email.success'
Class Method Summary
collapse
Instance Method Summary
collapse
log_exception_to_sentry, log_message_to_sentry, non_nil_hash?, normalize_level, rails_logger, set_sentry_metadata
Class Method Details
.send_to_emails(user_emails, dd_type = nil) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/sidekiq/va_notify_dd_email_job.rb', line 15
def self.send_to_emails(user_emails, dd_type = nil)
if user_emails.present?
user_emails.each do |email|
perform_async(email, dd_type)
end
else
log_message_to_sentry(
'Direct Deposit info update: no email address present for confirmation email',
:info,
{},
feature: 'direct_deposit'
)
end
end
|
Instance Method Details
#handle_errors(ex) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/sidekiq/va_notify_dd_email_job.rb', line 30
def perform(email, dd_type = nil)
notify_client = VaNotify::Service.new(Settings.vanotify.services.va_gov.api_key)
template_type = template_type(dd_type)
template_id = Settings.vanotify.services.va_gov.template_id.public_send(template_type)
notify_client.send_email(
email_address: email,
template_id:
)
StatsD.increment(STATSD_SUCCESS_NAME)
rescue => e
handle_errors(e)
end
|
#template_type(dd_type) ⇒ Object
44
45
46
47
48
49
|
# File 'app/sidekiq/va_notify_dd_email_job.rb', line 44
def template_type(dd_type)
return 'direct_deposit_edu' if dd_type&.to_sym == :ch33
return 'direct_deposit_comp_pen' if %i[comp_pen comp_and_pen].include? dd_type&.to_sym
'direct_deposit'
end
|