Class: SavedClaim::EducationCareerCounselingClaim

Inherits:
CentralMailClaim show all
Includes:
SentryLogging
Defined in:
app/models/saved_claim/education_career_counseling_claim.rb

Constant Summary collapse

FORM =
'28-8832'

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata

Methods inherited from SavedClaim

add_form_and_validation, #after_create_metrics, #after_destroy_metrics, #attachment_keys, #confirmation_number, #email, #form_is_string, #form_matches_schema, #form_must_be_string, #insert_notification, #open_struct_form, #parsed_form, #submitted_at, #to_pdf, #update_form, #va_notification?, #validate_form, #validate_schema

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Instance Method Details

#business_lineObject



33
34
35
# File 'app/models/saved_claim/education_career_counseling_claim.rb', line 33

def business_line
  'EDU'
end

#process_attachments!Object



25
26
27
28
29
30
31
# File 'app/models/saved_claim/education_career_counseling_claim.rb', line 25

def process_attachments!
  refs = attachment_keys.map { |key| Array(open_struct_form.send(key)) }.flatten
  files = PersistentAttachment.where(guid: refs.map(&:confirmationCode))
  files.find_each { |f| f.update(saved_claim_id: id) }

  Lighthouse::SubmitBenefitsIntakeClaim.new.perform(id)
end

#regional_officeObject



7
8
9
# File 'app/models/saved_claim/education_career_counseling_claim.rb', line 7

def regional_office
  []
end

#send_failure_email(email) ⇒ Object

this failure email is not the ideal way to handle the Notification Emails as part of the ZSF work, but with the initial timeline it handles the email as intended. Future work will be integrating into the Va Notify common lib: github.com/department-of-veterans-affairs/vets-api/blob/master/lib/va_notify/notification_email.rb



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/saved_claim/education_career_counseling_claim.rb', line 41

def send_failure_email(email)
  if email.present?
    VANotify::EmailJob.perform_async(
      email,
      Settings.vanotify.services.va_gov.template_id.form27_8832_action_needed_email,
      {
        'first_name' => parsed_form.dig('claimantInformation', 'fullName', 'first')&.upcase.presence,
        'date_submitted' => Time.zone.today.strftime('%B %d, %Y'),
        'confirmation_number' => confirmation_number
      }
    )
  end
end

#send_to_benefits_intake!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/models/saved_claim/education_career_counseling_claim.rb', line 11

def send_to_benefits_intake!
  form_copy = parsed_form

  if form_copy['veteranSocialSecurityNumber'].blank?
    claimant_info = parsed_form['claimantInformation']
    form_copy['veteranSocialSecurityNumber'] = claimant_info['ssn'] || claimant_info['veteranSocialSecurityNumber']

    update(form: form_copy.to_json)
  end

  log_message_to_sentry(guid, :warn, { attachment_id: guid }, { team: 'vfs-ebenefits' })
  process_attachments!
end