-
Notifications
You must be signed in to change notification settings - Fork 166
LG-13005: use TransactionStatus to determine if document passed TrueID #10427
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
0dc6768
4a56d57
34db71f
4bdd889
d7f9faa
0369a1a
69c0131
28cad5b
e59dbac
6db9df1
a8b2b5f
b6c3450
addd7e3
c52b29b
8531cee
6828d0f
a740b59
b0c4609
a50a47a
92b5c8c
a3518c0
5932f0b
394df62
203b224
ba169cf
a117959
ad8de35
60980a5
b471df6
98d0d53
bbfb249
d207dce
5be254f
99cf19e
b71e01b
fc067af
bf691c9
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 |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ def initialize(uploaded_file, config, selfie_required = false) | |
| selfie_quality_good: selfie_quality_good?, | ||
| selfie_status: selfie_status, | ||
| extra: { | ||
| transaction_status: transaction_status, | ||
| doc_auth_result: doc_auth_result, | ||
| portrait_match_results: portrait_match_results, | ||
| billed: true, | ||
|
|
@@ -39,6 +40,7 @@ def errors | |
| if file_data.blank? | ||
| {} | ||
| else | ||
| transaction_status = file_data.dig('transaction_status') | ||
| doc_auth_result = file_data.dig('doc_auth_result') | ||
| image_metrics = file_data.dig('image_metrics') | ||
| failed = file_data.dig('failed_alerts')&.dup | ||
|
|
@@ -47,6 +49,7 @@ def errors | |
| classification_info = file_data.dig('classification_info') | ||
| # Pass and doc type is ok | ||
| has_fields = [ | ||
| transaction_status, | ||
| doc_auth_result, | ||
| image_metrics, | ||
| failed, | ||
|
|
@@ -59,10 +62,11 @@ def errors | |
| # Error generator is not to be called when it's not failure | ||
| # allows us to test successful results | ||
| return {} if all_doc_capture_values_passing?( | ||
| doc_auth_result, id_type_supported? | ||
| transaction_status, id_type_supported? | ||
| ) | ||
|
|
||
| mock_args = {} | ||
| mock_args[:transaction_status] = transaction_status if transaction_status.present? | ||
| mock_args[:doc_auth_result] = doc_auth_result if doc_auth_result.present? | ||
| mock_args[:image_metrics] = image_metrics.symbolize_keys if image_metrics.present? | ||
| mock_args[:failed] = failed.map!(&:symbolize_keys) unless failed.nil? | ||
|
|
@@ -91,7 +95,8 @@ def success? | |
| end | ||
|
|
||
| def attention_with_barcode? | ||
night-jellyfish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| parsed_alerts == [ATTENTION_WITH_BARCODE_ALERT] | ||
| !!parsed_alerts&. | ||
| any? { |alert| alert['name'] == '2D Barcode Read' && alert['result'] == 'Attention' } | ||
| end | ||
|
|
||
| def self.create_network_error_response | ||
|
|
@@ -105,10 +110,14 @@ def self.create_network_error_response | |
| end | ||
|
|
||
| def doc_auth_success? | ||
| (doc_auth_result_from_uploaded_file == 'Passed' || | ||
| return false unless id_type_supported? | ||
| return false if transaction_status_from_uploaded_file == 'failed' | ||
| return true if transaction_status_from_uploaded_file == 'passed' | ||
| return false if doc_auth_result_from_uploaded_file == 'Failed' | ||
|
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. Is this line in case there are If so, it does seem like it could be worthwhile enforcing folks to include that, rather than keeping this method for old code.
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. good point .. currently we do not force folks to include doc_auth_result ... so replicating this behavior with transaction_status |
||
|
|
||
| doc_auth_result_from_uploaded_file == 'Passed' || | ||
| errors.blank? || | ||
| attention_with_barcode? | ||
| ) && id_type_supported? | ||
| (attention_with_barcode? && parsed_alerts.length == 1) | ||
| end | ||
|
|
||
| def selfie_status | ||
|
|
@@ -154,6 +163,14 @@ def doc_auth_result_from_uploaded_file | |
| parsed_data_from_uploaded_file&.[]('doc_auth_result') | ||
| end | ||
|
|
||
| def transaction_status | ||
| transaction_status_from_uploaded_file || transaction_status_from_success | ||
| end | ||
|
|
||
| def transaction_status_from_uploaded_file | ||
| parsed_data_from_uploaded_file&.[]('transaction_status') | ||
| end | ||
|
|
||
| def portrait_match_results | ||
| parsed_data_from_uploaded_file.dig('portrait_match_results')&. | ||
| transform_keys! { |key| key.to_s.camelize }&. | ||
|
|
@@ -166,15 +183,23 @@ def classification_info | |
| end | ||
|
|
||
| def doc_auth_result_from_success | ||
|
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 wonder if we still need this method? It seems possible that we could refactor this away if we aren't using the |
||
| if success? | ||
| if doc_auth_success? | ||
| DocAuth::LexisNexis::ResultCodes::PASSED.name | ||
| else | ||
| DocAuth::LexisNexis::ResultCodes::CAUTION.name | ||
| end | ||
| end | ||
|
|
||
| def all_doc_capture_values_passing?(doc_auth_result, id_type_supported) | ||
| doc_auth_result == 'Passed' && | ||
| def transaction_status_from_success | ||
|
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. this name is confusing to me - I'm not sure I understand the
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. continuing the pattern used in |
||
| if doc_auth_success? | ||
night-jellyfish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'passed' | ||
| else | ||
| 'failed' | ||
| end | ||
| end | ||
|
|
||
| def all_doc_capture_values_passing?(transaction_status, id_type_supported) | ||
| transaction_status == 'passed' && | ||
| id_type_supported && | ||
| (selfie_check_performed? ? selfie_passed? : true) | ||
| end | ||
|
|
@@ -194,7 +219,6 @@ def parse_uri | |
| # no-op, allows falling through to YAML parsing | ||
| end | ||
|
|
||
| ATTENTION_WITH_BARCODE_ALERT = { 'name' => '2D Barcode Read', 'result' => 'Attention' }.freeze | ||
| DEFAULT_FAILED_ALERTS = [{ name: '2D Barcode Read', result: 'Failed' }].freeze | ||
| DEFAULT_IMAGE_METRICS = { | ||
| front: { | ||
|
|
@@ -212,6 +236,7 @@ def parse_uri | |
| }.freeze | ||
|
|
||
| def create_response_info( | ||
| transaction_status: 'failed', | ||
| doc_auth_result: 'Failed', | ||
| passed: [], | ||
| failed: DEFAULT_FAILED_ALERTS, | ||
|
|
@@ -222,6 +247,7 @@ def create_response_info( | |
| merged_image_metrics = DEFAULT_IMAGE_METRICS.deep_merge(image_metrics) | ||
| { | ||
| vendor: 'Mock', | ||
| transaction_status: transaction_status, | ||
| doc_auth_result: doc_auth_result, | ||
| processed_alerts: { | ||
| passed: passed, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: failed | ||
| portrait_match_results: | ||
| FaceMatchResult: Fail | ||
| FaceErrorMessage: 'Liveness: NotLive' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| portrait_match_results: | ||
| # returns the portrait match result | ||
| FaceMatchResult: Fail | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| document: | ||
| address1: 1800 F Street | ||
| address2: Apt 3 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: failed | ||
| failed_alerts: | ||
| - name: unexpected attention alert | ||
| result: Attention | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: failed | ||
| portrait_match_results: | ||
| # returns the portrait match result | ||
| FaceMatchResult: Fail | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: failed | ||
| failed_alerts: [] | ||
| portrait_match_results: | ||
| FaceMatchResult: Fail | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: failed | ||
| failed_alerts: [] | ||
| portrait_match_results: | ||
| FaceMatchResult: Pass | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| document: | ||
| first_name: Jane | ||
| last_name: Doe | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| document: | ||
| first_name: Jane | ||
| last_name: Doe | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| document: | ||
| first_name: 'John' | ||
| last_name: 'Doe' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| portrait_match_results: | ||
| # returns the portrait match result | ||
| FaceMatchResult: Fail | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| portrait_match_results: | ||
| # returns the portrait match result | ||
| FaceMatchResult: Fail | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| transaction_status: passed | ||
| document: | ||
| address1: '1 FAKE RD' | ||
| city: 'GREAT FALLS' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
| "ProductType": "TrueID", | ||
| "ExecutedStepName": "True_ID_Step", | ||
| "ProductConfigurationName": "AndreV3_TrueID_Flow", | ||
| "ProductStatus": "pass", | ||
| "ProductStatus": "fail", | ||
|
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. Can you say more about these changes (also in some of the other fixtures)? I could be mistaken but I thought these were direct responses from TrueID and this PR is to change what field we rely on from TrueID, and not that the TrueID response itself has changed.
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. @night-jellyfish - yes, you are correct ... this change is about relying on a different field (transaction_status)! 👍🏿
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. Interesting! I guess I was worrying a little that I thought our fixtures were taken directly from requests to the API (and then anonymized). So that would imply to me that maybe the values could be opposing. But maybe I'm wrong about how they were created and this isn't a concern. |
||
| "ParameterDetails": [ | ||
| { | ||
| "Group": "AUTHENTICATION_RESULT", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.