-
Notifications
You must be signed in to change notification settings - Fork 166
LG-16384: passport cards are not state ids #12310
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
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 |
|---|---|---|
|
|
@@ -26,13 +26,16 @@ def read_pii(true_id_product) | |
| return nil unless id_auth_field_data.present? | ||
|
|
||
| id_doc_type_slug = id_auth_field_data['Fields_DocumentClassName'] | ||
| @id_doc_type = IdentityConfig.store.doc_auth_passports_enabled ? | ||
| DocAuth::Response::ID_TYPE_SLUGS[id_doc_type_slug] : | ||
| DocAuth::Response::STATE_ID_TYPE_SLUGS[id_doc_type_slug] | ||
| id_doc_issue_type = authentication_result_field_data['DocIssueType'] | ||
|
|
||
| @id_doc_type = determine_id_doc_type( | ||
| doc_class_name: id_doc_type_slug, | ||
| doc_issue_type: id_doc_issue_type, | ||
| ) | ||
|
|
||
| if id_doc_type == 'drivers_license' || id_doc_type == 'state_id_card' | ||
| generate_state_id_pii | ||
| elsif id_doc_type == 'passport' | ||
| elsif id_doc_type == 'passport' || id_doc_type == 'passport_card' | ||
| generate_passport_pii | ||
| end | ||
| end | ||
|
|
@@ -179,6 +182,22 @@ def generate_passport_pii | |
| mrz: id_auth_field_data['Fields_MRZ'], | ||
| ) | ||
| end | ||
|
|
||
| def determine_id_doc_type(doc_class_name:, doc_issue_type:) | ||
| val = if IdentityConfig.store.doc_auth_passports_enabled | ||
| DocAuth::Response::ID_TYPE_SLUGS[doc_class_name] | ||
| else | ||
| DocAuth::Response::STATE_ID_TYPE_SLUGS[doc_class_name] | ||
| end | ||
|
|
||
| # If the DocIssueType is 'Passport Card', | ||
| # LN is returning 'Identification Card' as the DocClassName so we need to differentiate | ||
| # between a passport card and a state-issued identification card. | ||
| if doc_issue_type == 'Passport Card' | ||
|
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. What do you think about extracting this to a constant like
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. Agree - adding this to LG-16371 |
||
| val = 'passport_card' | ||
| end | ||
| val | ||
| end | ||
| end | ||
| end | ||
| end | ||
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 found myself doing a double-take on this method name since it's checking for passport cards but named
passport_book?. Wouldpassport_card_not_supported?orvalidate_not_passport_cardbe clearer?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.
Changed it to
not_passport_book?in 9e55565There 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.
Actually, per Amir's comment, I changed it back to
passport_book?but fail if id_doc_type is anything but 'passport' in 03a86f2