From b7e3ef28ee2c5dbcbbda26b48d8ff201d08992e1 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Wed, 18 Sep 2024 11:24:43 -0700 Subject: [PATCH] Bypass identity score if uploaded docs --- backend/shared/src/gidx/helpers.ts | 9 ++++++++- common/src/reason-codes.ts | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/shared/src/gidx/helpers.ts b/backend/shared/src/gidx/helpers.ts index f5d669f88d..864abcfff4 100644 --- a/backend/shared/src/gidx/helpers.ts +++ b/backend/shared/src/gidx/helpers.ts @@ -18,6 +18,7 @@ import { RegistrationReturnType, timeoutCodes, underageErrorCodes, + uploadedDocsToVerifyIdentity, } from 'common/reason-codes' import { createSupabaseDirectClient } from 'shared/supabase/init' import { intersection } from 'lodash' @@ -254,7 +255,13 @@ export const verifyReasonCodes = async ( FraudConfidenceScore !== undefined && IdentityConfidenceScore !== undefined && (FraudConfidenceScore < IDENTITY_AND_FRAUD_THRESHOLD || - IdentityConfidenceScore < IDENTITY_AND_FRAUD_THRESHOLD) + IdentityConfidenceScore < IDENTITY_AND_FRAUD_THRESHOLD) && + // If they uploaded docs to verify their identity, their ID score is meaningless + !( + uploadedDocsToVerifyIdentity(ReasonCodes) && + FraudConfidenceScore >= IDENTITY_AND_FRAUD_THRESHOLD && + IdentityConfidenceScore === 0 + ) ) { log( 'Registration failed, resulted in low confidence scores:', diff --git a/common/src/reason-codes.ts b/common/src/reason-codes.ts index c0fed857dc..f3acc396f4 100644 --- a/common/src/reason-codes.ts +++ b/common/src/reason-codes.ts @@ -82,6 +82,11 @@ export const limitTo5kCashoutCodes: string[] = [ 'LL-GEO-US-FL', // Location Florida ] +export const uploadedDocsToVerifyIdentity = (reasonCodes: string[]) => + ['DOC-REV-COMPL', 'ID-FAIL', 'ID-VERIFIED'].every((code) => + reasonCodes.includes(code) + ) + export const documentsReadyCodes: string[] = ['DOC-REV-COMPL', 'DOC-UPLOADED'] export type RegistrationReturnType = {