From 2c0df8744d1a524aa984d38a0aea587576d4de87 Mon Sep 17 00:00:00 2001 From: Bryan Alexander Date: Tue, 5 Mar 2024 16:25:51 -0500 Subject: [PATCH] 77665: Add 10-7959F Mapping/Stamping to IVC Form --- .../simple_forms_api/v1/uploads_controller.rb | 3 +- .../app/form_mappings/vha_10_7959f.json.erb | 16 ++++++++++ .../models/simple_forms_api/vha_10_7959f.rb | 25 +++++++++++++++ .../services/simple_forms_api/pdf_stamper.rb | 7 ++++- .../spec/fixtures/form_json/vha_10_7959f.json | 31 +++++++++++++++++++ .../spec/requests/v1/uploads_spec.rb | 3 +- .../spec/services/pdf_filler_spec.rb | 10 ++++-- 7 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 modules/simple_forms_api/app/form_mappings/vha_10_7959f.json.erb create mode 100644 modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f.rb create mode 100644 modules/simple_forms_api/spec/fixtures/form_json/vha_10_7959f.json diff --git a/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb b/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb index 72a471d7e54..cf2824d56dd 100644 --- a/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb +++ b/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb @@ -26,7 +26,8 @@ class UploadsController < ApplicationController }.freeze IVC_FORM_NUMBER_MAP = { - '10-10D' => 'vha_10_10d' + '10-10D' => 'vha_10_10d', + '10-7959F' => 'vha_10_7959f' }.freeze UNAUTHENTICATED_FORMS = %w[40-0247 21-10210 21P-0847 40-10007].freeze diff --git a/modules/simple_forms_api/app/form_mappings/vha_10_7959f.json.erb b/modules/simple_forms_api/app/form_mappings/vha_10_7959f.json.erb new file mode 100644 index 00000000000..81205909420 --- /dev/null +++ b/modules/simple_forms_api/app/form_mappings/vha_10_7959f.json.erb @@ -0,0 +1,16 @@ +{ + "form1[0].#subform[0].VetLastName[0]": "<%= form.data.dig('veteran', 'full_name', 'last') %>", + "form1[0].#subform[0].VetFirstName[0]": "<%= form.data.dig('veteran', 'full_name', 'first') %>", + "form1[0].#subform[0].MiddleInitials[0]": "<%= form.data.dig('veteran', 'full_name', 'middle') %>", + "form1[0].#subform[0].SocialSecurityNumber[0]": "<%= form.data.dig('veteran', 'ssn') %>", + "form1[0].#subform[0].VAClaimFileNumber[0]": "<%= form.data.dig('veteran', 'claim_number') %>", + "form1[0].#subform[0].DateofBirth[0]": "<%= form.data.dig('veteran', 'date_of_birth') %>", + "form1[0].#subform[0].PhysicalAddress[0]": "<%= form.data.dig('veteran', 'physical_address', 'street') + '\n' + form.data.dig('veteran', 'physical_address', 'city') + ', ' + form.data.dig('veteran', 'physical_address', 'state') + '\n' + form.data.dig('veteran', 'physical_address', 'postal_code') %>", + "form1[0].#subform[0].Country[0]": "<%= form.data.dig('veteran', 'physical_address', 'country') %>", + "form1[0].#subform[0].MailingAddress[0]": "<%= form.data.dig('veteran', 'mailing_address', 'street') + '\n' + form.data.dig('veteran', 'mailing_address', 'city') + ', ' + form.data.dig('veteran', 'mailing_address', 'state') + '\n' + form.data.dig('veteran', 'mailing_address', 'postal_code') %>", + "form1[0].#subform[0].Country[1]": "<%= form.data.dig('veteran', 'mailing_address', 'country') %>", + "form1[0].#subform[0].TelephoneNumber[0]": "<%= form.data.dig('veteran', 'phone_number') %>", + "form1[0].#subform[0].EmailAddress[0]": "<%= form.data.dig('veteran', 'email_address') %>", + "form1[0].#subform[0].VeteranSignature[0]": "<%= form.data['statement_of_truth_signature'] %>", + "form1[0].#subform[0].Date[0]": "<%= form.data['current_date'] %>" +} diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f.rb b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f.rb new file mode 100644 index 00000000000..64cb468dacf --- /dev/null +++ b/modules/simple_forms_api/app/models/simple_forms_api/vha_10_7959f.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module SimpleFormsApi + class VHA107959f + include Virtus.model(nullify_blank: true) + + attribute :data + + def initialize(data) + @data = data + end + + def metadata + { + 'veteranFirstName' => @data.dig('veteran', 'full_name', 'first'), + 'veteranLastName' => @data.dig('veteran', 'full_name', 'last'), + 'fileNumber' => @data.dig('veteran', 'va_file_number').presence || @data.dig('veteran', 'ssn'), + 'zipCode' => @data.dig('veteran', 'address', 'postal_code'), + 'source' => 'VA Platform Digital Forms', + 'docType' => @data['form_number'], + 'businessLine' => 'CMP' + } + end + end +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 ba7616133eb..5a6aec0f90f 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 @@ -4,7 +4,7 @@ module SimpleFormsApi class PdfStamper - FORM_REQUIRES_STAMP = %w[26-4555 21-4142 21-10210 21-0845 21P-0847 21-0966 21-0972].freeze + FORM_REQUIRES_STAMP = %w[26-4555 21-4142 21-10210 21-0845 21P-0847 21-0966 21-0972 10-7959F].freeze SUBMISSION_TEXT = 'Signed electronically and submitted via VA.gov at ' SUBMISSION_DATE_TITLE = 'Application Submitted:' @@ -31,6 +31,11 @@ def self.stamp_pdf(stamped_template_path, form, current_loa) stamp_submission_date(stamped_template_path, form.submission_date_config) end + def self.stamp107959f(stamped_template_path, form) + desired_stamps = [[26, 82.5, form.data['statement_of_truth_signature']]] + stamp(desired_stamps, stamped_template_path) + end + def self.stamp264555(stamped_template_path, form) desired_stamps = [] desired_stamps.append([73, 390, 'X']) unless form.data['previous_sah_application']['has_previous_sah_application'] diff --git a/modules/simple_forms_api/spec/fixtures/form_json/vha_10_7959f.json b/modules/simple_forms_api/spec/fixtures/form_json/vha_10_7959f.json new file mode 100644 index 00000000000..21131d31301 --- /dev/null +++ b/modules/simple_forms_api/spec/fixtures/form_json/vha_10_7959f.json @@ -0,0 +1,31 @@ +{ + "form_number": "10-7959F", + "veteran": { + "date_of_birth": "02/02/1987", + "full_name": { + "first": "Veteran", + "middle": "B", + "last": "Surname" + }, + "physical_address": { + "country": "USA", + "street": "1 Physical Ln", + "city": "Place", + "state": "AL", + "postal_code": "12345" + }, + "mailing_address": { + "country": "USA", + "street": "1 Mail Ln", + "city": "Place", + "state": "PA", + "postal_code": "12345" + }, + "ssn": "222554444", + "claim_number": "123456789", + "phone_number": "9876543213", + "email_address": "veteran@mail.com" + }, + "statement_of_truth_signature": "Veteran B Surname", + "current_date": "01/01/2024" +} \ No newline at end of file diff --git a/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb b/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb index 7320b0d3ee2..a047de6f7bb 100644 --- a/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb +++ b/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb @@ -18,7 +18,8 @@ ] ivc_forms = [ - 'vha_10_10d.json' + 'vha_10_10d.json', + 'vha_10_7959f.json' ] describe '#submit' do diff --git a/modules/simple_forms_api/spec/services/pdf_filler_spec.rb b/modules/simple_forms_api/spec/services/pdf_filler_spec.rb index c2e1bcac4d2..f872dd4acf9 100644 --- a/modules/simple_forms_api/spec/services/pdf_filler_spec.rb +++ b/modules/simple_forms_api/spec/services/pdf_filler_spec.rb @@ -22,7 +22,6 @@ def self.test_pdf_fill(form_number, test_payload = form_number) end end - test_pdf_fill 'vha_10_10d' test_pdf_fill 'vba_26_4555' test_pdf_fill 'vba_26_4555', 'vba_26_4555-min' test_pdf_fill 'vba_21_4142' @@ -39,6 +38,10 @@ def self.test_pdf_fill(form_number, test_payload = form_number) test_pdf_fill 'vba_40_0247', 'vba_40_0247-min' test_pdf_fill 'vha_10_7959c' + # IVC CHAMPVA Forms + test_pdf_fill 'vha_10_10d' + test_pdf_fill 'vha_10_7959f' + def self.test_json_valid(mapping_file) it 'validates json is parseable' do expect do @@ -48,7 +51,6 @@ def self.test_json_valid(mapping_file) end test_json_valid 'vba_26_4555.json.erb' - test_json_valid 'vha_10_10d.json.erb' test_json_valid 'vba_21_4142.json.erb' test_json_valid 'vba_21_10210.json.erb' test_json_valid 'vba_21p_0847.json.erb' @@ -56,4 +58,8 @@ def self.test_json_valid(mapping_file) test_json_valid 'vba_21_0966.json.erb' test_json_valid 'vba_40_0247.json.erb' test_json_valid 'vha_10_7959c.json.erb' + + # IVC CHAMPVA Forms + test_json_valid 'vha_10_10d.json.erb' + test_json_valid 'vha_10_7959f.json.erb' end