-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VA forms: Add form 21P-0847 (#12960)
* initially generated files for 21p-0847 * add form mappings and tests * rename files * one more name change * refactor multistamp methods and add tests
- Loading branch information
Showing
10 changed files
with
205 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"F[0].Page_2[0].FirstNameOfDeceasedClaimant[0]": "<%= data.dig('veteran_full_name', 'first') %>", | ||
"F[0].Page_2[0].DeceasedClaimantMiddleInitial1[0]": "<%= data.dig('veteran_full_name', 'middle') %>", | ||
"F[0].Page_2[0].DeceasedClaimantLastName[0]": "<%= data.dig('veteran_full_name', 'last') %>", | ||
"F[0].Page_2[0].VA_File_Number[0]": "<%= data['veteran_va_file_number'] %>", | ||
"F[0].Page_2[0].VeteransSocialSecurityNumber_FirstThreeNumbers[0]": "<%= data['veteran_ssn']&.[](0..2) %>", | ||
"F[0].Page_2[0].VeteransSocialSecurityNumber_SecondTwoNumbers[0]": "<%= data['veteran_ssn']&.[](3..4) %>", | ||
"F[0].Page_2[0].VeteransSocialSecurityNumber_LastFourNumbers[0]": "<%= data['veteran_ssn']&.[](5..8) %>", | ||
"F[0].Page_2[0].DOByear[0]": "<%= data['veteran_date_of_birth']&.[](0..3) %>", | ||
"F[0].Page_2[0].DOBmonth[0]": "<%= data['veteran_date_of_birth']&.[](5..6) %>", | ||
"F[0].Page_2[0].DOBday[0]": "<%= data['veteran_date_of_birth']&.[](8..9) %>", | ||
"F[0].Page_2[0].DODyear[0]": "<%= data['veteran_date_of_death']&.[](0..3) %>", | ||
"F[0].Page_2[0].DODmonth[0]": "<%= data['veteran_date_of_death']&.[](5..6) %>", | ||
"F[0].Page_2[0].DODday[0]": "<%= data['veteran_date_of_death']&.[](8..9) %>", | ||
|
||
"F[0].Page_2[0].SubstituteClaimantFirstName[0]": "<%= data.dig('preparer_name', 'first') %>", | ||
"F[0].Page_2[0].SubstituteClaimantMiddleInitial[0]": "<%= data.dig('preparer_name', 'middle') %>", | ||
"F[0].Page_2[0].SubstituteClaimantLastName[0]": "<%= data.dig('preparer_name', 'last') %>", | ||
"F[0].Page_2[0].Relationship[0]": "<%= data['relationship_to_deceased_claimant'] == 'other' ? data['other_relationship_to_deceased_claimant'] : data['relationship_to_deceased_claimant'] %>", | ||
"F[0].Page_2[0].ClaimantsSocialSecurityNumber_FirstThreeNumbers[0]": "<%= data['preparer_ssn']&.[](0..2) %>", | ||
"F[0].Page_2[0].ClaimantsSocialSecurityNumber_SecondTwoNumbers[0]": "<%= data['preparer_ssn']&.[](3..4) %>", | ||
"F[0].Page_2[0].ClaimantsSocialSecurityNumber_LastFourNumbers[0]": "<%= data['preparer_ssn']&.[](5..8) %>", | ||
"F[0].Page_2[0].CurrentMailingAddress_Country[0]": "<%= data.dig('preparer_address', 'country') %>", | ||
"F[0].Page_2[0].CurrentMailingAddress_NumberAndStreet[0]": "<%= data.dig('preparer_address', 'street') %>", | ||
"F[0].Page_2[0].CurrentMailingAddress_ApartmentOrUnitNumber[0]": "<%= data.dig('preparer_address', 'street2')&.gsub(/\D/, '') %>", | ||
"F[0].Page_2[0].CurrentMailingAddress_StateOrProvince[0]": "<%= data.dig('preparer_address', 'state') %>", | ||
"F[0].Page_2[0].CurrentMailingAddress_City[0]": "<%= data.dig('preparer_address', 'city') %>", | ||
"F[0].Page_2[0].CurrentMailingAddress_ZIPOrPostalCode_FirstFiveNumbers[0]": "<%= data.dig('preparer_address', 'postal_code')&.[](0..4) %>", | ||
"F[0].Page_2[0].CurrentMailingAddress_ZIPOrPostalCode_LastFourNumbers[0]": "<%= data.dig('preparer_address', 'postal_code')&.[](5..8) %>", | ||
"F[0].Page_2[0].DaytimePhone[0]": "<%= data['preparer_home_phone'] %>", | ||
"F[0].Page_2[0].EveningPhone[0]": "<%= data['preparer_home_phone'] %>", | ||
"F[0].Page_2[0].CellPhone[0]": "<%= data['preparer_mobile_phone'] %>", | ||
"F[0].Page_2[0].EmailAddress[0]": "<%= data['preparer_email'] %>", | ||
"F[0].Page_2[0].FaxNumber[0]": "<%= %>", | ||
"F[0].Page_2[0].Remarks[0]": "<%= data.dig('deceased_claimant_name', 'first') ? 'Deceased claimant info: ' : '' %><%= data.dig('deceased_claimant_name', 'first') %> <%= data.dig('deceased_claimant_name', 'middle') %> <%= data.dig('deceased_claimant_name', 'last') %> <%= data['deceased_claimant_date_of_birth'] ? 'dob: ' : '' %><%= data['deceased_claimant_date_of_birth'] %> <%= data['deceased_claimant_date_of_death'] ? 'dod:' : '' %> <%= data['deceased_claimant_date_of_death'] %> <%= data['deceased_claimant_ssn'] ? 'ssn: ' : '' %><%= data['deceased_claimant_ssn'] %> <%= data['deceased_claimant_va_file_number'] ? 'va file number: ' : '' %><%= data['deceased_claimant_va_file_number'] %> <%= data['additional_information'] ? 'Remarks: ' : '' %><%= data['additional_information'] %>", | ||
"F[0].Page_2[0].SignatureField1[0]": "<%= data.dig('preparer_name', 'first') %> <%= data.dig('preparer_name', 'middle') %> <%= data.dig('preparer_name', 'last') %>", | ||
"F[0].Page_2[0].DateSigned[0]": "<%= Time.current.in_time_zone('America/Chicago').strftime('%m/%d/%Y') %>", | ||
"F[0]": "<%= data.dig('F') %>" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module FormsApi | ||
class VBA21p0847 | ||
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['veteran_va_file_number'].presence || data['veteran_ssn'], | ||
'zipCode' => data.dig('preparer_address', 'postal_code'), | ||
'source' => 'VA Platform Digital Forms', | ||
'docType' => @data['form_number'], | ||
'businessLine' => 'CMP' | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
modules/forms_api/spec/fixtures/form_json/vba_21p_0847-min.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"form_number": "21P-0847", | ||
"preparer_name": { | ||
"first": "Arthur", | ||
"middle": "C", | ||
"last": "Preparer" | ||
}, | ||
"preparer_ssn": "222668888", | ||
"preparer_home_phone": "1234567890", | ||
"preparer_address": { | ||
"country": "USA", | ||
"street": "124 Main St", | ||
"city": "Anytown", | ||
"state": "CA", | ||
"postal_code": "12345" | ||
}, | ||
"veteran_full_name": { | ||
"first": "Ursula", | ||
"middle": "K", | ||
"last": "Veteran" | ||
}, | ||
"veteran_date_of_birth": "1929-10-21", | ||
"veteran_ssn": "999442222", | ||
"relationship_to_deceased_claimant": "spouse" | ||
} |
41 changes: 41 additions & 0 deletions
41
modules/forms_api/spec/fixtures/form_json/vba_21p_0847.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"form_number": "21P-0847", | ||
"preparer_name": { | ||
"first": "Arthur", | ||
"middle": "C", | ||
"last": "Preparer" | ||
}, | ||
"preparer_ssn": "222668888", | ||
"preparer_home_phone": "1234567890", | ||
"preparer_mobile_phone": "1234567890", | ||
"preparer_email": "preparer_address@email.com", | ||
"preparer_address": { | ||
"country": "USA", | ||
"street": "124 Main St", | ||
"street2": "Apt #44", | ||
"city": "Anytown", | ||
"state": "CA", | ||
"postal_code": "12345" | ||
}, | ||
"veteran_full_name": { | ||
"first": "Ursula", | ||
"middle": "K", | ||
"last": "Veteran" | ||
}, | ||
"veteran_date_of_birth": "1929-10-21", | ||
"veteran_date_of_death": "2018-01-22", | ||
"veteran_ssn": "999442222", | ||
"veteran_va_file_number": "111776666", | ||
"deceased_claimant_name": { | ||
"first": "Philip", | ||
"middle": "K", | ||
"last": "Deceased" | ||
}, | ||
"deceased_claimant_date_of_birth": "1928-12-16", | ||
"deceased_claimant_date_of_death": "1982-03-12", | ||
"deceased_claimant_ssn": "666117777", | ||
"deceased_claimant_va_file_number": "777992222", | ||
"relationship_to_deceased_claimant": "other", | ||
"other_relationship_to_deceased_claimant": "friend", | ||
"additional_information": "Lots of extra stuff here" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require FormsApi::Engine.root.join('spec', 'spec_helper.rb') | ||
|
||
describe FormsApi::PdfStamper do | ||
def self.test_pdf_stamp_error(stamp_method, test_payload) | ||
it 'raises an error when generating stamped file' do | ||
allow(Common::FileHelpers).to receive(:random_file_path).and_return('fake/stamp_path') | ||
allow(Common::FileHelpers).to receive(:delete_file_if_exists) | ||
allow(Prawn::Document).to receive(:generate).and_raise('Error generating stamped file') | ||
|
||
generated_form_path = 'fake/generated_form_path' | ||
data = JSON.parse(File.read("modules/forms_api/spec/fixtures/form_json/#{test_payload}.json")) | ||
|
||
expect do | ||
FormsApi::PdfStamper.send(stamp_method, generated_form_path, data) | ||
end.to raise_error(RuntimeError, 'Error generating stamped file') | ||
|
||
expect(Common::FileHelpers).to have_received(:delete_file_if_exists).with('fake/stamp_path') | ||
end | ||
end | ||
|
||
test_pdf_stamp_error 'stamp214142', 'vba_21_4142' | ||
test_pdf_stamp_error 'stamp2110210', 'vba_21_10210' | ||
test_pdf_stamp_error 'stamp21p0847', 'vba_21p_0847' | ||
end |
Binary file not shown.