From 2df1124b6cbeed2b942a8ae496f7907b366e2186 Mon Sep 17 00:00:00 2001 From: KolawoleHOseni Date: Thu, 19 Jun 2025 09:34:11 -0500 Subject: [PATCH 1/7] threat metrix --- lib/reporting/api_transaction_count_report.rb | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/reporting/api_transaction_count_report.rb b/lib/reporting/api_transaction_count_report.rb index 97ce97f5491..9520bf3f863 100644 --- a/lib/reporting/api_transaction_count_report.rb +++ b/lib/reporting/api_transaction_count_report.rb @@ -76,7 +76,8 @@ def api_transaction_count 'Socure (KYC) - Shadow', 'Socure (KYC) - Non-Shadow', 'Fraud Score and Attribute', - 'Threat Metrix', + 'Threat Metrix (IDV)', + 'Threat Metrix (Auth Only)', ], [ "#{ time_range.begin.to_date} - #{time_range.end.to_date}", @@ -87,7 +88,8 @@ def api_transaction_count socure_kyc_non_shadow_table.first, socure_kyc_shadow_table.first, fraud_score_and_attribute_table.first, - threat_metrix_table.first, + threat_metrix_idv_table.first, + threat_metrix_auth_only_table.first, ], ] end @@ -138,8 +140,14 @@ def instant_verify_table [instant_verify_table_count, result] end - def threat_metrix_table - result = fetch_results(query: threat_metrix_query) + def threat_metrix_idv_table + result = fetch_results(query: threat_metrix_idv_query) + threat_metrix_table_count = result.count + [threat_metrix_table_count, result] + end + + def threat_metrix_auth_only_table + result = fetch_results(query: threat_metrix_auth_only_query) threat_metrix_table_count = result.count [threat_metrix_table_count, result] end @@ -274,16 +282,23 @@ def instant_verify_query QUERY end - def threat_metrix_query + def threat_metrix_idv_query <<~QUERY filter name = "IdV: doc auth verify proofing results" | fields properties.user_id as uuid, @timestamp as timestamp, properties.event_properties.proofing_results.context.stages.threatmetrix.success as tmx_success - | stats max(tmx_success) as max_tmx_success by uuid - + QUERY + end + + def threat_metrix_auth_only_query + <<~QUERY + filter name = "account_creation_tmx_result" + | fields + properties.user_id as uuid, + @timestamp as timestamp, QUERY end From a9b548db02942d4418fa52728943e8ba65365bc7 Mon Sep 17 00:00:00 2001 From: KolawoleHOseni Date: Thu, 19 Jun 2025 09:36:49 -0500 Subject: [PATCH 2/7] Changelog: Bug Fixes, Internal Report, API Transaction count report bug fix From 281c7b7335f3fa8f3fb310479de26163c20c6792 Mon Sep 17 00:00:00 2001 From: KolawoleHOseni Date: Thu, 19 Jun 2025 10:10:57 -0500 Subject: [PATCH 3/7] spec file update --- .../api_transaction_count_report_spec.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/spec/lib/reporting/api_transaction_count_report_spec.rb b/spec/lib/reporting/api_transaction_count_report_spec.rb index 22c6912e55f..c9f33064d69 100644 --- a/spec/lib/reporting/api_transaction_count_report_spec.rb +++ b/spec/lib/reporting/api_transaction_count_report_spec.rb @@ -11,15 +11,6 @@ ] end - let(:expected_api_transaction_count_table) do - [ - ['Week', 'True ID', 'Instant verify', 'Phone Finder', 'Socure (DocV)', - 'Socure (KYC) - Shadow', 'Socure (KYC) - Non-Shadow', - 'Fraud Score and Attribute', 'Threat Metrix'], - ["#{time_range.begin.to_date} - #{time_range.end.to_date}", 10, 15, 20, 25, 30, 35, 40], - ] - end - subject(:report) { described_class.new(time_range:) } before do @@ -30,7 +21,8 @@ allow(report).to receive(:socure_kyc_non_shadow_table).and_return([30, mock_results]) allow(report).to receive(:socure_kyc_shadow_table).and_return([35, mock_results]) allow(report).to receive(:fraud_score_and_attribute_table).and_return([40, mock_results]) - allow(report).to receive(:threat_metrix_table).and_return([45, mock_results]) + allow(report).to receive(:threat_metrix_idv_table).and_return([45, mock_results]) + allow(report).to receive(:threat_metrix_auth_only_table).and_return([50, mock_results]) end describe '#api_transaction_count' do @@ -46,10 +38,10 @@ expect(header_row).to eq( ['Week', 'True ID', 'Instant verify', 'Phone Finder', 'Socure (DocV)', 'Socure (KYC) - Shadow', 'Socure (KYC) - Non-Shadow', - 'Fraud Score and Attribute', 'Threat Metrix'], + 'Fraud Score and Attribute', 'Threat Metrix (IDV)', 'Threat Metrix (Auth Only)'], ) expect(data_row.first).to eq("#{time_range.begin.to_date} - #{time_range.end.to_date}") - expect(data_row[1..]).to eq([10, 15, 20, 25, 30, 35, 40, 45]) + expect(data_row[1..]).to eq([10, 15, 20, 25, 30, 35, 40, 45, 50]) end end @@ -65,7 +57,7 @@ / Week,True\ ID,Instant\ verify,Phone\ Finder, Socure\ \(DocV\),Socure\ \(KYC\)\s-\sShadow,Socure\ \(KYC\)\s-\sNon-Shadow, - Fraud\ Score\ and\ Attribute,Threat\ Metrix + Fraud\ Score\ and\ Attribute,Threat\ Metrix\s\(IDV\),Threat\ Metrix\s\(Auth\ Only\) /x, ) expect(csv).to include("#{time_range.begin.to_date} - #{time_range.end.to_date}") From fc00ca2c4a8739d39da9b5543a25cedd343d68c8 Mon Sep 17 00:00:00 2001 From: KolawoleHOseni Date: Mon, 23 Jun 2025 20:00:29 -0500 Subject: [PATCH 4/7] Report fix --- lib/reporting/api_transaction_count_report.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reporting/api_transaction_count_report.rb b/lib/reporting/api_transaction_count_report.rb index 9520bf3f863..de7676ef217 100644 --- a/lib/reporting/api_transaction_count_report.rb +++ b/lib/reporting/api_transaction_count_report.rb @@ -182,7 +182,7 @@ def column_labels(row) def cloudwatch_client @cloudwatch_client ||= Reporting::CloudwatchClient.new( num_threads: @threads, - ensure_complete_logs: true, + ensure_complete_logs: false, slice_interval: @slice, progress: progress?, logger: verbose? ? Logger.new(STDERR) : nil, From 377f4cb606cd960028f9ca6be8f9016e0cde0f48 Mon Sep 17 00:00:00 2001 From: KolawoleHOseni Date: Mon, 23 Jun 2025 20:36:19 -0500 Subject: [PATCH 5/7] Report fix --- lib/reporting/api_transaction_count_report.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/reporting/api_transaction_count_report.rb b/lib/reporting/api_transaction_count_report.rb index de7676ef217..2e3cb9b2042 100644 --- a/lib/reporting/api_transaction_count_report.rb +++ b/lib/reporting/api_transaction_count_report.rb @@ -21,8 +21,8 @@ def initialize( time_range:, verbose: false, progress: false, - slice: 6.hours, - threads: 1 + slice: 1.day, + threads: 5 ) @time_range = time_range @verbose = verbose @@ -182,7 +182,7 @@ def column_labels(row) def cloudwatch_client @cloudwatch_client ||= Reporting::CloudwatchClient.new( num_threads: @threads, - ensure_complete_logs: false, + ensure_complete_logs: true, slice_interval: @slice, progress: progress?, logger: verbose? ? Logger.new(STDERR) : nil, @@ -208,6 +208,7 @@ def true_id_query properties.event_properties.vendor as vendor | display uuid, id, timestamp, sp, dol_state, success, billed, vendor, product_status, transaction_status, conversation_id, request_id, referenceID, decision_status, submit_attempts, remaining_submit_attempts + | limit 10000 QUERY end @@ -229,6 +230,7 @@ def phone_finder_query | display uuid, id, timestamp, sp, dol_state, success, phoneFinder_referenceID, phoneFinder_transactionID, phoneFinder_pass, coalesce(temp_checks,"passed_all","") as phoneFinder_checks + | limit 10000 QUERY end @@ -244,6 +246,7 @@ def socure_query properties.event_properties.reference_id as reference_id, properties.event_properties.submit_attempts as submit_attempts, replace(replace(strcontains(name, "front"),"1","front"),"0","back") as side | display uuid, id, timestamp, sp, dol_state, success, decision_result, side, docv_transaction_token, reference_id, submit_attempts + | limit 10000 QUERY end @@ -279,6 +282,7 @@ def instant_verify_query resolution_transactionID, resolution_success, resolution_timed_out_flag + | limit 10000 QUERY end @@ -290,6 +294,7 @@ def threat_metrix_idv_query @timestamp as timestamp, properties.event_properties.proofing_results.context.stages.threatmetrix.success as tmx_success | stats max(tmx_success) as max_tmx_success by uuid + | limit 10000 QUERY end @@ -299,6 +304,7 @@ def threat_metrix_auth_only_query | fields properties.user_id as uuid, @timestamp as timestamp, + | limit 10000 QUERY end @@ -316,6 +322,7 @@ def fraud_score_and_attribute_query properties.event_properties.response_body.fraudpoint.vulnerable_victim_index as vulnerable_victim_index, properties.event_properties.response_body.fraudpoint.risk_indicators_codes as risk_indicators_codes, properties.event_properties.response_body.fraudpoint.risk_indicators_descriptions as risk_indicators_descriptions + | limit 10000 QUERY end @@ -339,7 +346,7 @@ def socure_kyc_shadow_query properties.event_properties.socure_result.errors.I919 as I919, properties.event_properties.socure_result.errors.R354 as R354 | filter name = "idv_socure_shadow_mode_proofing_result" - | stats count(*) as c + | limit 10000 QUERY end @@ -349,7 +356,7 @@ def socure_kyc_non_shadow_query | filter name='IdV: doc auth verify proofing results' and properties.event_properties.proofing_results.context.stages.resolution.vendor_name='socure_kyc' | sort @timestamp desc - | stats count(*) as c + | limit 10000 QUERY end end From bcd74ae21f4cf9349040f439ef044afda1063916 Mon Sep 17 00:00:00 2001 From: KolawoleHOseni Date: Tue, 24 Jun 2025 11:42:18 -0500 Subject: [PATCH 6/7] fix --- lib/reporting/api_transaction_count_report.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reporting/api_transaction_count_report.rb b/lib/reporting/api_transaction_count_report.rb index 2e3cb9b2042..d0eae77b872 100644 --- a/lib/reporting/api_transaction_count_report.rb +++ b/lib/reporting/api_transaction_count_report.rb @@ -85,8 +85,8 @@ def api_transaction_count instant_verify_table.first, phone_finder_table.first, socure_table.first, - socure_kyc_non_shadow_table.first, socure_kyc_shadow_table.first, + socure_kyc_non_shadow_table.first, fraud_score_and_attribute_table.first, threat_metrix_idv_table.first, threat_metrix_auth_only_table.first, From d1d59227c329a90a61dd60377a11f15b00c9e717 Mon Sep 17 00:00:00 2001 From: KolawoleHOseni Date: Wed, 25 Jun 2025 13:27:42 -0500 Subject: [PATCH 7/7] spec fix --- spec/lib/reporting/api_transaction_count_report_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/reporting/api_transaction_count_report_spec.rb b/spec/lib/reporting/api_transaction_count_report_spec.rb index c9f33064d69..42f10eee3f5 100644 --- a/spec/lib/reporting/api_transaction_count_report_spec.rb +++ b/spec/lib/reporting/api_transaction_count_report_spec.rb @@ -41,7 +41,7 @@ 'Fraud Score and Attribute', 'Threat Metrix (IDV)', 'Threat Metrix (Auth Only)'], ) expect(data_row.first).to eq("#{time_range.begin.to_date} - #{time_range.end.to_date}") - expect(data_row[1..]).to eq([10, 15, 20, 25, 30, 35, 40, 45, 50]) + expect(data_row[1..]).to eq([10, 15, 20, 25, 35, 30, 40, 45, 50]) end end