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
2 changes: 2 additions & 0 deletions app/forms/idv/api_image_upload_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,15 @@ def update_analytics(client_response:, vendor_request_time_in_ms:)
add_costs(client_response)
update_funnel(client_response)
birth_year = client_response.pii_from_doc&.dob&.to_date&.year
zip_code = client_response.pii_from_doc&.zipcode&.to_s&.strip&.slice(0, 5)
analytics.idv_doc_auth_submitted_image_upload_vendor(
**client_response.to_h.merge(
birth_year: birth_year,
client_image_metrics: image_metadata,
async: false,
flow_path: params[:flow_path],
vendor_request_time_in_ms: vendor_request_time_in_ms,
zip_code: zip_code,
).except(:classification_info).
merge(acuant_sdk_upgrade_ab_test_data),
)
Expand Down
3 changes: 3 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,7 @@ def idv_doc_auth_submitted_image_upload_form(
# @param [Hash] portrait_match_results
# @param [Hash] image_metrics
# @param [Boolean] address_line2_present
# @param [String] zip_code
Copy link
Contributor

@zachmargolis zachmargolis May 24, 2024

Choose a reason for hiding this comment

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

looks like we have both zip_code and zipcode in our codebase 😭 but zipcode is more common:

identity-idp:main> git grep zip_code -- 'app' | wc -l
      28
identity-idp:main> git grep zipcode -- 'app' | wc -l 
     119
Suggested change
# @param [String] zip_code
# @param [String] zipcode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

snakecasing words seems to be consistent in our analytics .... are you suggesting making the argument zipcode and then in the body:

zip_code: zipcode,

Copy link
Contributor

Choose a reason for hiding this comment

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

no I was suggesting zipcode (no underscore) everywhere in the PR

# @option extra [String] 'DocumentName'
# @option extra [String] 'DocAuthResult'
# @option extra [String] 'DocIssuerCode'
Expand Down Expand Up @@ -1177,6 +1178,7 @@ def idv_doc_auth_submitted_image_upload_vendor(
portrait_match_results: nil,
image_metrics: nil,
address_line2_present: nil,
zip_code: nil,
**extra
)
track_event(
Expand Down Expand Up @@ -1215,6 +1217,7 @@ def idv_doc_auth_submitted_image_upload_vendor(
image_metrics:,
address_line2_present:,
liveness_checking_required:,
zip_code:,
**extra,
)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/idp/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module Vendors
state_id_jurisdiction: MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
state_id_number: '1111111111111',
state_id_type: 'drivers_license',
zipcode: '59010',
zipcode: '59010-1234',
issuing_country_code: 'US',
}.freeze

Expand All @@ -116,7 +116,7 @@ module Vendors
identity_doc_address1: '123 Way St',
identity_doc_address2: '2nd Address Line',
identity_doc_city: 'Best City',
identity_doc_zipcode: '12345',
identity_doc_zipcode: '12345-4321',
state_id_jurisdiction: 'Virginia',
identity_doc_address_state: 'VA',
state_id_number: '1111111111111',
Expand All @@ -133,7 +133,7 @@ module Vendors
identity_doc_address1: '123 Way St',
identity_doc_address2: '2nd Address Line',
identity_doc_city: 'Best City',
identity_doc_zipcode: '12345',
identity_doc_zipcode: '12345-4321',
identity_doc_address_state: 'VA',
same_address_as_id: 'false',
).freeze
Expand Down
7 changes: 7 additions & 0 deletions spec/controllers/idv/image_uploads_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@
vendor: nil,
workflow: an_instance_of(String),
birth_year: 1938,
zip_code: '59010',
)

expect(@analytics).to have_logged_event(
Expand Down Expand Up @@ -647,6 +648,7 @@
transaction_status: nil,
vendor: nil,
birth_year: 1938,
zip_code: '12345',
)

expect(@analytics).to have_logged_event(
Expand Down Expand Up @@ -760,6 +762,7 @@
transaction_status: nil,
vendor: nil,
birth_year: 1938,
zip_code: '12345',
)

expect(@analytics).to have_logged_event(
Expand Down Expand Up @@ -873,6 +876,7 @@
transaction_status: nil,
vendor: nil,
birth_year: 1938,
zip_code: '12345',
)

expect(@analytics).to have_logged_event(
Expand Down Expand Up @@ -983,6 +987,7 @@
transaction_status: nil,
vendor: nil,
birth_year: nil,
zip_code: '12345',
)

expect(@analytics).to have_logged_event(
Expand Down Expand Up @@ -1102,6 +1107,7 @@
transaction_status: nil,
vendor: nil,
birth_year: nil,
zip_code: nil,
)

expect_funnel_update_counts(user, 1)
Expand Down Expand Up @@ -1194,6 +1200,7 @@
vendor: nil,
workflow: an_instance_of(String),
birth_year: nil,
zip_code: nil,
)

expect_funnel_update_counts(user, 1)
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/ial2_test_portrait_match_success.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ document:
state_id_jurisdiction: ND
state_id_number: '1111111111111'
state_id_type: 'drivers_license'
zipcode: '59010'
zipcode: '59010-1234'
doc_auth_result: Passed
failed_alerts: []
portrait_match_results:
Expand Down
2 changes: 2 additions & 0 deletions spec/forms/idv/api_image_upload_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
transaction_reason_code: nil,
workflow: 'test_non_liveness_workflow',
birth_year: 1938,
zip_code: '59010',
)
end

Expand Down Expand Up @@ -377,6 +378,7 @@
transaction_reason_code: nil,
workflow: 'test_liveness_workflow',
birth_year: 1938,
zip_code: '59010',
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/services/doc_auth/mock/doc_auth_mock_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
address2: nil,
city: 'GREAT FALLS',
state: 'MT',
zipcode: '59010',
zipcode: '59010-1234',
dob: '1938-10-06',
state_id_number: '1111111111111',
state_id_jurisdiction: 'ND',
Expand Down Expand Up @@ -131,7 +131,7 @@
address2: nil,
city: 'GREAT FALLS',
state: 'MT',
zipcode: '59010',
zipcode: '59010-1234',
dob: '1938-10-06',
state_id_number: '1111111111111',
state_id_jurisdiction: 'ND',
Expand Down
2 changes: 1 addition & 1 deletion spec/services/doc_auth/mock/result_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
address2: nil,
city: 'GREAT FALLS',
state: 'MT',
zipcode: '59010',
zipcode: '59010-1234',
dob: '1938-10-06',
state_id_number: '1111111111111',
state_id_jurisdiction: 'ND',
Expand Down
1 change: 0 additions & 1 deletion spec/support/fake_analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def track_event(event, original_attributes = {})
:first_name,
:last_name,
:address1,
:zipcode,
:dob,
:state_id_number,
).each do |key, default_pii_value|
Expand Down