@cfxlabsinc/b2b-services
    Preparing search index...

    Admin writes on related people: webhook status mapping and operator decisions.

    Hierarchy (View Summary)

    Index
    db: B2bDatabase
    instance: (...args: []) => RelatedPersonAdminService = ...

    The process default: built from each dependency's own instance().

    • Push an operator's decision to AiPrise; the RESULT_UPDATE webhook is the only status writer. A caller that already read the live row passes verificationProfileId to skip the re-read.

      Parameters

      • __namedParameters: {
            decision: "APPROVED" | "DECLINED";
            id: string;
            note?: string;
            reasonCode?: string;
            verificationProfileId?: string;
        }
        • decision: "APPROVED" | "DECLINED"
        • id: string
        • Optionalnote?: string

          Kept beside the code as the MANUAL reason's detail; AiPrise never sees it.

        • OptionalreasonCode?: string
        • OptionalverificationProfileId?: string

      Returns Promise<
          | { error: ServiceError; ok: false }
          | { ok: true; value: { verificationProfileId: string } },
      >

    • Live rows on one organization sharing a name and date of birth: a person entered once per role before a control person could carry isBeneficialOwner. limit counts groups. A collapsed pair leaves one live row and drops out. after is a group's cursor from an earlier page.

      Parameters

      • __namedParameters: { after?: string; limit?: number; organizationIds?: string[] } = {}

      Returns Promise<
          | {
              ok: true;
              value: { hasNext: boolean; items: DuplicateProfileGroup[] };
          }
          | { error: ServiceError; ok: false },
      >

    • Collapses a CONTROL row and a BENEFICIAL_OWNER row of one human onto the CONTROL row, flagged isBeneficialOwner. Reads AiPrise first with no lock held, then in one transaction locks both rows, re-checks them, widens the keeper and deletes the owner in AiPrise, and writes the rows. An AiPrise failure there rolls the rows back for a re-run. After the commit it publishes; an event that fails is returned in unfinished, not thrown. dryRun only reads.

      Parameters

      • __namedParameters: { dryRun?: boolean; group: DuplicateProfileGroup; heartbeat?: () => void }
        • OptionaldryRun?: boolean
        • group: DuplicateProfileGroup
        • Optionalheartbeat?: () => void

          Called before each AiPrise call and each write; a throw stops the merge.

      Returns Promise<
          | { ok: true; value: ProfileGroupMerge }
          | { error: ProfileGroupMergeError; ok: false },
      >

    • Writes the verification status and/or the RouteFusion and Zenus stamps on the live row id. A status change emits statusUpdated; an unchanged status or a stamp alone emits nothing. A soft-deleted person is NOT_FOUND.

      Parameters

      • __namedParameters: {
            id: string;
            routeFusionDocumentsUploadedAt?: string;
            routeFusionRepresentativeId?: string;
            status?:
                | "PENDING_VERIFICATION"
                | "ACTION_REQUIRED"
                | "APPROVED"
                | "REVIEW"
                | "BLOCKED";
            verificationReasons?: VerificationReasons
            | null;
            zenusPersonId?: string;
        }
        • id: string
        • OptionalrouteFusionDocumentsUploadedAt?: string
        • OptionalrouteFusionRepresentativeId?: string
        • Optionalstatus?: "PENDING_VERIFICATION" | "ACTION_REQUIRED" | "APPROVED" | "REVIEW" | "BLOCKED"
        • OptionalverificationReasons?: VerificationReasons | null

          Why the verification landed where it did; null clears it.

        • OptionalzenusPersonId?: string

      Returns Promise<
          | { error: ServiceError; ok: false }
          | { ok: true; value: AdminRelatedPerson },
      >