diff --git a/app/javascript/packs/document-capture.tsx b/app/javascript/packs/document-capture.tsx index c8f36c47f18..5cfa0d640c3 100644 --- a/app/javascript/packs/document-capture.tsx +++ b/app/javascript/packs/document-capture.tsx @@ -26,7 +26,7 @@ interface AppRootData { maxCaptureAttemptsBeforeTips: string; maxAttemptsBeforeNativeCamera: string; acuantSdkUpgradeABTestingEnabled: string; - useNewerSdk: string; + useAlternateSdk: string; acuantVersion: string; flowPath: FlowPath; cancelUrl: string; @@ -65,13 +65,13 @@ function getMetaContent(name): string | null { const device: DeviceContextValue = { isMobile: isCameraCapableMobile() }; const trackEvent: typeof baseTrackEvent = (event, payload) => { - const { flowPath, acuantSdkUpgradeABTestingEnabled, useNewerSdk, acuantVersion } = + const { flowPath, acuantSdkUpgradeABTestingEnabled, useAlternateSdk, acuantVersion } = appRoot.dataset; return baseTrackEvent(event, { ...payload, flow_path: flowPath, acuant_sdk_upgrade_a_b_testing_enabled: acuantSdkUpgradeABTestingEnabled, - use_newer_sdk: useNewerSdk, + use_alternate_sdk: useAlternateSdk, acuant_version: acuantVersion, }); }; diff --git a/app/services/idv/steps/document_capture_step.rb b/app/services/idv/steps/document_capture_step.rb index fb18b941ff4..7cd0cb343a2 100644 --- a/app/services/idv/steps/document_capture_step.rb +++ b/app/services/idv/steps/document_capture_step.rb @@ -43,11 +43,17 @@ def native_camera_ab_testing_variables def acuant_sdk_upgrade_a_b_testing_variables bucket = AbTests::ACUANT_SDK.bucket(flow_session[:document_capture_session_uuid]) - acuant_version = (bucket == :use_newer_sdk) ? '11.7.1' : '11.7.0' + testing_enabled = IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_enabled + use_alternate_sdk = (bucket == :use_alternate_sdk) + if use_alternate_sdk + acuant_version = IdentityConfig.store.idv_acuant_sdk_version_alternate + else + acuant_version = IdentityConfig.store.idv_acuant_sdk_version_default + end { acuant_sdk_upgrade_a_b_testing_enabled: - IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_enabled, - use_newer_sdk: (bucket == :use_newer_sdk), + testing_enabled, + use_alternate_sdk: use_alternate_sdk, acuant_version: acuant_version, } end diff --git a/app/views/idv/capture_doc/document_capture.html.erb b/app/views/idv/capture_doc/document_capture.html.erb index 96e13ed4fe0..558e540c1c3 100644 --- a/app/views/idv/capture_doc/document_capture.html.erb +++ b/app/views/idv/capture_doc/document_capture.html.erb @@ -7,6 +7,6 @@ front_image_upload_url: front_image_upload_url, back_image_upload_url: back_image_upload_url, acuant_sdk_upgrade_a_b_testing_enabled: acuant_sdk_upgrade_a_b_testing_enabled, - use_newer_sdk: use_newer_sdk, + use_alternate_sdk: use_alternate_sdk, acuant_version: acuant_version, ) %> diff --git a/app/views/idv/doc_auth/document_capture.html.erb b/app/views/idv/doc_auth/document_capture.html.erb index b025a507948..83de02e8367 100644 --- a/app/views/idv/doc_auth/document_capture.html.erb +++ b/app/views/idv/doc_auth/document_capture.html.erb @@ -7,6 +7,6 @@ front_image_upload_url: front_image_upload_url, back_image_upload_url: back_image_upload_url, acuant_sdk_upgrade_a_b_testing_enabled: acuant_sdk_upgrade_a_b_testing_enabled, - use_newer_sdk: use_newer_sdk, + use_alternate_sdk: use_alternate_sdk, acuant_version: acuant_version, ) %> diff --git a/app/views/idv/shared/_document_capture.html.erb b/app/views/idv/shared/_document_capture.html.erb index 7aa34d2c11b..deca885ec3f 100644 --- a/app/views/idv/shared/_document_capture.html.erb +++ b/app/views/idv/shared/_document_capture.html.erb @@ -32,7 +32,7 @@ max_capture_attempts_before_native_camera: IdentityConfig.store.doc_auth_max_capture_attempts_before_native_camera, max_submission_attempts_before_native_camera: IdentityConfig.store.doc_auth_max_submission_attempts_before_native_camera, acuant_sdk_upgrade_a_b_testing_enabled: acuant_sdk_upgrade_a_b_testing_enabled, - use_newer_sdk: use_newer_sdk, + use_alternate_sdk: use_alternate_sdk, acuant_version: acuant_version, sp_name: sp_name, flow_path: flow_path, diff --git a/config/application.yml.default b/config/application.yml.default index 3ec13f201ca..9699a255fbf 100644 --- a/config/application.yml.default +++ b/config/application.yml.default @@ -114,6 +114,8 @@ idv_attempt_window_in_hours: 6 idv_contact_url: https://www.example.com idv_max_attempts: 5 idv_min_age_years: 13 +idv_acuant_sdk_version_default: '11.7.1' +idv_acuant_sdk_version_alternate: '11.7.0' idv_acuant_sdk_upgrade_a_b_testing_enabled: false idv_acuant_sdk_upgrade_a_b_testing_percent: 50 idv_send_link_attempt_window_in_minutes: 10 diff --git a/config/initializers/ab_tests.rb b/config/initializers/ab_tests.rb index d8388e9a3b6..4df55b07756 100644 --- a/config/initializers/ab_tests.rb +++ b/config/initializers/ab_tests.rb @@ -13,7 +13,7 @@ module AbTests ACUANT_SDK = AbTestBucket.new( experiment_name: 'Acuant SDK Upgrade', buckets: { - use_newer_sdk: IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_enabled ? + use_alternate_sdk: IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_enabled ? IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_percent : 0, }, diff --git a/lib/identity_config.rb b/lib/identity_config.rb index 1a62c38af3c..a00fcca1f70 100644 --- a/lib/identity_config.rb +++ b/lib/identity_config.rb @@ -193,6 +193,8 @@ def self.build_store(config_map) config.add(:idv_contact_url, type: :string) config.add(:idv_max_attempts, type: :integer) config.add(:idv_min_age_years, type: :integer) + config.add(:idv_acuant_sdk_version_default, type: :string) + config.add(:idv_acuant_sdk_version_alternate, type: :string) config.add(:idv_acuant_sdk_upgrade_a_b_testing_enabled, type: :boolean) config.add(:idv_acuant_sdk_upgrade_a_b_testing_percent, type: :integer) config.add(:idv_send_link_attempt_window_in_minutes, type: :integer) diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 061aa65c1a8..54ecaa525ce 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -17,8 +17,8 @@ 'IdV: doc auth upload visited' => { flow_path: 'standard', step: 'upload', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth upload submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'upload', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_newer_sdk' => anything, 'acuant_version' => anything }, - 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_newer_sdk' => anything, 'acuant_version' => anything }, + 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, + 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard' }, 'IdV: doc auth image upload vendor pii validation' => { success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false }, 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, @@ -53,8 +53,8 @@ 'IdV: doc auth upload visited' => { flow_path: 'standard', step: 'upload', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth upload submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'upload', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_newer_sdk' => anything, 'acuant_version' => anything }, - 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_newer_sdk' => anything, 'acuant_version' => anything }, + 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, + 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard' }, 'IdV: doc auth image upload vendor pii validation' => { success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false }, 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, @@ -85,8 +85,8 @@ 'IdV: doc auth upload visited' => { flow_path: 'standard', step: 'upload', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth upload submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'upload', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', step_count: 1, acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_newer_sdk' => anything, 'acuant_version' => anything }, - 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_newer_sdk' => anything, 'acuant_version' => anything }, + 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, + 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard' }, 'IdV: doc auth image upload vendor submitted' => hash_including(success: true, flow_path: 'standard', attention_with_barcode: true, doc_auth_result: 'Attention'), 'IdV: verify in person troubleshooting option clicked' => { flow_path: 'standard' }, diff --git a/spec/services/idv/steps/document_capture_step_spec.rb b/spec/services/idv/steps/document_capture_step_spec.rb index 34fd1816c1c..574d372998a 100644 --- a/spec/services/idv/steps/document_capture_step_spec.rb +++ b/spec/services/idv/steps/document_capture_step_spec.rb @@ -40,6 +40,9 @@ end end + let(:default_sdk_version) { IdentityConfig.store.idv_acuant_sdk_version_default } + let(:alternate_sdk_version) { IdentityConfig.store.idv_acuant_sdk_version_alternate } + subject(:step) do Idv::Steps::DocumentCaptureStep.new(flow) end @@ -54,6 +57,33 @@ end describe '#extra_view_variables' do + context 'with acuant sdk upgrade A/B testing disabled' do + let(:session_uuid) { SecureRandom.uuid } + + before do + allow(IdentityConfig.store). + to receive(:idv_acuant_sdk_upgrade_a_b_testing_enabled). + and_return(false) + + flow.flow_session[:document_capture_session_uuid] = session_uuid + end + + context 'and A/B test specifies the older acuant version' do + before do + stub_const( + 'AbTests::ACUANT_SDK', + FakeAbTestBucket.new.tap { |ab| ab.assign(session_uuid => 0) }, + ) + end + + it 'passes correct variables and acuant version when older is specified' do + expect(subject.extra_view_variables[:acuant_sdk_upgrade_a_b_testing_enabled]).to eq(false) + expect(subject.extra_view_variables[:use_alternate_sdk]).to eq(false) + expect(subject.extra_view_variables[:acuant_version]).to eq(default_sdk_version) + end + end + end + context 'with acuant sdk upgrade A/B testing enabled' do let(:session_uuid) { SecureRandom.uuid } @@ -69,14 +99,14 @@ before do stub_const( 'AbTests::ACUANT_SDK', - FakeAbTestBucket.new.tap { |ab| ab.assign(session_uuid => :use_newer_sdk) }, + FakeAbTestBucket.new.tap { |ab| ab.assign(session_uuid => :use_alternate_sdk) }, ) end it 'passes correct variables and acuant version when newer is specified' do expect(subject.extra_view_variables[:acuant_sdk_upgrade_a_b_testing_enabled]).to eq(true) - expect(subject.extra_view_variables[:use_newer_sdk]).to eq(true) - expect(subject.extra_view_variables[:acuant_version]).to eq('11.7.1') + expect(subject.extra_view_variables[:use_alternate_sdk]).to eq(true) + expect(subject.extra_view_variables[:acuant_version]).to eq(alternate_sdk_version) end end @@ -90,8 +120,8 @@ it 'passes correct variables and acuant version when older is specified' do expect(subject.extra_view_variables[:acuant_sdk_upgrade_a_b_testing_enabled]).to eq(true) - expect(subject.extra_view_variables[:use_newer_sdk]).to eq(false) - expect(subject.extra_view_variables[:acuant_version]).to eq('11.7.0') + expect(subject.extra_view_variables[:use_alternate_sdk]).to eq(false) + expect(subject.extra_view_variables[:acuant_version]).to eq(default_sdk_version) end end end diff --git a/spec/views/idv/shared/_document_capture.html.erb_spec.rb b/spec/views/idv/shared/_document_capture.html.erb_spec.rb index d7653696839..a4563c01318 100644 --- a/spec/views/idv/shared/_document_capture.html.erb_spec.rb +++ b/spec/views/idv/shared/_document_capture.html.erb_spec.rb @@ -14,7 +14,7 @@ let(:front_image_upload_url) { nil } let(:back_image_upload_url) { nil } let(:acuant_sdk_upgrade_a_b_testing_enabled) { false } - let(:use_newer_sdk) { false } + let(:use_alternate_sdk) { false } let(:acuant_version) { '11.7.1' } before do @@ -48,7 +48,7 @@ front_image_upload_url: front_image_upload_url, back_image_upload_url: back_image_upload_url, acuant_sdk_upgrade_a_b_testing_enabled: acuant_sdk_upgrade_a_b_testing_enabled, - use_newer_sdk: use_newer_sdk, + use_alternate_sdk: use_alternate_sdk, acuant_version: acuant_version, } end