//native
type Base64 = string
/**
* Create manual verification screening
* Create manual verification screening
**Token scopes**: `worker:write`, `screenings:write`
*/
export async function main(auth: RT.Deel, body: Body) {
const url = new URL(`https://api.letsdeel.com/rest/v2/screenings/manual-verification`)
const formData = new FormData()
for (const [k, v] of Object.entries(body)) {
if (v !== undefined && v !== '') {
if (['back', 'front', 'additional', 'selfie_with_id', 'proof_of_residence'].includes(k)) {
const { base64, type, name } = v as {
base64: Base64
type: string
name: string
}
formData.append(
k,
new Blob([Uint8Array.from(atob(base64), (m) => m.codePointAt(0)!)], { type }),
name
)
} else {
formData.append(k, String(v))
}
}
}
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: formData
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
/**
* The back side of the document
*/
back?: {
base64: Base64
type:
| 'image/png'
| 'image/jpeg'
| 'image/gif'
| 'application/pdf'
| 'appication/json'
| 'text/csv'
| 'text/plain'
| 'audio/mpeg'
| 'audio/wav'
| 'video/mp4'
name: string
}
/**
* The front side of the document
*/
front: {
base64: Base64
type:
| 'image/png'
| 'image/jpeg'
| 'image/gif'
| 'application/pdf'
| 'appication/json'
| 'text/csv'
| 'text/plain'
| 'audio/mpeg'
| 'audio/wav'
| 'video/mp4'
name: string
}
/**
* An additional document
*/
additional?: {
base64: Base64
type:
| 'image/png'
| 'image/jpeg'
| 'image/gif'
| 'application/pdf'
| 'appication/json'
| 'text/csv'
| 'text/plain'
| 'audio/mpeg'
| 'audio/wav'
| 'video/mp4'
name: string
}
/**
* The type of document to be verified
*/
document_type: 'PASSPORT' | 'DRIVING_LICENSE' | 'GOVERNMENT_ID' | 'OTHER'
/**
* The type of KYC operation to perform
*/
operation_type: 'IDENTITY_RESUBMISSION_KYC' | 'IDENTITY_VERIFICATION_KYC' | 'NAME_CHANGE_KYC'
/**
* A selfie of the user holding the ID document
*/
selfie_with_id: {
base64: Base64
type:
| 'image/png'
| 'image/jpeg'
| 'image/gif'
| 'application/pdf'
| 'appication/json'
| 'text/csv'
| 'text/plain'
| 'audio/mpeg'
| 'audio/wav'
| 'video/mp4'
name: string
}
/**
* The issuing country code of the document to be verified (ISO 3166-1 alpha-2)
*/
document_country: string
/**
* A proof of residence document
*/
proof_of_residence?: {
base64: Base64
type:
| 'image/png'
| 'image/jpeg'
| 'image/gif'
| 'application/pdf'
| 'appication/json'
| 'text/csv'
| 'text/plain'
| 'audio/mpeg'
| 'audio/wav'
| 'video/mp4'
name: string
}
/**
* Indicates whether the document requires translation
*/
translation_required: boolean
[k: string]: unknown
}
Submitted by hugo697 235 days ago