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}:
outcomeis"approved"only forreviewStatuscompletedwithreviewAnswerGREEN;"declined"forcompletedwithRED;"pending"for everything else (init,pending,queued,onHold,awaitingService,awaitingUser, a missing review, or an unexpected answer).finalis true for a decline without a resubmission (reviewRejectTypeother thanRETRY);can-retryis true forRETRY, when the applicant may upload again.on-holdis true foronHold(a compliance officer must act).fraudis true when a reject label is one ofFRAUD_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