diff --git a/lib/reporting/identity_verification_report.rb b/lib/reporting/identity_verification_report.rb index 9acf6ef530d..1ff5f959aec 100644 --- a/lib/reporting/identity_verification_report.rb +++ b/lib/reporting/identity_verification_report.rb @@ -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] issuers @@ -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] @@ -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 @@ -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>] @@ -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 @@ -272,6 +307,7 @@ def data event_users end end + # rubocop:enable Metrics/BlockLength # rubocop:enable Layout/LineLength def fetch_results diff --git a/spec/lib/reporting/identity_verification_report_spec.rb b/spec/lib/reporting/identity_verification_report_spec.rb index 742e062cf03..1fc617d509a 100644 --- a/spec/lib/reporting/identity_verification_report_spec.rb +++ b/spec/lib/reporting/identity_verification_report_spec.rb @@ -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], @@ -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'],