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
58 changes: 47 additions & 11 deletions lib/reporting/identity_verification_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@ def self.all_events
end

module Results
# rubocop:disable Layout/LineLength
IDV_FINAL_RESOLUTION_VERIFIED = 'IdV: final resolution - Verified'
IDV_FINAL_RESOLUTION_FRAUD_REVIEW = 'IdV: final resolution - Fraud Review Pending'
IDV_FINAL_RESOLUTION_GPO = 'IdV: final resolution - GPO Pending'
IDV_FINAL_RESOLUTION_GPO_FRAUD_REVIEW = 'Idv: final resolution - GPO Pending + Fraud Review Pending'
IDV_FINAL_RESOLUTION_IN_PERSON = 'IdV: final resolution - In Person Proofing'
IDV_FINAL_RESOLUTION_IN_PERSON_FRAUD_REVIEW = 'IdV: final resolution - In Person Proofing + Fraud Review Pending'
IDV_FINAL_RESOLUTION_GPO_IN_PERSON = 'IdV: final resolution - GPO Pending + In Person Pending'
IDV_FINAL_RESOLUTION_GPO_IN_PERSON_FRAUD_REVIEW = 'IdV: final resolution - GPO Pending + In Person Pending + Fraud Review'

IDV_REJECT_DOC_AUTH = 'IdV Reject: Doc Auth'
IDV_REJECT_VERIFY = 'IdV Reject: Verify'
IDV_REJECT_PHONE_FINDER = 'IdV Reject: Phone Finder'
# rubocop:enable Layout/LineLength
end

# @param [Array<String>] issuers
Expand Down Expand Up @@ -101,11 +107,14 @@ def as_csv
csv << ['Image Submitted', idv_doc_auth_image_vendor_submitted]
csv << []
csv << ['Workflow completed', idv_final_resolution]
csv << ['Workflow completed - Verified', idv_final_resolution_verified]
csv << ['Workflow completed - Total Pending', idv_final_resolution_total_pending]
csv << ['Workflow completed - With Phone Number', idv_final_resolution_verified]
csv << ['Workflow completed - With Phone Number - Fraud Review', idv_final_resolution_fraud_review]
csv << ['Workflow completed - GPO Pending', idv_final_resolution_gpo]
csv << ['Workflow completed - GPO Pending - Fraud Review', idv_final_resolution_gpo_fraud_review]
csv << ['Workflow completed - In-Person Pending', idv_final_resolution_in_person]
csv << ['Workflow completed - Fraud Review Pending', idv_final_resolution_fraud_review]
csv << ['Workflow completed - In-Person Pending - Fraud Review', idv_final_resolution_in_person_fraud_review]
csv << ['Workflow completed - GPO + In-Person Pending', idv_final_resolution_gpo_in_person]
csv << ['Workflow completed - GPO + In-Person Pending - Fraud Review', idv_final_resolution_gpo_in_person_fraud_review]
csv << []
csv << ['Fraud review rejected', idv_fraud_rejected]
csv << ['Successfully Verified', successfully_verified_users]
Expand Down Expand Up @@ -167,21 +176,32 @@ def idv_final_resolution_verified
data[Results::IDV_FINAL_RESOLUTION_VERIFIED].count
end

def idv_final_resolution_fraud_review
data[Results::IDV_FINAL_RESOLUTION_FRAUD_REVIEW].count
end

def idv_final_resolution_gpo
data[Results::IDV_FINAL_RESOLUTION_GPO].count
end

def idv_final_resolution_gpo_fraud_review
data[Results::IDV_FINAL_RESOLUTION_GPO_FRAUD_REVIEW].count
end

def idv_final_resolution_in_person
data[Results::IDV_FINAL_RESOLUTION_IN_PERSON].count
end

def idv_final_resolution_fraud_review
data[Results::IDV_FINAL_RESOLUTION_FRAUD_REVIEW].count
def idv_final_resolution_in_person_fraud_review
data[Results::IDV_FINAL_RESOLUTION_IN_PERSON_FRAUD_REVIEW].count
end

def idv_final_resolution_total_pending
@idv_final_resolution_total_pending ||=
(data[Events::IDV_FINAL_RESOLUTION] - data[Results::IDV_FINAL_RESOLUTION_VERIFIED]).count
def idv_final_resolution_gpo_in_person
data[Results::IDV_FINAL_RESOLUTION_GPO_IN_PERSON].count
end

def idv_final_resolution_gpo_in_person_fraud_review
data[Results::IDV_FINAL_RESOLUTION_GPO_IN_PERSON_FRAUD_REVIEW].count
end

def gpo_verification_submitted
Expand Down Expand Up @@ -236,6 +256,7 @@ def fraud_review_passed
end

# rubocop:disable Layout/LineLength
# rubocop:disable Metrics/BlockLength
# Turns query results into a hash keyed by event name, values are a count of unique users
# for that event
# @return [Hash<Set<String>>]
Expand All @@ -257,9 +278,23 @@ def data
case event
when Events::IDV_FINAL_RESOLUTION
event_users[Results::IDV_FINAL_RESOLUTION_VERIFIED] << user_id if row['identity_verified'] == '1'
event_users[Results::IDV_FINAL_RESOLUTION_GPO] << user_id if row['gpo_verification_pending'] == '1'
event_users[Results::IDV_FINAL_RESOLUTION_IN_PERSON] << user_id if row['in_person_verification_pending'] == '1'
event_users[Results::IDV_FINAL_RESOLUTION_FRAUD_REVIEW] << user_id if row['fraud_review_pending'] == '1'

gpo_verification_pending = row['gpo_verification_pending'] == '1'
in_person_verification_pending = row['in_person_verification_pending'] == '1'
fraud_review_pending = row['fraud_review_pending'] == '1'

if !gpo_verification_pending && !in_person_verification_pending
event_users[Results::IDV_FINAL_RESOLUTION_FRAUD_REVIEW] << user_id if fraud_review_pending
elsif gpo_verification_pending && !in_person_verification_pending
event_users[Results::IDV_FINAL_RESOLUTION_GPO] << user_id if !fraud_review_pending
event_users[Results::IDV_FINAL_RESOLUTION_GPO_FRAUD_REVIEW] << user_id if fraud_review_pending
elsif !gpo_verification_pending && in_person_verification_pending
event_users[Results::IDV_FINAL_RESOLUTION_IN_PERSON] << user_id if !fraud_review_pending
event_users[Results::IDV_FINAL_RESOLUTION_IN_PERSON_FRAUD_REVIEW] << user_id if fraud_review_pending
elsif gpo_verification_pending && in_person_verification_pending
event_users[Results::IDV_FINAL_RESOLUTION_GPO_IN_PERSON] << user_id if !fraud_review_pending
event_users[Results::IDV_FINAL_RESOLUTION_GPO_IN_PERSON_FRAUD_REVIEW] << user_id if fraud_review_pending
end
when Events::IDV_DOC_AUTH_IMAGE_UPLOAD
event_users[Results::IDV_REJECT_DOC_AUTH] << user_id if row['doc_auth_failed_non_fraud'] == '1'
when Events::IDV_DOC_AUTH_VERIFY_RESULTS
Expand All @@ -272,6 +307,7 @@ def data
event_users
end
end
# rubocop:enable Metrics/BlockLength
# rubocop:enable Layout/LineLength

def fetch_results
Expand Down
18 changes: 12 additions & 6 deletions spec/lib/reporting/identity_verification_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@
['Image Submitted', 5],
[],
['Workflow completed', 4],
['Workflow completed - Verified', 1],
['Workflow completed - Total Pending', 3],
['Workflow completed - With Phone Number', 1],
['Workflow completed - With Phone Number - Fraud Review', 1],
['Workflow completed - GPO Pending', 1],
['Workflow completed - GPO Pending - Fraud Review', 0],
['Workflow completed - In-Person Pending', 1],
['Workflow completed - Fraud Review Pending', 1],
['Workflow completed - In-Person Pending - Fraud Review', 0],
['Workflow completed - GPO + In-Person Pending', 0],
['Workflow completed - GPO + In-Person Pending - Fraud Review', 0],
[],
['Fraud review rejected', 1],
['Successfully Verified', 4],
Expand Down Expand Up @@ -123,11 +126,14 @@
['Image Submitted', '5'],
[],
['Workflow completed', '4'],
['Workflow completed - Verified', '1'],
['Workflow completed - Total Pending', '3'],
['Workflow completed - With Phone Number', '1'],
['Workflow completed - With Phone Number - Fraud Review', '1'],
['Workflow completed - GPO Pending', '1'],
['Workflow completed - GPO Pending - Fraud Review', '0'],
['Workflow completed - In-Person Pending', '1'],
['Workflow completed - Fraud Review Pending', '1'],
['Workflow completed - In-Person Pending - Fraud Review', '0'],
['Workflow completed - GPO + In-Person Pending', '0'],
['Workflow completed - GPO + In-Person Pending - Fraud Review', '0'],
[],
['Fraud review rejected', '1'],
['Successfully Verified', '4'],
Expand Down