Reads the organization's related people for reverify.
Names the customer's ORGANIZATION_KYB template for reverify.
Protected ReadonlycacheProtected ReadonlydbStaticinstanceThe 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.
Optionalreason?: { code: string; note?: string }Stored as the MANUAL reason only; AiPrise's business profile takes none.
OptionalverificationProfileId?: stringClear each customer's membership tag and each record tag wherever cached,
and always this namespace's collection tag. keys are exact deletes in this
instance's key space: the only bust a null client honours.
ProtectedinvalidateThe bust every organization write makes, whatever it changed: its record
tag in every namespace projecting it, its customer's pages on both
surfaces, and the writer's own folded get keys.
ProtectedpageTags for a page: the scope it searched, each customer whose name its rows
copy, and the fields of records it may not hold that chose its rows.
Runs KYB again once every live related person is APPROVED. AiPrise evaluates its related-person rules only when a business verification runs, so the run at creation decided REVIEW. The MAKE_DECISION webhook writes the outcome.
ProtectedsearchTags for a page: the scope its query searched (each customer's membership
tag, else the collection tag), so an empty page is bustable too, plus the
records it projects and the fields that chose or ordered its rows.
Pin the RouteFusion business entity onto the org — minted once, reused for
every VA. The pin is CONDITIONAL (WHERE data->'routeFusionEntity' IS NULL) so two concurrent onboards can't both mint: the loser's UPDATE
matches no row, and the subsequent re-read returns the winner's pinned
value. A missing org (re-read finds nothing) is NOT_FOUND.
requiredDocuments is the OR-of-AND document-set snapshot from RF's
entityRequiredFields, resolved for the org's real country/business type
at mint time (see onboardRouteFusionEntity). Optional so legacy callers
(and tests) can still pin without it.
Update only the pinned entity's KYB status (RF entity webhook →
VERIFIED/REJECTED), leaving entityId/programId intact. Matches only
when an entity is already pinned; a status-only write on an org with no
pinned entity is NOT_FOUND.
Admin org write. Accepts the full editable business-field set, mapping each
field exactly as OrganizationService.update does (top-level columns
vs data jsonb).
A change to a field KYB sends AiPrise (KYB_SYNDICATED_FIELDS) writes
PENDING_VERIFICATION, then after the commit pushes the fields and re-runs
KYB, as the customer path does; a refused run is
ORGANIZATION_VERIFICATION_FAILED with the written row. An ACTION_REQUIRED
org re-verifies only once the edit supplies what is missing. A caller's
explicit status is written instead (the AiPrise decision callback writes
APPROVED). statusUpdated is published only when the status changed.
data.workspaceId links the ORGANIZATION workspace whose members sign in
as this organization. Set once: the same workspace again writes nothing,
another is refused. Only a link may run in a caller's tx, in a savepoint
of it, so a refused link leaves the tx usable.
Admin org write. Accepts the full editable business-field set, mapping each
field exactly as OrganizationService.update does (top-level columns
vs data jsonb).
A change to a field KYB sends AiPrise (KYB_SYNDICATED_FIELDS) writes
PENDING_VERIFICATION, then after the commit pushes the fields and re-runs
KYB, as the customer path does; a refused run is
ORGANIZATION_VERIFICATION_FAILED with the written row. An ACTION_REQUIRED
org re-verifies only once the edit supplies what is missing. A caller's
explicit status is written instead (the AiPrise decision callback writes
APPROVED). statusUpdated is published only when the status changed.
data.workspaceId links the ORGANIZATION workspace whose members sign in
as this organization. Set once: the same workspace again writes nothing,
another is refused. Only a link may run in a caller's tx, in a savepoint
of it, so a refused link leaves the tx usable.
Admin org write. Accepts the full editable business-field set, mapping each
field exactly as OrganizationService.update does (top-level columns
vs data jsonb).
A change to a field KYB sends AiPrise (KYB_SYNDICATED_FIELDS) writes
PENDING_VERIFICATION, then after the commit pushes the fields and re-runs
KYB, as the customer path does; a refused run is
ORGANIZATION_VERIFICATION_FAILED with the written row. An ACTION_REQUIRED
org re-verifies only once the edit supplies what is missing. A caller's
explicit status is written instead (the AiPrise decision callback writes
APPROVED). statusUpdated is published only when the status changed.
data.workspaceId links the ORGANIZATION workspace whose members sign in
as this organization. Set once: the same workspace again writes nothing,
another is refused. Only a link may run in a caller's tx, in a savepoint
of it, so a refused link leaves the tx usable.
Admin org write. Accepts the full editable business-field set, mapping each
field exactly as OrganizationService.update does (top-level columns
vs data jsonb).
A change to a field KYB sends AiPrise (KYB_SYNDICATED_FIELDS) writes
PENDING_VERIFICATION, then after the commit pushes the fields and re-runs
KYB, as the customer path does; a refused run is
ORGANIZATION_VERIFICATION_FAILED with the written row. An ACTION_REQUIRED
org re-verifies only once the edit supplies what is missing. A caller's
explicit status is written instead (the AiPrise decision callback writes
APPROVED). statusUpdated is published only when the status changed.
data.workspaceId links the ORGANIZATION workspace whose members sign in
as this organization. Set once: the same workspace again writes nothing,
another is refused. Only a link may run in a caller's tx, in a savepoint
of it, so a refused link leaves the tx usable.
StaticadminThe exact key OrganizationAdminQueryService.get reads through, for its
includeDeleted: false callers.
The includeDeleted: true variant hashes differently and is reached only by
the collection tag, which every Valkey-backed environment has. That gap is
deliberate and pre-existing: it only matters in memory mode, where no admin
get runs with includeDeleted: true.
StaticconsumerThe exact key OrganizationQueryService.get reads through.
get folds onto search, so these args must stay identical to the ones it
passes ({ customerId, ids: [id], pageSize: 1 }) plus the defaults search
bakes into its own key — includeDeleted: false and page: 1. Every other
filter is undefined there, and serviceCacheKey canonicalizes with JCS,
which drops undefined properties. organizationCache.test.ts pins the
equivalence.
Cross-customer admin access to organizations.
Extends OrganizationCache, so this read shares the
organization-searchnamespace — and therefore the membership-tag vocabulary — with the consumer surface. A consumer write for a customer evicts the admin pages scoped to that customer, and vice versa, without either service referencing the other.