-
Notifications
You must be signed in to change notification settings - Fork 166
LG-14525: threatmetrix api account creation #11340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 60 commits
0672b43
ca28316
4567c2a
515d5e2
f14704d
74ad2e0
fa122ec
3fd3fcc
5c3e765
4298a2d
56fcfe4
faa2df7
9ba837d
c9ba668
8eb441f
1a96823
6792efe
1a79185
eab8541
ef1fab8
ee351e8
e7fd870
e009030
7171cc0
8694d68
0ddeaf1
5f27b67
a259be7
68bd93d
eca8a7e
580ad9e
759b82c
47c2f72
8bb0689
3548aab
1950862
d76d8a7
3e9da1e
edaa3fe
535783a
9f66152
070ab76
2c679e1
9661889
fc1853a
c1a98f3
e804b81
20e1048
e81dee6
6fad48f
a1fa9a8
a284d11
0c7fb63
d9a9cf1
efb17ed
28f1cd4
c3a8e27
0a1fa28
22ee347
92fc50f
4b090f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class AccountCreationThreatMetrixJob < ApplicationJob | ||
| def perform( | ||
| user_id: nil, | ||
| threatmetrix_session_id: nil, | ||
| request_ip: nil, | ||
| email: nil | ||
| ) | ||
|
|
||
| device_profiling_result = AccountCreation::DeviceProfiling.new.proof( | ||
| request_ip: request_ip, | ||
| threatmetrix_session_id: threatmetrix_session_id, | ||
| user_email: email, | ||
| ) | ||
| ensure | ||
| user = User.find_by(id: user_id) | ||
| analytics(user).account_creation_tmx_result(**device_profiling_result.to_h) | ||
| end | ||
|
|
||
| def analytics(user) | ||
| Analytics.new(user: user, request: nil, session: {}, sp: nil) | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module AccountCreation | ||
| class DeviceProfiling | ||
| attr_reader :request_ip, | ||
| :threatmetrix_session_id, | ||
| :user_email, | ||
| :device_profile_result | ||
| def proof( | ||
| request_ip:, | ||
| threatmetrix_session_id:, | ||
| user_email: | ||
| ) | ||
| @request_ip = request_ip | ||
| @threatmetrix_session_id = threatmetrix_session_id | ||
| @user_email = user_email | ||
|
|
||
| @device_profile_result = device_profile | ||
| end | ||
|
|
||
| def device_profile | ||
| return threatmetrix_disabled_result unless | ||
| FeatureManagement.account_creation_device_profiling_collecting_enabled? | ||
| return threatmetrix_id_missing_result if threatmetrix_session_id.blank? | ||
|
|
||
| proofer.proof( | ||
| threatmetrix_session_id: threatmetrix_session_id, | ||
| email: user_email, | ||
| request_ip: request_ip, | ||
| ) | ||
| end | ||
|
|
||
| def threatmetrix_disabled_result | ||
| Proofing::DdpResult.new( | ||
| success: true, | ||
| client: 'tmx_disabled', | ||
| review_status: 'pass', | ||
| ) | ||
| end | ||
|
|
||
| def threatmetrix_id_missing_result | ||
| Proofing::DdpResult.new( | ||
| success: false, | ||
| client: 'tmx_session_id_missing', | ||
| review_status: 'reject', | ||
| ) | ||
| end | ||
|
|
||
| def proofer | ||
| @proofer ||= | ||
| if IdentityConfig.store.lexisnexis_threatmetrix_mock_enabled | ||
| Proofing::Mock::DdpMockClient.new | ||
| else | ||
| Proofing::LexisNexis::Ddp::Proofer.new( | ||
| api_key: IdentityConfig.store.lexisnexis_threatmetrix_api_key, | ||
| org_id: IdentityConfig.store.lexisnexis_threatmetrix_org_id, | ||
| base_url: IdentityConfig.store.lexisnexis_threatmetrix_base_url, | ||
| ddp_policy: IdentityConfig.store.lexisnexis_threatmetrix_authentication_policy, | ||
| ) | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this revised direction a lot better 👍 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,6 +192,8 @@ invalid_gpo_confirmation_zipcode: '00001' | |
| # LexisNexis ##################################################### | ||
| # Instant Verify and Phone Finder Integrations | ||
| lexisnexis_account_id: test_account | ||
| ################################################################### | ||
| # LexisNexis DDP/ThreatMetrix ##################################### | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see why we moved since this file is alphabetized, but now the groupings are a little weird because e.g. I'd suggest either:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we've renamed the configuration, can you move the comment block back to where it was? |
||
| lexisnexis_base_url: https://www.example.com | ||
| lexisnexis_hmac_auth_enabled: false | ||
| lexisnexis_hmac_key_id: pf_iv_hmac_key_id | ||
|
|
@@ -202,9 +204,8 @@ lexisnexis_password: test_password | |
| lexisnexis_phone_finder_timeout: 1.0 | ||
| lexisnexis_phone_finder_workflow: customers.gsa2.phonefinder.workflow | ||
| lexisnexis_request_mode: testing | ||
| ################################################################### | ||
| # LexisNexis DDP/ThreatMetrix ##################################### | ||
| lexisnexis_threatmetrix_api_key: | ||
| lexisnexis_threatmetrix_authentication_policy: '1234' | ||
| lexisnexis_threatmetrix_base_url: | ||
| lexisnexis_threatmetrix_js_signing_cert: '' | ||
| lexisnexis_threatmetrix_mock_enabled: true | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.