diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10206.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10206.rb index 51d6d504eab..6bcd1c8dc17 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10206.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10206.rb @@ -36,13 +36,21 @@ def zip_code_is_us_based @data.dig('address', 'country') == 'USA' end - def submission_date_config - { - should_stamp_date?: true, - page_number: 1, - title_coords: [460, 710], - text_coords: [460, 690] - } + def submission_date_stamps + [ + { + coords: [460, 710], + text: 'Application Submitted:', + page: 1, + font_size: 12 + }, + { + coords: [460, 690], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 1, + font_size: 12 + } + ] end def track_user_identity(confirmation_number) diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb index c85aa2fc66f..c0b5c505672 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb @@ -93,10 +93,8 @@ def desired_stamps [{ coords:, text: data['statement_of_truth_signature'], page: 4 }] end - def submission_date_config - { - should_stamp_date?: false - } + def submission_date_stamps + [] end def track_user_identity(confirmation_number); end diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0845.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0845.rb index 787c2c88b03..08f4c46d1b8 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0845.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0845.rb @@ -41,13 +41,21 @@ def desired_stamps [{ coords: [50, 240], text: data['statement_of_truth_signature'], page: 2 }] end - def submission_date_config - { - should_stamp_date?: true, - page_number: 1, - title_coords: [460, 710], - text_coords: [460, 690] - } + def submission_date_stamps + [ + { + coords: [460, 710], + text: 'Application Submitted:', + page: 1, + font_size: 12 + }, + { + coords: [460, 690], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 1, + font_size: 12 + } + ] end def track_user_identity(confirmation_number) diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0966.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0966.rb index 6e7da54c6e1..ad38abcb935 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0966.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0966.rb @@ -63,13 +63,21 @@ def desired_stamps [{ coords: [50, 415], text: data['statement_of_truth_signature'], page: 1 }] end - def submission_date_config - { - should_stamp_date?: true, - page_number: 0, - title_coords: [460, 710], - text_coords: [460, 690] - } + def submission_date_stamps + [ + { + coords: [460, 710], + text: 'Application Submitted:', + page: 0, + font_size: 12 + }, + { + coords: [460, 690], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 0, + font_size: 12 + } + ] end def track_user_identity(confirmation_number) diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0972.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0972.rb index fdd73820a23..1b63fe03efc 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0972.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_0972.rb @@ -31,13 +31,21 @@ def desired_stamps [{ coords: [50, 465], text: data['statement_of_truth_signature'], page: 2 }] end - def submission_date_config - { - should_stamp_date?: true, - page_number: 1, - title_coords: [440, 690], - text_coords: [440, 670] - } + def submission_date_stamps + [ + { + coords: [440, 690], + text: 'Application Submitted:', + page: 1, + font_size: 12 + }, + { + coords: [440, 670], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 1, + font_size: 12 + } + ] end def track_user_identity(confirmation_number) diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_10210.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_10210.rb index 2ba5fcbb0cb..3dfb2fbf960 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_10210.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_10210.rb @@ -37,13 +37,21 @@ def desired_stamps [{ coords: [50, 160], text: data['statement_of_truth_signature'], page: 2 }] end - def submission_date_config - { - should_stamp_date?: true, - page_number: 0, - title_coords: [460, 710], - text_coords: [460, 690] - } + def submission_date_stamps + [ + { + coords: [460, 710], + text: 'Application Submitted:', + page: 0, + font_size: 12 + }, + { + coords: [460, 690], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 0, + font_size: 12 + } + ] end def track_user_identity(confirmation_number) diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_4142.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_4142.rb index f82f456d972..fa151f1b01a 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_21_4142.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_21_4142.rb @@ -36,13 +36,8 @@ def desired_stamps [{ coords: [50, 560], text: data['statement_of_truth_signature'], page: 1 }] end - def submission_date_config - { - should_stamp_date?: true, - page_number: 0, - title_coords: [440, 710], - text_coords: [440, 690] - } + def submission_date_stamps + [submission_date_stamps_first_page, submission_date_stamps_fourth_page].flatten end def track_user_identity(confirmation_number) @@ -98,5 +93,39 @@ def veteran_email data.dig('veteran', 'email')&.[](15..) ] end + + def submission_date_stamps_first_page + [ + { + coords: [440, 710], + text: 'Application Submitted:', + page: 0, + font_size: 12 + }, + { + coords: [440, 690], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 0, + font_size: 12 + } + ] + end + + def submission_date_stamps_fourth_page + [ + { + coords: [440, 710], + text: 'Application Submitted:', + page: 3, + font_size: 12 + }, + { + coords: [440, 690], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 3, + font_size: 12 + } + ] + end end end diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_21p_0847.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_21p_0847.rb index d5670cf04bb..424be79a46e 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_21p_0847.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_21p_0847.rb @@ -35,13 +35,21 @@ def desired_stamps [{ coords: [50, 190], text: data['statement_of_truth_signature'], page: 1 }] end - def submission_date_config - { - should_stamp_date?: true, - page_number: 1, - title_coords: [460, 710], - text_coords: [460, 690] - } + def submission_date_stamps + [ + { + coords: [460, 710], + text: 'Application Submitted:', + page: 1, + font_size: 12 + }, + { + coords: [460, 690], + text: Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D'), + page: 1, + font_size: 12 + } + ] end def track_user_identity(confirmation_number) diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_26_4555.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_26_4555.rb index 2584fe31709..f80757206ad 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_26_4555.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_26_4555.rb @@ -57,8 +57,8 @@ def desired_stamps end.compact end - def submission_date_config - { should_stamp_date?: false } + def submission_date_stamps + [] end def track_user_identity(confirmation_number); end diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_40_0247.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_40_0247.rb index 6e3444e669d..eeeee1754b6 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_40_0247.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_40_0247.rb @@ -70,8 +70,8 @@ def words_to_remove veteran_ssn_and_file_number + veteran_dates_of_birth_and_death + applicant_zip + applicant_phone end - def submission_date_config - { should_stamp_date?: false } + def submission_date_stamps + [] end def track_user_identity(confirmation_number); end diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_40_10007.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_40_10007.rb index 9dab970ef19..c4843559c67 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_40_10007.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_40_10007.rb @@ -221,8 +221,8 @@ def handle_attachments(file_path) def track_user_identity(confirmation_number); end - def submission_date_config - { should_stamp_date?: false } + def submission_date_stamps + [] end private diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_10d.rb b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_10d.rb index dd986e4a1e4..0c6c3711284 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_10d.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_10d.rb @@ -56,8 +56,8 @@ def handle_attachments(file_path) file_paths end - def submission_date_config - { should_stamp_date?: false } + def submission_date_stamps + [] end def track_user_identity(confirmation_number) diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959c.rb b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959c.rb index 580daa2c90b..b6a2a20cfa4 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959c.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959c.rb @@ -22,13 +22,8 @@ def metadata } end - def submission_date_config - { - should_stamp_date?: false, - page_number: 1, - title_coords: [440, 690], - text_coords: [440, 670] - } + def submission_date_stamps + [] end end end diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_1.rb b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_1.rb index 7e67ba30f91..1c30686e881 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_1.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_1.rb @@ -31,8 +31,8 @@ def desired_stamps [{ coords: [26, 82.5], text: data['statement_of_truth_signature'], page: 0 }] end - def submission_date_config - { should_stamp_date?: false } + def submission_date_stamps + [] end def track_user_identity(confirmation_number); end diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_2.rb b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_2.rb index 9bc44048f24..436e3c869b8 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_2.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f_2.rb @@ -49,8 +49,8 @@ def handle_attachments(file_path) file_paths end - def submission_date_config - { should_stamp_date?: false } + def submission_date_stamps + [] end def track_user_identity(confirmation_number); end diff --git a/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb b/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb index 68cc6e837b5..c2e708d80cc 100644 --- a/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb +++ b/modules/simple_forms_api/app/services/simple_forms_api/pdf_stamper.rb @@ -13,7 +13,7 @@ def self.stamp_pdf(stamped_template_path, form, current_loa) stamp_auth_text(stamped_template_path, current_loa) - stamp_submission_date(stamped_template_path, form.submission_date_config) + stamp_submission_date(stamped_template_path, form.submission_date_stamps) end def self.stamp_signature(stamped_template_path, form) @@ -81,11 +81,12 @@ def self.stamp(desired_stamp, stamped_template_path, append_to_stamp: false, tex coords = desired_stamp[:coords] text = desired_stamp[:text] page = desired_stamp[:page] + font_size = desired_stamp[:font_size] x = coords[0] y = coords[1] if page page_configuration = get_page_configuration(page, coords) - verified_multistamp(stamped_template_path, text, page_configuration) + verified_multistamp(stamped_template_path, text, page_configuration, font_size) else datestamp_instance = CentralMail::DatestampPdf.new(current_file_path, append_to_stamp:) current_file_path = datestamp_instance.run(text:, x:, y:, text_only:, size: 9) @@ -104,20 +105,9 @@ def self.perform_multistamp(stamped_template_path, stamp_path) raise end - def self.stamp_submission_date(stamped_template_path, config) - if config[:should_stamp_date?] - date_title_stamp_position = config[:title_coords] - date_text_stamp_position = config[:text_coords] - page_configuration = default_page_configuration - page_configuration[config[:page_number]] = { type: :text, position: date_title_stamp_position } - - verified_multistamp(stamped_template_path, SUBMISSION_DATE_TITLE, page_configuration, 12) - - page_configuration = default_page_configuration - page_configuration[config[:page_number]] = { type: :text, position: date_text_stamp_position } - - current_time = Time.current.in_time_zone('UTC').strftime('%H:%M %Z %D') - verified_multistamp(stamped_template_path, current_time, page_configuration, 12) + def self.stamp_submission_date(stamped_template_path, desired_stamps) + desired_stamps.each do |desired_stamp| + stamp(desired_stamp, stamped_template_path) end end @@ -139,20 +129,12 @@ def self.verified_multistamp(stamped_template_path, stamp_text, page_configurati verify(stamped_template_path) { multistamp(stamped_template_path, stamp_text, page_configuration, *) } end - def self.default_page_configuration - [ - { type: :new_page }, - { type: :new_page }, - { type: :new_page }, - { type: :new_page } - ] - end - def self.get_page_configuration(page, position) [ { type: :new_page }, { type: :new_page }, { type: :new_page }, + { type: :new_page }, { type: :new_page } ].tap do |config| config[page] = { type: :text, position: } diff --git a/modules/simple_forms_api/spec/services/pdf_stamper_spec.rb b/modules/simple_forms_api/spec/services/pdf_stamper_spec.rb index 4771703c2fb..aa90b4ff640 100644 --- a/modules/simple_forms_api/spec/services/pdf_stamper_spec.rb +++ b/modules/simple_forms_api/spec/services/pdf_stamper_spec.rb @@ -62,12 +62,13 @@ { type: :new_page }, { type: :new_page }, { type: :text, position: [50, 240] }, + { type: :new_page }, { type: :new_page } ] end it 'calls multistamp correctly' do - expect(described_class).to have_received(:multistamp).with(path, signature, page_config) + expect(described_class).to have_received(:multistamp).with(path, signature, page_config, nil) end end end