Skip to content

Commit 9e18482

Browse files
authored
Pre-initialize and memoize UUID for form 4142 PDF naming (#21477)
1 parent ffe0aad commit 9e18482

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/decision_review_v1/utilities/form_4142_processor.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,18 @@ def initialize(form_data:, submission_id: nil)
2929
@form = set_signature_date(form_data)
3030
validate_form4142
3131
@pdf_path = generate_stamp_pdf
32-
@uuid = SecureRandom.uuid
3332
@request_body = {
3433
'document' => to_faraday_upload,
3534
'metadata' => generate_metadata
3635
}
3736
end
3837

38+
def uuid
39+
@uuid ||= SecureRandom.uuid
40+
end
41+
3942
def generate_stamp_pdf
40-
pdf = PdfFill::Filler.fill_ancillary_form(
41-
@form, @uuid, FORM_ID
42-
)
43+
pdf = PdfFill::Filler.fill_ancillary_form(@form, uuid, FORM_ID)
4344
stamped_path = PDFUtilities::DatestampPdf.new(pdf).run(text: 'VA.gov', x: 5, y: 5,
4445
timestamp: submission_date)
4546
PDFUtilities::DatestampPdf.new(stamped_path).run(
@@ -70,7 +71,7 @@ def generate_metadata
7071
'receiveDt' => received_date,
7172
# 'uuid' => "#{@uuid}_4142", # was trying to include the main claim uuid here and just append 4142
7273
# but central mail portal does not support that
73-
'uuid' => @uuid,
74+
'uuid' => uuid,
7475
'zipCode' => address['postalCode'],
7576
'source' => 'VA Forms Group B',
7677
'hashV' => Digest::SHA256.file(@pdf_path).hexdigest,

0 commit comments

Comments
 (0)