Class: SavedClaim::Burial
Constant Summary
collapse
- FORM =
'21P-530'
Instance Attribute Summary collapse
-
#formV2 ⇒ Object
attribute name is passed from the FE as a flag, maintaining camel case.
Instance Method Summary
collapse
Methods inherited from SavedClaim
add_form_and_validation, #after_create_metrics, #after_destroy_metrics, #confirmation_number, #form_is_string, #form_must_be_string, #insert_notification, #open_struct_form, #parsed_form, #submitted_at, #to_pdf, #update_form, #va_notification?, #validate_form, #validate_schema
descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?
Instance Attribute Details
attribute name is passed from the FE as a flag, maintaining camel case
9
10
11
|
# File 'app/models/saved_claim/burial.rb', line 9
def formV2
@formV2
end
|
Instance Method Details
#attachment_keys ⇒ Object
29
30
31
|
# File 'app/models/saved_claim/burial.rb', line 29
def attachment_keys
%i[transportationReceipts deathCertificate militarySeparationDocuments additionalEvidence].freeze
end
|
#benefits_claimed ⇒ Object
82
83
84
85
86
87
88
|
# File 'app/models/saved_claim/burial.rb', line 82
def benefits_claimed
claimed = []
claimed << 'Burial Allowance' if parsed_form['burialAllowance']
claimed << 'Plot Allowance' if parsed_form['plotAllowance']
claimed << 'Transportation' if parsed_form['transportation']
claimed
end
|
#business_line ⇒ Object
61
62
63
|
# File 'app/models/saved_claim/burial.rb', line 61
def business_line
'NCA'
end
|
#claimaint_first_name ⇒ Object
78
79
80
|
# File 'app/models/saved_claim/burial.rb', line 78
def claimaint_first_name
parsed_form.dig('claimantFullName', 'first')
end
|
#email ⇒ Object
33
34
35
|
# File 'app/models/saved_claim/burial.rb', line 33
def email
parsed_form['claimantEmail']
end
|
37
38
39
40
41
42
43
|
# File 'app/models/saved_claim/burial.rb', line 37
def form_matches_schema
return unless form_is_string
JSON::Validator.fully_validate(VetsJsonSchema::SCHEMAS[form_id], parsed_form).each do |v|
errors.add(:form, v.to_s)
end
end
|
#process_attachments! ⇒ Object
19
20
21
22
23
|
# File 'app/models/saved_claim/burial.rb', line 19
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) }
end
|
#process_pdf(pdf_path, timestamp = nil, form_id = nil) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'app/models/saved_claim/burial.rb', line 45
def process_pdf(pdf_path, timestamp = nil, form_id = nil)
processed_pdf = PDFUtilities::DatestampPdf.new(pdf_path).run(
text: 'Application Submitted on va.gov',
x: 400,
y: 675,
text_only: true, timestamp:,
page_number: 6,
template: "lib/pdf_fill/forms/pdfs/#{form_id}.pdf",
multistamp: true
)
renamed_path = "tmp/pdfs/#{form_id}_#{id}_final.pdf"
File.rename(processed_pdf, renamed_path) renamed_path end
|
#regional_office ⇒ Object
#veteran_first_name ⇒ String
utility function to retrieve claimant first name from form
70
71
72
|
# File 'app/models/saved_claim/burial.rb', line 70
def veteran_first_name
parsed_form.dig('veteranFullName', 'first')
end
|
#veteran_last_name ⇒ Object
74
75
76
|
# File 'app/models/saved_claim/burial.rb', line 74
def veteran_last_name
parsed_form.dig('veteranFullName', 'last')
end
|