Turn a Sumsub review into a decision your code can branch on: approved, declined (final, or with a resubmission allowed) or pending.

Works on everything that carries a review: get-status results, applicants from get-applicant (under review), transactions from ::sumsub::kyt (under review), raw webhook payloads, and events from ::sumsub::webhooks/parse-event. Anything not clearly completed-and-GREEN is never approved.

Values

FRAUD_LABELS

FRAUD_LABELS: Vec [
  "FORGERY",
  "FRAUDULENT_PATTERNS",
  "DOCUMENT_TEMPLATE",
  "FRAUDULENT_LIVENESS",
  "STOLEN_DOCS",
  "BLOCKLIST"
]

REVIEW_STATUSES

REVIEW_STATUSES: Vec [
  "init",
  "pending",
  "prechecked",
  "queued",
  "completed",
  "onHold",
  "awaitingService",
  "awaitingUser"
]

Functions

is-approved

fn (source: Any): Bool

True only for a completed GREEN review.

review-fields

fn (review: Map): Map

review-of

fn (source: Any): Map

The flat review fields of source: {status, answer, reject-type, labels, button-ids, moderation-comment, client-comment}. Reads a parsed webhook event, a top-level reviewStatus/reviewResult (status, webhook payload) or a nested review (applicant, transaction). Exposed for testing.

review-outcome

fn (source: Any): Map

Map a review to {outcome, final, can-retry, on-hold, fraud, review-status, review-answer, reject-type, reject-labels, button-ids, moderation-comment, client-comment}:

  • outcome is "approved" only for reviewStatus completed with reviewAnswer GREEN; "declined" for completed with RED; "pending" for everything else (init, pending, queued, onHold, awaitingService, awaitingUser, a missing review, or an unexpected answer).
  • final is true for a decline without a resubmission (reviewRejectType other than RETRY); can-retry is true for RETRY, when the applicant may upload again.
  • on-hold is true for onHold (a compliance officer must act).
  • fraud is true when a reject label is one of FRAUD_LABELS.

moderation-comment may be shown to the applicant; client-comment is for your team only.

Example

outcome ::sumsub::decisions/review-outcome(::sumsub::applicants/get-status("65f0c1e2a3b4c5d6e7f80912"))
outcome.outcome