Class: SavedClaim::Burial

Inherits:
CentralMailClaim show all
Defined in:
app/models/saved_claim/burial.rb

Constant Summary collapse

FORM =
'21P-530'

Instance Method Summary collapse

Methods inherited from SavedClaim

add_form_and_validation, #confirmation_number, #form_is_string, #form_matches_schema, #form_must_be_string, #open_struct_form, #parsed_form, #submit_to_structured_data_services!, #submitted_at, #to_pdf, #update_form

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Instance Method Details

#attachment_keysObject



20
21
22
# File 'app/models/saved_claim/burial.rb', line 20

def attachment_keys
  %i[transportationReceipts deathCertificate].freeze
end

#emailObject



24
25
26
# File 'app/models/saved_claim/burial.rb', line 24

def email
  parsed_form['claimantEmail']
end

#process_attachments!Object



8
9
10
11
12
13
14
# File 'app/models/saved_claim/burial.rb', line 8

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) }

  CentralMail::SubmitSavedClaimJob.new.perform(id)
end

#regional_officeObject



16
17
18
# File 'app/models/saved_claim/burial.rb', line 16

def regional_office
  PensionBurial::ProcessingOffice.address_for(open_struct_form.claimantAddress.postalCode)
end