Skip to content

Commit

Permalink
77665: Add 10-7959F Mapping/Stamping to IVC Form
Browse files Browse the repository at this point in the history
  • Loading branch information
balexandr committed Mar 5, 2024
1 parent a2363e7 commit 2c0df87
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions modules/simple_forms_api/app/form_mappings/vha_10_7959f.json.erb
Original file line number Diff line number Diff line change
@@ -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'] %>"
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:'

Expand All @@ -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']
Expand Down
31 changes: 31 additions & 0 deletions modules/simple_forms_api/spec/fixtures/form_json/vha_10_7959f.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
},
"statement_of_truth_signature": "Veteran B Surname",
"current_date": "01/01/2024"
}
3 changes: 2 additions & 1 deletion modules/simple_forms_api/spec/requests/v1/uploads_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
]

ivc_forms = [
'vha_10_10d.json'
'vha_10_10d.json',
'vha_10_7959f.json'
]

describe '#submit' do
Expand Down
10 changes: 8 additions & 2 deletions modules/simple_forms_api/spec/services/pdf_filler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand All @@ -48,12 +51,15 @@ 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'
test_json_valid 'vba_21_0972.json.erb'
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

0 comments on commit 2c0df87

Please sign in to comment.