-
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
API-24371-valid-ssn #11899
API-24371-valid-ssn #11899
Conversation
@@ -76,7 +84,10 @@ def intent_to_file_options(type) | |||
# BGS requires at least 1 of 'participant_claimant_id' or 'claimant_ssn' | |||
def handle_claimant_fields(options:, params:, target_veteran:) | |||
claimant_ssn = params[:claimantSsn] | |||
|
|||
if claimant_ssn.present? | |||
claimant_ssn = claimant_ssn.gsub('-', '') |
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.
I presume people don't use any other separators (like phone numbers sometimes have .
instead of -
)?
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.
claimant_ssn.delete('^0-9')
feels more idiomatic to me to whitelist only digits, if we're worried about such things. I'm actually a little surprised rubocop didn't flag the non-regex gsub use with an alternative like tr
or delete
. Maybe we have that cop turned off.
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.
Updated to use delete
in PR for API-24720.
@@ -411,7 +411,7 @@ | |||
with_okta_user(scopes) do |auth_header| | |||
survivor_data = data | |||
survivor_data[:type] = 'survivor' | |||
survivor_data[:claimantSsn] = '123456' | |||
survivor_data[:claimantSsn] = '123456789' |
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.
This isn't testing that the gsub
is working to remove the dashes & parse the SSN as valid.123-45-6789
would ensure this passes as expected :)
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.
Added a test for claimantSsn with separators in PR for API-24720.
Summary
Related issue(s)
Testing done
What areas of the site does it impact?
Acceptance criteria