-
Notifications
You must be signed in to change notification settings - Fork 166
LG-14830 | Send ID type to AAMVA #11428
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
Changes from all commits
526ecaa
bf22447
3bc17f2
66ca749
fddc67c
6e88ae5
1db0c82
fe5e5e9
4c3797c
cac657e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,9 +84,36 @@ def add_user_provided_data_to_body | |
| inside: '//dldv:verifyDriverLicenseDataRequest', | ||
| ) | ||
|
|
||
| if IdentityConfig.store.aamva_send_id_type | ||
|
Contributor
Author
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. This is feature-flagged so we can disable this if for some reason it goes awry.
Contributor
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. 👍 We should add a ticket to remove the feature flag if we don't encounter any issues having it enabled. |
||
| add_state_id_type( | ||
| applicant.state_id_data.state_id_type, | ||
| document, | ||
| ) | ||
| end | ||
|
|
||
| @body = document.to_s | ||
| end | ||
|
|
||
| def add_state_id_type(id_type, document) | ||
| category_code = case id_type | ||
| when 'drivers_license' | ||
| 1 | ||
| when 'drivers_permit' | ||
| 2 | ||
|
Comment on lines
+101
to
+102
Contributor
Author
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. I haven't seen this in the wild in Cloudwatch, but it's listed in other classes as an allowed type, and is something AAMVA supports.
Contributor
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. I only see this mentioned in the mock client? Can we just remove it there and then remove this (maybe leave a comment that AAMVA supports "2" to mean
Contributor
Author
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. I was conflicted about this. I didn't see it in Cloudwatch but wasn't positive if that's because it was very uncommon (most people with permits are probably minors, and people with a permit probably tend to upgrade it to a driver's license within a year or so), or because it's not supported. My instinct is to keep it in the API client, partly for documentation and partly in case we start sending it some day. However, I don't feel strongly at all if you think it's best to remove. |
||
| when 'state_id_card' | ||
| 3 | ||
| end | ||
|
|
||
|
Comment on lines
+98
to
+106
Contributor
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. (suggestion, non-blocking): It would be great if this was stored as a |
||
| if category_code | ||
| add_optional_element( | ||
| 'aa:DocumentCategoryCode', | ||
| value: category_code, | ||
| document:, | ||
| inside: '//dldv:verifyDriverLicenseDataRequest', | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| def add_optional_element(name, value:, document:, inside: nil, after: nil) | ||
| return if value.blank? | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,8 +72,8 @@ def invalid_state_id_number?(state_id_number) | |
| end | ||
|
|
||
| def invalid_state_id_type?(state_id_type) | ||
| !SUPPORTED_STATE_ID_TYPES.include?(state_id_type) || | ||
| state_id_type.nil? | ||
| !SUPPORTED_STATE_ID_TYPES.include?(state_id_type) && | ||
| !state_id_type.nil? | ||
|
Contributor
Author
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. This caused a lot of grief in tests. AFAICT, the non-mock client does not require the presence of |
||
| end | ||
| end | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,22 +234,15 @@ | |
| allow(user).to receive(:establishing_in_person_enrollment).and_return(enrollment) | ||
| end | ||
|
|
||
| it 'sets ssn and state_id_type on pii_from_user' do | ||
| it 'sets ssn on pii_from_user' do | ||
| expect(Idv::Agent).to receive(:new).with( | ||
| hash_including( | ||
|
Contributor
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. (suggestion, non-blocking): This is more of a regression testing thing, but it would be good to have an expectation that ensures we aren't sending
Contributor
Author
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. This is a weird case and I'm on the fence. My approach with this was that it is no longer reasonable to require |
||
| state_id_type: 'drivers_license', | ||
| ssn: Idp::Constants::MOCK_IDV_APPLICANT_SAME_ADDRESS_AS_ID[:ssn], | ||
| consent_given_at: subject.idv_session.idv_consent_given_at, | ||
| ), | ||
| ).and_call_original | ||
|
|
||
| # our test data already has the expected value by default | ||
| subject.user_session['idv/in_person'][:pii_from_user].delete(:state_id_type) | ||
|
|
||
| put :update | ||
|
|
||
| expect(subject.user_session['idv/in_person'][:pii_from_user][:state_id_type]). | ||
| to eq 'drivers_license' | ||
|
Contributor
Author
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. This was explicitly testing that we shoehorned 'drivers_license' in from the VerifyInfoController, which I ripped out. |
||
| end | ||
|
|
||
| context 'a user does not have an establishing in person enrollment associated with them' do | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,7 +153,7 @@ | |
| vendor_name: 'ResolutionMock', | ||
| vendor_workflow: nil, | ||
| verified_attributes: nil }, | ||
| state_id: state_id_resolution_with_id_type, | ||
| state_id: state_id_resolution, | ||
|
Contributor
Author
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. This is the |
||
| threatmetrix: threatmetrix_response, | ||
| }, | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |
| <nc:LocationStateUsPostalServiceCode>VA</nc:LocationStateUsPostalServiceCode> | ||
| <nc:LocationPostalCode>20176</nc:LocationPostalCode> | ||
| </aa:Address> | ||
| </dldv:verifyDriverLicenseDataRequest> | ||
| <aa:DocumentCategoryCode>1</aa:DocumentCategoryCode></dldv:verifyDriverLicenseDataRequest> | ||
|
Contributor
Author
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. "This looks misformatted!," you might argue. I totally agree! But this is what the code generates. |
||
| </dldv:VerifyDriverLicenseData> | ||
| </soap:Body> | ||
| </soap:Envelope> | ||
| </soap:Envelope> | ||
|
Contributor
Author
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. I think this is some DOS vs. UNIX line endings cursedness. There is not an extra newline at the end; it's just a plain text file. This came in when I edited the file. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ | |
|
|
||
| describe '#body' do | ||
| it 'should be a request body' do | ||
| expect(subject.body).to eq(AamvaFixtures.verification_request) | ||
| expect(subject.body + "\n").to eq(AamvaFixtures.verification_request) | ||
|
Contributor
Author
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. "This is disgusting!," you might protest again. And again, I agree. I am going to file a followup story or five, because:
|
||
| end | ||
|
|
||
| it 'should escape XML in applicant data' do | ||
|
|
@@ -88,6 +88,64 @@ | |
| '<aa:DriverLicenseExpirationDate>2030-01-02</aa:DriverLicenseExpirationDate>', | ||
| ) | ||
| end | ||
|
|
||
| context '#state_id_type' do | ||
| context 'when the feature flag is off' do | ||
| before do | ||
| expect(IdentityConfig.store).to receive(:aamva_send_id_type).and_return(false) | ||
| end | ||
|
|
||
| it 'does not add a DocumentCategoryCode' do | ||
| applicant.state_id_data.state_id_type = 'drivers_license' | ||
| expect(subject.body).to_not include('<aa:DocumentCategoryCode>') | ||
| end | ||
| end | ||
|
|
||
| context 'when the feature flag is on' do | ||
| before do | ||
| expect(IdentityConfig.store).to receive(:aamva_send_id_type).and_return(true) | ||
| end | ||
|
|
||
| context 'when the type is a Drivers License' do | ||
| it 'includes DocumentCategoryCode=1' do | ||
| applicant.state_id_data.state_id_type = 'drivers_license' | ||
| expect(subject.body).to include( | ||
| '<aa:DocumentCategoryCode>1</aa:DocumentCategoryCode>', | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context 'when the type is a learners permit' do | ||
| it 'includes DocumentCategoryCode=2' do | ||
| applicant.state_id_data.state_id_type = 'drivers_permit' | ||
| expect(subject.body).to include( | ||
| '<aa:DocumentCategoryCode>2</aa:DocumentCategoryCode>', | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context 'when the type is an ID Card' do | ||
| it 'includes DocumentCategoryCode=3' do | ||
| applicant.state_id_data.state_id_type = 'state_id_card' | ||
| expect(subject.body).to include( | ||
| '<aa:DocumentCategoryCode>3</aa:DocumentCategoryCode>', | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context 'when the type is something invalid' do | ||
| it 'does not add a DocumentCategoryCode for nil ID type' do | ||
| applicant.state_id_data.state_id_type = nil | ||
| expect(subject.body).to_not include('<aa:DocumentCategoryCode>') | ||
| end | ||
|
|
||
| it 'does not add a DocumentCategoryCode for invalid ID types' do | ||
| applicant.state_id_data.state_id_type = 'License to Keep an Alpaca' | ||
| expect(subject.body).to_not include('<aa:DocumentCategoryCode>') | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| describe '#headers' do | ||
|
|
||
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 want to run this by Team Joy. I think I hadn't initially grokked exactly what this was doing.
In doc auth, we have
state_id_typefrom another vendor's response and can pass that to AAMVA. This, however, is in the IPP flow, where data parsed from the image of the driver's license is unavailable, because the user is not taking this path. This code was setting it todrivers_license, which is the most common value.It turns out that, in VerificationRequest, we were never (whether IPP or not) actually sending
state_id_typeto AAMVA, ever. We passed it down the chain thinking we were, but it was (seemingly inadvertently) left out of the XML template.I think there are 3 options we could take in this controller here:
state_id_typeto AAMVA when we don't have that information.I went for option 3 here, which feels most correct. We know it's OK to not send because that's currently what we do for everyone. Option 2 could be added later if Team Joy wants.
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.
FTR I agree we should not send this information to AAMVA unless the user has actually given it to us (or maybe in some states we can suss out the document type based on the format of the ID number? I don't actually know)
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.
Sorry so late getting to this. I agree, option 3 seems like the best path. I will talk with product about option 2. No need to implement new behavior in your pr