Verifications: the individual checks inside an inquiry (government ID, selfie, database, document, phone, email, ...). Persona has no list endpoint; an inquiry's verifications come from its verifications relationship, which list-for-inquiry reads for you.

Statuses: initiated, submitted, passed, failed, skipped, canceled, plus confirmed (email and phone) and tentatively_passed/tentatively_failed on some types. Each one has checks[]: {name, status: passed|failed|not_applicable, reasons}.

Government ID and selfie verifications carry photo URLs and extracted id numbers and birth dates. Don't log them.

Values

TYPE_PATHS

TYPE_PATHS: Map {
  government-id: "government-ids",
  government-id-nfc: "government-id-nfcs",
  selfie: "selfies",
  database: "databases",
  database-standard: "database-standards",
  database-business: "database-businesses",
  database-tin: "database-tins",
  database-ecbsv: "database-ecbsvs",
  database-phone-carrier: "database-phone-carriers",
  database-serpro: "database-serpros",
  aamva: "aamvas",
  document: "documents",
  email-address: "email-addresses",
  phone-number: "phone-numbers"
}

Functions

failed-checks

fn (doc: Any): Vec<Str>

The names of a verification's checks with status failed (sorted), e.g. ["id_barcode_inconsistency", "id_expired"]. These name the check, never the user's data.

Example

v {data: {type: "verification/government-id", attributes: {checks: [
  {name: "id_expired", status: "failed"},
  {name: "id_barcode_inconsistency", status: "failed"},
  {name: "id_aamva_database_lookup", status: "passed"}
]}}}
::persona::verifications/failed-checks(v)  // ["id_barcode_inconsistency", "id_expired"]

from-document

fn (doc: Any): Vec

The verifications included in an inquiry document, in the order of its verifications relationship. Exposed for testing.

Example

doc {
  data: {type: "inquiry", relationships: {verifications: {data: [{id: "ver_1"}]}}},
  included: [{id: "ver_1", type: "verification/selfie"}]
}
map(::persona::verifications/from-document(doc), %.type)  // ["verification/selfie"]

get-verification

fn (verification-id: Str): Map
fn (verification-id: Str, opts: Map): Map
fn (verification-id: Str, opts: Map, options: Map): Map

GET /verifications/{id} - Retrieve any verification by id (ver_...). opts takes include and fields.

Example

v ::persona::verifications/get-verification("ver_...")
::persona::api/attr(v, "status")  // "passed"

get-verification-by-type

fn (type-name: Str, verification-id: Str): Map
fn (type-name: Str, verification-id: Str, options: Map): Map

GET /verification/{type-plural}/{id} - Retrieve a verification through its typed endpoint, e.g. get-verification-by-type("government-id", "ver_..."). See TYPE_PATHS for the supported types.

Example

v ::persona::verifications/get-verification-by-type("government-id", "ver_123")
::persona::verifications/failed-checks(v)

list-for-inquiry

fn (inquiry-id: Str): Vec
fn (inquiry-id: Str, options: Map): Vec

Every verification on an inquiry, as resources: fetches the inquiry with include=verifications and returns the included verification/* objects (oldest first, as Persona orders the relationship).

Example

checks ::persona::verifications/list-for-inquiry("inq_...")
map(checks, (v) { {type: v.type, status: ::persona::api/attr(v, "status")} })

redact-verification

fn (verification-id: Str): Map
fn (verification-id: Str, options: Map): Map

DELETE /verifications/{id} - Permanently remove a verification's PII. Persona returns 409 while it is investigation-locked.

Example

::persona::verifications/redact-verification("ver_123")

type-path

fn (type-name: Str, verification-id: Str): Str

The typed retrieve path for a verification type, given as "government-id" or "verification/government-id": /verification/government-ids/{id}. An Err for a type without a typed endpoint (use get-verification). Exposed for testing.

Example

::persona::verifications/type-path("government-id", "ver_1")  // "/verification/government-ids/ver_1"
::persona::verifications/type-path("verification/selfie", "ver_2")  // "/verification/selfies/ver_2"