Class: VANotifyDdEmailJob

Inherits:
Object
  • Object
show all
Extended by:
SentryLogging
Includes:
Sidekiq::Job
Defined in:
app/sidekiq/va_notify_dd_email_job.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SentryLogging

log_exception_to_sentry, log_message_to_sentry, non_nil_hash?, normalize_level, rails_logger

Class Method Details

.send_to_emails(user_emails, dd_type) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/sidekiq/va_notify_dd_email_job.rb', line 8

def self.send_to_emails(user_emails, dd_type)
  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

#perform(email, dd_type) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'app/sidekiq/va_notify_dd_email_job.rb', line 23

def perform(email, dd_type)
  notify_client = VaNotify::Service.new(Settings.vanotify.services.va_gov.api_key)
  template_type = "direct_deposit_#{dd_type.to_sym == :ch33 ? 'edu' : 'comp_pen'}"
  template_id = Settings.vanotify.services.va_gov.template_id.public_send(template_type)

  notify_client.send_email(
    email_address: email,
    template_id:
  )
end