Class: SavedClaim::DependencyVerificationClaim

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

Constant Summary collapse

FORM =
'21-0538'

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, #business_line, #confirmation_number, #email, #form_is_string, #form_matches_schema, #form_must_be_string, #insert_notification, #open_struct_form, #parsed_form, #process_attachments!, #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

#add_claimant_info(user) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/models/saved_claim/dependency_verification_claim.rb', line 24

def add_claimant_info(user)
  updated_form = parsed_form

  updated_form.merge!(
    {
      'dependencyVerification' => {
        'updateDiaries' => true,
        'veteranInformation' => {
          'fullName' => {
            'first' => user.first_name,
            'middleInitial' => user.middle_name,
            'last' => user.last_name
          },
          'ssn' => user.ssn,
          'dateOfBirth' => user.birth_date,
          'email' => user.email
        }
      }
    }
  ).except!('update_diaries')

  update(form: updated_form.to_json)
end

#regional_officeObject



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

def regional_office
  []
end

#send_to_central_mail!Object



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

def send_to_central_mail!
  form_copy = parsed_form

  form_copy['veteranSocialSecurityNumber'] = parsed_form.dig('dependencyVerification', 'veteranInformation', 'ssn')
  form_copy['veteranFullName'] = parsed_form.dig('dependencyVerification', 'veteranInformation', 'fullName')
  form_copy['veteranAddress'] = ''

  update(form: form_copy.to_json)

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