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
6 changes: 3 additions & 3 deletions app/javascript/packs/document-capture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface AppRootData {
maxCaptureAttemptsBeforeTips: string;
maxAttemptsBeforeNativeCamera: string;
acuantSdkUpgradeABTestingEnabled: string;
useNewerSdk: string;
useAlternateSdk: string;
acuantVersion: string;
flowPath: FlowPath;
cancelUrl: string;
Expand Down Expand Up @@ -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,
});
};
Expand Down
12 changes: 9 additions & 3 deletions app/services/idv/steps/document_capture_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could simplify this by changing the logic of the bucket initialization to default to 100% if testing is disabled?

use_newer_sdk: IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_enabled ?
IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_percent :
0,

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: We don't need to break this onto a separate line anymore.

use_alternate_sdk: use_alternate_sdk,
acuant_version: acuant_version,
}
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/capture_doc/document_capture.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) %>
2 changes: 1 addition & 1 deletion app/views/idv/doc_auth/document_capture.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) %>
2 changes: 1 addition & 1 deletion app/views/idv/shared/_document_capture.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/ab_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
2 changes: 2 additions & 0 deletions lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -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' },
Expand Down
40 changes: 35 additions & 5 deletions spec/services/idv/steps/document_capture_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }

Expand All @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/views/idv/shared/_document_capture.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down