Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,8 @@ def idv_doc_auth_submitted_image_upload_form(
# @param [Boolean] attention_with_barcode Whether result was attention with barcode
# @param [Boolean] doc_type_supported
# @param [Boolean] doc_auth_success
# @param [String] liveness_checking_required Whether or not the selfie is required
# @param [Boolean] liveness_checking_required Whether or not the selfie is required
# @param [Boolean] liveness_enabled Whether or not the selfie result is included in response
# @param [String] selfie_status
# @param [String] vendor
# @param [String] conversation_id
Expand Down Expand Up @@ -1686,6 +1687,7 @@ def idv_doc_auth_submitted_image_upload_vendor(
birth_year: nil,
selfie_attempts: nil,
acuant_sdk_upgrade_ab_test_bucket: nil,
liveness_enabled: nil,
**extra
)
track_event(
Expand Down Expand Up @@ -1733,6 +1735,7 @@ def idv_doc_auth_submitted_image_upload_vendor(
issue_year:,
selfie_attempts:,
acuant_sdk_upgrade_ab_test_bucket:,
liveness_enabled:,
**extra,
)
end
Expand Down Expand Up @@ -2857,20 +2860,23 @@ def idv_in_person_proofing_state_id_submitted(
# @param [String] step
# @param [String] analytics_id
# @param [Boolean] opted_in_to_in_person_proofing User opted into in person proofing
# @param [Boolean] same_address_as_id
# State id page visited
def idv_in_person_proofing_state_id_visited(
flow_path: nil,
step: nil,
analytics_id: nil,
opted_in_to_in_person_proofing: nil,
same_address_as_id: nil,
**extra
)
track_event(
'IdV: in person proofing state_id visited',
flow_path: flow_path,
step: step,
analytics_id: analytics_id,
opted_in_to_in_person_proofing: opted_in_to_in_person_proofing,
flow_path:,
step:,
analytics_id:,
opted_in_to_in_person_proofing:,
same_address_as_id:,
**extra,
)
end
Expand Down
12 changes: 6 additions & 6 deletions app/services/doc_auth/mock/result_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def initialize(uploaded_file, config, selfie_required = false)
classification_info: classification_info,
workflow: workflow,
liveness_checking_required: @selfie_required,
}.compact,
**@response_info.to_h,
},
)
end

Expand All @@ -44,7 +45,7 @@ def errors
failed = file_data.dig('failed_alerts')&.dup
passed = file_data.dig('passed_alerts')
face_match_result = file_data.dig('portrait_match_results', 'FaceMatchResult')
classification_info = file_data.dig('classification_info')
classification_info = file_data.dig('classification_info')&.symbolize_keys
# Pass and doc type is ok
has_fields = [
doc_auth_result,
Expand All @@ -69,8 +70,8 @@ def errors
mock_args[:passed] = passed.map!(&:symbolize_keys) if passed.present?
mock_args[:liveness_enabled] = face_match_result ? true : false
mock_args[:classification_info] = classification_info if classification_info.present?
fake_response_info = create_response_info(**mock_args)
ErrorGenerator.new(config).generate_doc_auth_errors(fake_response_info)
@response_info = create_response_info(**mock_args)
ErrorGenerator.new(config).generate_doc_auth_errors(@response_info)
elsif file_data.include?(:general) # general is the key for errors from parsing
file_data
end
Expand Down Expand Up @@ -232,8 +233,7 @@ def create_response_info(
liveness_enabled: liveness_enabled,
classification_info: classification_info,
portrait_match_results: selfie_check_performed? ? portrait_match_results : nil,
extra: { liveness_checking_required: liveness_enabled },
}.compact
}
end
end
end
Expand Down
13 changes: 0 additions & 13 deletions app/services/flow/flow_state_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def update

result = flow.handle(step)

increment_step_name_counts
analytics.public_send(
flow.step_handler_instance(step).analytics_submitted_event,
**result.to_h.merge(analytics_properties),
Expand All @@ -54,7 +53,6 @@ def current_step
end

def track_step_visited
increment_step_name_counts
analytics.public_send(
flow.step_handler(current_step).analytics_visited_event,
**analytics_properties,
Expand Down Expand Up @@ -188,7 +186,6 @@ def analytics_properties
{
flow_path: flow.flow_path,
step: current_step,
step_count: current_flow_step_counts[current_step_name],
analytics_id: @analytics_id,
}.merge(flow.extra_analytics_properties).
merge(**opt_in_analytics_properties)
Expand All @@ -198,16 +195,6 @@ def current_step_name
"#{current_step}_#{action_name}"
end

def current_flow_step_counts
current_session["#{@name}_flow_step_counts"] ||= {}
current_session["#{@name}_flow_step_counts"].default = 0
current_session["#{@name}_flow_step_counts"]
end

def increment_step_name_counts
current_flow_step_counts[current_step_name] += 1
end

def next_step
flow.next_step
end
Expand Down
23 changes: 22 additions & 1 deletion spec/controllers/idv/image_uploads_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@
attention_with_barcode: false,
async: false,
billed: true,
doc_auth_result: 'Caution',
doc_auth_result: 'Failed',
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand All @@ -990,6 +990,27 @@
selfie_live: boolean,
selfie_quality_good: boolean,
workflow: an_instance_of(String),
alert_failure_count: 1,
liveness_enabled: false,
vendor: 'Mock',
processed_alerts: {
failed: [{ name: '2D Barcode Content', result: 'Attention' }],
passed: [],
},
image_metrics: {
back: {
'GlareMetric' => 100,
'HorizontalResolution' => 600,
'SharpnessMetric' => 100,
'VerticalResolution' => 600,
},
front: {
'GlareMetric' => 100,
'HorizontalResolution' => 600,
'SharpnessMetric' => 100,
'VerticalResolution' => 600,
},
},
)

expect_funnel_update_counts(user, 1)
Expand Down
4 changes: 2 additions & 2 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,10 @@
flow_path: 'standard', opted_in_to_in_person_proofing: false
},
'IdV: in person proofing state_id visited' => {
step: 'state_id', flow_path: 'standard', step_count: 1, analytics_id: 'In Person Proofing'
step: 'state_id', flow_path: 'standard', analytics_id: 'In Person Proofing'
},
'IdV: in person proofing state_id submitted' => {
success: true, flow_path: 'standard', step: 'state_id', step_count: 1, analytics_id: 'In Person Proofing', errors: {}, same_address_as_id: false, birth_year: '1938', document_zip_code: '12345'
success: true, flow_path: 'standard', step: 'state_id', analytics_id: 'In Person Proofing', errors: {}, same_address_as_id: false, birth_year: '1938', document_zip_code: '12345'
},
'IdV: in person proofing address visited' => {
step: 'address', flow_path: 'standard', analytics_id: 'In Person Proofing', same_address_as_id: false
Expand Down
2 changes: 1 addition & 1 deletion spec/features/idv/in_person_threatmetrix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'action_account'
require 'axe-rspec'

RSpec.describe 'In Person Proofing Threatmetrix', js: true, allowed_extra_analytics: [:*] do
RSpec.describe 'In Person Proofing Threatmetrix', js: true do
include InPersonHelper

let(:sp) { :oidc }
Expand Down
4 changes: 1 addition & 3 deletions spec/features/idv/steps/in_person/address_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'rails_helper'

RSpec.describe 'doc auth In person proofing residential address step',
js: true,
allowed_extra_analytics: [:*] do
RSpec.describe 'doc auth In person proofing residential address step', :js do
include IdvStepHelper
include InPersonHelper

Expand Down
2 changes: 1 addition & 1 deletion spec/features/idv/steps/in_person/state_id_step_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe 'doc auth IPP state ID step', js: true, allowed_extra_analytics: [:*] do
RSpec.describe 'doc auth IPP state ID step', js: true do
include IdvStepHelper
include InPersonHelper

Expand Down
6 changes: 3 additions & 3 deletions spec/services/doc_auth/mock/doc_auth_mock_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
)

expect(response.selfie_check_performed?).to be(true)
expect(response.extra).to have_key(:portrait_match_results)
expect(response.extra[:portrait_match_results]).to be_present
end

it 'returns selfie status with default setting' do
Expand All @@ -271,7 +271,7 @@

expect(response.selfie_check_performed?).to be(true)
expect(response.selfie_status).to eq(:success)
expect(response.extra).to_not have_key(:portrait_match_results)
expect(response.extra[:portrait_match_results]).to be_nil
end
end

Expand All @@ -291,7 +291,7 @@
)

expect(response.selfie_check_performed?).to be(false)
expect(response.extra).not_to have_key(:portrait_match_results)
expect(response.extra[:portrait_match_results]).to be_nil
end
end
end
Expand Down
54 changes: 50 additions & 4 deletions spec/services/doc_auth/mock/result_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
classification_info: {},
workflow: 'test_non_liveness_workflow',
liveness_checking_required: false,
portrait_match_results: nil,
)
expect(response.doc_auth_success?).to eq(true)
expect(response.selfie_status).to eq(:not_processed)
Expand Down Expand Up @@ -392,11 +393,33 @@
expect(response.pii_from_doc).to eq(nil)
expect(response.attention_with_barcode?).to eq(false)
expect(response.extra).to eq(
doc_auth_result: DocAuth::LexisNexis::ResultCodes::CAUTION.name,
doc_auth_result: DocAuth::LexisNexis::ResultCodes::FAILED.name,
billed: true,
classification_info: {},
classification_info: nil,
liveness_checking_required: false,
workflow: 'test_non_liveness_workflow',
portrait_match_results: nil,
alert_failure_count: 1,
liveness_enabled: false,
vendor: 'Mock',
processed_alerts: {
failed: [{ name: '2D Barcode Read', result: 'Failed' }],
passed: [],
},
image_metrics: {
back: {
'GlareMetric' => 100,
'HorizontalResolution' => 100,
'SharpnessMetric' => 100,
'VerticalResolution' => 600,
},
front: {
'GlareMetric' => 100,
'HorizontalResolution' => 600,
'SharpnessMetric' => 100,
'VerticalResolution' => 600,
},
},
)
end
end
Expand All @@ -421,9 +444,31 @@
expect(response.extra).to eq(
doc_auth_result: DocAuth::LexisNexis::ResultCodes::FAILED.name,
billed: true,
classification_info: {},
classification_info: nil,
liveness_checking_required: false,
workflow: 'test_non_liveness_workflow',
portrait_match_results: nil,
alert_failure_count: 1,
liveness_enabled: false,
vendor: 'Mock',
processed_alerts: {
failed: [{ name: '2D Barcode Read', result: 'Failed' }],
passed: [],
},
image_metrics: {
back: {
'GlareMetric' => 100,
'HorizontalResolution' => 600,
'SharpnessMetric' => 100,
'VerticalResolution' => 600,
},
front: {
'GlareMetric' => 100,
'HorizontalResolution' => 600,
'SharpnessMetric' => 100,
'VerticalResolution' => 600,
},
},
)
end
end
Expand Down Expand Up @@ -480,6 +525,7 @@
classification_info: {},
liveness_checking_required: false,
workflow: 'test_non_liveness_workflow',
portrait_match_results: nil,
)
end
end
Expand Down Expand Up @@ -788,7 +834,7 @@

it 'returns the expected values' do
expect(response.selfie_check_performed?).to eq(false)
expect(response.extra).not_to have_key(:portrait_match_results)
expect(response.extra[:portrait_match_results]).to be_nil
expect(response.doc_auth_success?).to eq(true)
expect(response.selfie_status).to eq(:not_processed)
expect(response.extra[:liveness_checking_required]).to eq(false)
Expand Down