Skip to content

Commit

Permalink
[Automated] Merged master into target k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
va-vsp-bot authored Apr 10, 2024
2 parents 66ad9ef + e0d4e72 commit b4bb97d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"form1[0].#subform[0].TextField1[0]": "<%= form.data.dig('veteran_full_name', 'first') + ' ' + (form.data.dig('veteran_full_name', 'middle') || '') + ' ' + form.data.dig('veteran_full_name', 'last') %>",
"form1[0].#subform[0].TextField1[0]": "<%= form.veteran_name %>",
"form1[0].#subform[0].TextField1[1]": "<%= form.data.dig('veteran_id', 'ssn') || form.data.dig('veteran_id', 'va_file_number') %>",
"form1[0].#subform[0].CheckBox5[0]": "",
"form1[0].#subform[0].CheckBox5[1]": "",
Expand All @@ -13,8 +13,8 @@
"form1[0].#subform[0].CheckBox5[9]": "",
"form1[0].#subform[0].Date1[0]": "<%= form.data['veteran_date_of_birth'] %>",
"form1[0].#subform[0].Date1[1]": "<%= form.data['veteran_date_of_death'] %>",
"form1[0].#subform[0].TextField1[2]": "<%= form.data.dig('applicant_full_name', 'first') + ' ' + (form.data.dig('applicant_full_name', 'middle') || '') + ' ' + form.data.dig('applicant_full_name', 'last') %>",
"form1[0].#subform[0].TextField4[0]": "<%= form.data.dig('applicant_address', 'street') + ', ' + (form.data.dig('applicant_address', 'street2') || '') + '\n' + form.data.dig('applicant_address', 'city') + ', ' + form.data.dig('applicant_address', 'state') + ' ' + form.data.dig('applicant_address', 'postal_code') + ' ' + form.data.dig('applicant_address', 'country') %>",
"form1[0].#subform[0].TextField1[2]": "<%= form.applicant_name %>",
"form1[0].#subform[0].TextField4[0]": "<%= form.applicant_address %>",
"form1[0].#subform[0].TextField1[3]": "<%= form.data['applicant_phone'] %>",
"form1[0].#subform[0].TextField1[4]": "<%= form.data['applicant_email'] %>",
"form1[0].#subform[0].TextField2[0]": "<%= form.data['certificates'] %>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ def metadata
}
end

def veteran_name
first_name = data.dig('veteran_full_name', 'first') || ''
middle_name = data.dig('veteran_full_name', 'middle') || ''
last_name = data.dig('veteran_full_name', 'last') || ''

"#{first_name} #{middle_name} #{last_name}"
end

def applicant_name
first_name = data.dig('applicant_full_name', 'first') || ''
middle_name = data.dig('applicant_full_name', 'middle') || ''
last_name = data.dig('applicant_full_name', 'last') || ''

"#{first_name} #{middle_name} #{last_name}"
end

def applicant_address
street = data.dig('applicant_address', 'street') || ''
street2 = data.dig('applicant_address', 'street2') || ''
city = data.dig('applicant_address', 'city') || ''
state = data.dig('applicant_address', 'state') || ''
postal_code = data.dig('applicant_address', 'postal_code') || ''
country = data.dig('applicant_address', 'country') || ''

"#{street}, #{street2}\\n#{city}, #{state} #{postal_code} #{country}"
end

def zip_code_is_us_based
@data.dig('applicant_address', 'country') == 'USA'
end
Expand All @@ -39,6 +66,10 @@ def handle_attachments(file_path)
end
end

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 }
end
Expand Down Expand Up @@ -85,5 +116,42 @@ def fill_pdf_with_additional_address

filler.generate
end

def veteran_ssn_and_file_number
[
data.dig('veteran_id', 'ssn')&.[](0..2),
data.dig('veteran_id', 'ssn')&.[](3..4),
data.dig('veteran_id', 'ssn')&.[](5..8),
data.dig('veteran_id', 'va_file_number')&.[](0..2),
data.dig('veteran_id', 'va_file_number')&.[](3..4),
data.dig('veteran_id', 'va_file_number')&.[](5..8)
]
end

def veteran_dates_of_birth_and_death
[
data['veteran_date_of_birth']&.[](0..3),
data['veteran_date_of_birth']&.[](5..6),
data['veteran_date_of_birth']&.[](8..9),
data['veteran_date_of_death']&.[](0..3),
data['veteran_date_of_death']&.[](5..6),
data['veteran_date_of_death']&.[](8..9)
]
end

def applicant_zip
[
data.dig('applicant_address', 'postal_code')&.[](0..4),
data.dig('applicant_address', 'postal_code')&.[](5..8)
]
end

def applicant_phone
[
data['applicant_phone']&.gsub('-', '')&.[](0..2),
data['applicant_phone']&.gsub('-', '')&.[](3..5),
data['applicant_phone']&.gsub('-', '')&.[](6..9)
]
end
end
end
2 changes: 2 additions & 0 deletions modules/simple_forms_api/lib/simple_forms_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def scrub_pii(message)
words_to_remove += SimpleFormsApi::VBA21p0847.new(params).words_to_remove
when '21-0845'
words_to_remove += SimpleFormsApi::VBA210845.new(params).words_to_remove
when '40-0247'
words_to_remove += SimpleFormsApi::VBA400247.new(params).words_to_remove
else
return "something has gone wrong with your form, #{params[:form_number]} and the entire " \
'error message has been redacted to keep PII from getting leaked'
Expand Down

0 comments on commit b4bb97d

Please sign in to comment.