diff --git a/app/controllers/concerns/idv/verify_info_concern.rb b/app/controllers/concerns/idv/verify_info_concern.rb index a128dd69b14..f70a36af513 100644 --- a/app/controllers/concerns/idv/verify_info_concern.rb +++ b/app/controllers/concerns/idv/verify_info_concern.rb @@ -197,6 +197,7 @@ def async_state_done(current_async_state) [:errors, :ssn], [:errors, :state_id_jurisdiction], [:proofing_results, :context, :stages, :resolution, :errors, :ssn], + [:proofing_results, :context, :stages, :resolution, :reason_codes], [:proofing_results, :context, :stages, :residential_address, :errors, :ssn], [:proofing_results, :context, :stages, :threatmetrix, :response_body, :first_name], [:proofing_results, :context, :stages, :state_id, :state_id_jurisdiction], diff --git a/app/services/proofing/resolution/result.rb b/app/services/proofing/resolution/result.rb index df937baa3de..e345ea766f5 100644 --- a/app/services/proofing/resolution/result.rb +++ b/app/services/proofing/resolution/result.rb @@ -13,6 +13,7 @@ class Result :failed_result_can_pass_with_additional_verification, :attributes_requiring_additional_verification, :reference, + :reason_codes, :vendor_workflow def initialize( success: nil, @@ -22,6 +23,7 @@ def initialize( transaction_id: '', customer_user_id: '', reference: '', + reason_codes: {}, failed_result_can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_workflow: nil, @@ -34,6 +36,7 @@ def initialize( @transaction_id = transaction_id @customer_user_id = customer_user_id @reference = reference + @reason_codes = reason_codes @failed_result_can_pass_with_additional_verification = failed_result_can_pass_with_additional_verification @attributes_requiring_additional_verification = @@ -60,6 +63,7 @@ def to_h timed_out: timed_out?, transaction_id: transaction_id, reference: reference, + reason_codes: reason_codes, can_pass_with_additional_verification: failed_result_can_pass_with_additional_verification, attributes_requiring_additional_verification: diff --git a/app/services/proofing/socure/id_plus/proofer.rb b/app/services/proofing/socure/id_plus/proofer.rb index 2d85337928f..27742f1db8a 100644 --- a/app/services/proofing/socure/id_plus/proofer.rb +++ b/app/services/proofing/socure/id_plus/proofer.rb @@ -68,12 +68,12 @@ def build_result_from_error(err) def build_result_from_response(response) Proofing::Resolution::Result.new( success: all_required_attributes_verified?(response), - errors: reason_codes_as_errors(response), exception: nil, vendor_name: VENDOR_NAME, verified_attributes: verified_attributes(response), transaction_id: response.reference_id, customer_user_id: response.customer_user_id, + reason_codes: reason_codes_as_errors(response), ) end diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 0db3d55f614..e4a220f134c 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -87,6 +87,7 @@ timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', + reason_codes: {}, can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', @@ -112,6 +113,7 @@ errors: {}, exception: nil, reference: '', + reason_codes: {}, success: true, timed_out: false, transaction_id: '', @@ -125,6 +127,7 @@ errors: {}, exception: nil, reference: '', + reason_codes: {}, success: false, timed_out: false, transaction_id: '', @@ -165,6 +168,7 @@ residential_address: { errors: {}, exception: nil, reference: 'aaa-bbb-ccc', + reason_codes: {}, success: true, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', @@ -180,6 +184,7 @@ errors: {}, exception: nil, reference: '', + reason_codes: {}, success: false, timed_out: false, transaction_id: '', diff --git a/spec/jobs/socure_shadow_mode_proofing_job_spec.rb b/spec/jobs/socure_shadow_mode_proofing_job_spec.rb index aa5970102e3..daa56c87287 100644 --- a/spec/jobs/socure_shadow_mode_proofing_job_spec.rb +++ b/spec/jobs/socure_shadow_mode_proofing_job_spec.rb @@ -269,7 +269,8 @@ socure_result: { attributes_requiring_additional_verification: [], can_pass_with_additional_verification: false, - errors: { + errors: {}, + reason_codes: { 'I123' => 'Person is over seven feet tall.', 'R890' => 'Help! I am trapped in a reason code factory!', }, @@ -403,8 +404,8 @@ expect(analytics).to have_logged_event( :idv_socure_shadow_mode_proofing_result, satisfy do |attributes| - errors = attributes.dig(:socure_result, :errors) - expect(errors).to include( + reason_codes = attributes.dig(:socure_result, :reason_codes) + expect(reason_codes).to include( 'I000' => '[unknown]', ) end, diff --git a/spec/services/proofing/mock/resolution_mock_client_spec.rb b/spec/services/proofing/mock/resolution_mock_client_spec.rb index 4214551886a..a11fcb583ee 100644 --- a/spec/services/proofing/mock/resolution_mock_client_spec.rb +++ b/spec/services/proofing/mock/resolution_mock_client_spec.rb @@ -23,6 +23,7 @@ exception: nil, timed_out: false, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, @@ -47,6 +48,7 @@ exception: nil, timed_out: false, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, @@ -71,6 +73,7 @@ exception: nil, timed_out: false, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, @@ -95,6 +98,7 @@ exception: nil, timed_out: false, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, @@ -119,6 +123,7 @@ exception: RuntimeError.new('Failed to contact proofing vendor'), timed_out: false, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, @@ -143,6 +148,7 @@ exception: RuntimeError.new('Failed to contact proofing vendor'), timed_out: false, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, @@ -167,6 +173,7 @@ exception: Proofing::TimeoutError.new('resolution mock timeout'), timed_out: true, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, @@ -193,6 +200,7 @@ ), timed_out: false, reference: reference, + reason_codes: {}, transaction_id: transaction_id, vendor_name: 'ResolutionMock', can_pass_with_additional_verification: false, diff --git a/spec/services/proofing/socure/id_plus/proofer_spec.rb b/spec/services/proofing/socure/id_plus/proofer_spec.rb index 469610514be..ee06b37742b 100644 --- a/spec/services/proofing/socure/id_plus/proofer_spec.rb +++ b/spec/services/proofing/socure/id_plus/proofer_spec.rb @@ -71,7 +71,7 @@ end it 'reports reason codes as errors' do - expect(result.errors).to eql( + expect(result.reason_codes).to eql( { 'I905' => '[unknown]', 'I914' => '[unknown]',