-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
93461: Add stamps and digital signature to VBA214140 #20059
Open
derekhouck
wants to merge
19
commits into
master
Choose a base branch
from
93461-model-for-employment-history-questionnaire
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1ae3a20
Organize signature fields on template
derekhouck aefaa8b
Add pending tests for signature and signature date methods
derekhouck f2ead56
Add #signature_date_employed
derekhouck 54fc5b2
Add #signature_date_unemployed
derekhouck c787ef8
Add #signature_employed and #signature_unemployed
derekhouck 3b386ed
Map properly formatted signature date to PDF
derekhouck 724140d
Add stamp to appropriate area
derekhouck 7e4f948
Add submission date stamps
derekhouck c1abb9f
Add 21-4140 to ScrubbedUploadsSubmitError#scrub_pii
derekhouck b2a1df1
Add 21-4140 to ScrubbedUploadsSubmitError#scrub_pii
derekhouck 5e3dc5e
Revert "Add 21-4140 to ScrubbedUploadsSubmitError#scrub_pii"
derekhouck c57c285
Fix namespace
derekhouck 162dd7f
Remove irrelevant comment
derekhouck 1cad288
Move post calls to it blocks
derekhouck 5e88346
Linting bs
derekhouck bf00e29
Merge branch 'master' into 93461-model-for-employment-history-questio…
derekhouck f0c7730
Fix over-linting
derekhouck c9b798c
More linting bs
derekhouck 25a23c6
Restore Gemfile.lock
derekhouck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -17,10 +17,13 @@ def initialize(data) | |
state_code: data.dig('address', 'state'), | ||
zip_code: data.dig('address', 'postal_code') | ||
) | ||
@signature = data['statement_of_truth_signature'] | ||
@signature_date_formatted = signature_date.strftime('%m/%d/%Y') | ||
end | ||
|
||
def desired_stamps | ||
[] | ||
coords = employed? ? [[50, 410]] : [[50, 275]] | ||
[{ coords:, text: signature, page: 1 }] | ||
Comment on lines
+25
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coordinates originate from the bottom left corner of the page. |
||
end | ||
|
||
def dob | ||
|
@@ -31,11 +34,15 @@ def dob | |
end | ||
|
||
def employed? | ||
data['employers'] ? data['employers'].size.positive? : false | ||
employers.any? | ||
end | ||
|
||
def employers | ||
data['employers']&.delete_if(&:empty?) || [] | ||
end | ||
|
||
def employment_history | ||
[*0..3].map { |i| FormEngine::EmploymentHistory.new(data['employers'][i]) } | ||
[*0..3].map { |i| FormEngine::EmploymentHistory.new(employers[i]) } | ||
end | ||
|
||
def first_name | ||
|
@@ -70,21 +77,66 @@ def phone_primary | |
data['home_phone'].insert(-8, '-').insert(-5, '-') | ||
end | ||
|
||
def signature_date_employed | ||
employed? ? signature_date_formatted : nil | ||
end | ||
|
||
def signature_date_unemployed | ||
employed? ? nil : signature_date_formatted | ||
end | ||
|
||
def signature_employed | ||
employed? ? signature : nil | ||
end | ||
|
||
def signature_unemployed | ||
employed? ? nil : signature | ||
end | ||
|
||
def ssn | ||
trimmed_ssn = data.dig('veteran_id', 'ssn')&.tr('-', '') | ||
|
||
[trimmed_ssn&.[](0..2), trimmed_ssn&.[](3..4), trimmed_ssn&.[](5..8)] | ||
end | ||
|
||
def submission_date_stamps(_timestamp) | ||
[] | ||
def submission_date_stamps(timestamp = Time.current) | ||
[ | ||
{ | ||
coords: [450, 670], | ||
text: 'Application Submitted:', | ||
page: 0, | ||
font_size: 12 | ||
}, | ||
{ | ||
coords: [450, 650], | ||
text: timestamp.in_time_zone('UTC').strftime('%H:%M %Z %D'), | ||
page: 0, | ||
font_size: 12 | ||
} | ||
] | ||
end | ||
|
||
# At the moment, we only allow veterans to submit Form Engine forms. | ||
def track_user_identity(confirmation_number); end | ||
|
||
def words_to_remove | ||
ssn + dob + address_to_remove + contact_info | ||
end | ||
|
||
def zip_code_is_us_based | ||
address.country_code_iso3 == 'USA' | ||
end | ||
|
||
private | ||
|
||
attr_reader :signature, :signature_date_formatted | ||
|
||
def address_to_remove | ||
[address.address_line1, address.address_line2, address.zip_code] | ||
end | ||
|
||
def contact_info | ||
[phone_primary, phone_alternate, data['email_address']] | ||
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
85 changes: 85 additions & 0 deletions
85
modules/simple_forms_api/spec/fixtures/form_json/form_with_dangerous_characters_21_4140.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,85 @@ | ||
{ | ||
"veteran_id": { | ||
"ssn": "547-90-1234", | ||
"va_file_number": "12345678" | ||
}, | ||
"service_number": "A12345678", | ||
"home_phone": "1231231233", | ||
"mobile_phone": "9876543210", | ||
"email_address": "[email protected]", | ||
"address": { | ||
"country": "USA", | ||
"street": "123 Fake St", | ||
"street2": "Apt 123", | ||
"street3": "Attn: Testing", | ||
"city": "Los Angeles", | ||
"state": "CA", | ||
"postal_code": "90210" | ||
}, | ||
"full_name": { | ||
"first": "Rumpelstiltskin", | ||
"middle": "Test", | ||
"last": "Mephistopheles-Reinhardt" | ||
}, | ||
"date_of_birth": "1979-02-27", | ||
"employers": [ | ||
{ | ||
"type_of_work": "Full-time", | ||
"hours_per_week": "40", | ||
"lost_time": "13", | ||
"highest_income": "2300", | ||
"date_range": { | ||
"from": "2018-03-15", | ||
"to": "2020-06-30" | ||
}, | ||
"name": "Test Employer", | ||
"address": { | ||
"country": "USA", | ||
"street": "1234 Executive Ave", | ||
"city": "Metropolis", | ||
"state": "CA", | ||
"postal_code": "90210" | ||
} | ||
}, | ||
{ | ||
"type_of_work": "Freelance", | ||
"hours_per_week": "20", | ||
"lost_time": "30", | ||
"highest_income": "1300", | ||
"date_range": { | ||
"from": "2020-07-01", | ||
"to": "2022-09-13" | ||
}, | ||
"name": "Freelancer", | ||
"address": { | ||
"country": "USA", | ||
"street": "123 Test St", | ||
"city": "Test City", | ||
"state": "CA", | ||
"postal_code": "90210" | ||
} | ||
}, | ||
{ | ||
"type_of_work": "Sub-contractor", | ||
"hours_per_week": "60", | ||
"lost_time": "56", | ||
"highest_income": "600", | ||
"date_range": { | ||
"from": "2022-10-11", | ||
"to": "2024-04-07" | ||
}, | ||
"name": "Example \"Construction\" Company", | ||
"address": { | ||
"country": "CAN", | ||
"street": "4321 Example Ave", | ||
"city": "Test City", | ||
"state": "NS", | ||
"postal_code": "M4B 1G5" | ||
} | ||
}, | ||
{} | ||
], | ||
"statement_of_truth_signature": "Example Test User", | ||
"statement_of_truth_certified": true, | ||
"form_number": "21-4140" | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on the employment history data, only one set of signatures/dates will be filled while the other will be blank.