com.lithic.api.models.AccountHolderSimulateEnrollmentDocumentReviewResponse.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lithic-kotlin-core Show documentation
Show all versions of lithic-kotlin-core Show documentation
The Lithic Developer API is designed to provide a predictable programmatic
interface for accessing your Lithic account through an API and transaction
webhooks. Note that your API key is a secret and should be treated as such.
Don't share it with anyone, including us. We will never ask you for it.
// File generated from our OpenAPI spec by Stainless.
package com.lithic.api.models
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.lithic.api.core.Enum
import com.lithic.api.core.ExcludeMissing
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import com.lithic.api.errors.LithicInvalidDataException
import java.util.Objects
/** A document to be submitted for account holder verification. */
@JsonDeserialize(builder = AccountHolderSimulateEnrollmentDocumentReviewResponse.Builder::class)
@NoAutoDetect
class AccountHolderSimulateEnrollmentDocumentReviewResponse
private constructor(
private val token: JsonField,
private val accountHolderToken: JsonField,
private val documentType: JsonField,
private val requiredDocumentUploads: JsonField>,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** Globally unique identifier for the document. */
fun token(): String? = token.getNullable("token")
/** Globally unique identifier for the account holder. */
fun accountHolderToken(): String? = accountHolderToken.getNullable("account_holder_token")
/** Type of documentation to be submitted for verification. */
fun documentType(): DocumentType? = documentType.getNullable("document_type")
/** List of required document images to upload. */
fun requiredDocumentUploads(): List? =
requiredDocumentUploads.getNullable("required_document_uploads")
/** Globally unique identifier for the document. */
@JsonProperty("token") @ExcludeMissing fun _token() = token
/** Globally unique identifier for the account holder. */
@JsonProperty("account_holder_token")
@ExcludeMissing
fun _accountHolderToken() = accountHolderToken
/** Type of documentation to be submitted for verification. */
@JsonProperty("document_type") @ExcludeMissing fun _documentType() = documentType
/** List of required document images to upload. */
@JsonProperty("required_document_uploads")
@ExcludeMissing
fun _requiredDocumentUploads() = requiredDocumentUploads
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): AccountHolderSimulateEnrollmentDocumentReviewResponse = apply {
if (!validated) {
token()
accountHolderToken()
documentType()
requiredDocumentUploads()?.forEach { it.validate() }
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is AccountHolderSimulateEnrollmentDocumentReviewResponse &&
this.token == other.token &&
this.accountHolderToken == other.accountHolderToken &&
this.documentType == other.documentType &&
this.requiredDocumentUploads == other.requiredDocumentUploads &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
token,
accountHolderToken,
documentType,
requiredDocumentUploads,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"AccountHolderSimulateEnrollmentDocumentReviewResponse{token=$token, accountHolderToken=$accountHolderToken, documentType=$documentType, requiredDocumentUploads=$requiredDocumentUploads, additionalProperties=$additionalProperties}"
companion object {
fun builder() = Builder()
}
class Builder {
private var token: JsonField = JsonMissing.of()
private var accountHolderToken: JsonField = JsonMissing.of()
private var documentType: JsonField = JsonMissing.of()
private var requiredDocumentUploads: JsonField> =
JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(
accountHolderSimulateEnrollmentDocumentReviewResponse:
AccountHolderSimulateEnrollmentDocumentReviewResponse
) = apply {
this.token = accountHolderSimulateEnrollmentDocumentReviewResponse.token
this.accountHolderToken =
accountHolderSimulateEnrollmentDocumentReviewResponse.accountHolderToken
this.documentType = accountHolderSimulateEnrollmentDocumentReviewResponse.documentType
this.requiredDocumentUploads =
accountHolderSimulateEnrollmentDocumentReviewResponse.requiredDocumentUploads
additionalProperties(
accountHolderSimulateEnrollmentDocumentReviewResponse.additionalProperties
)
}
/** Globally unique identifier for the document. */
fun token(token: String) = token(JsonField.of(token))
/** Globally unique identifier for the document. */
@JsonProperty("token")
@ExcludeMissing
fun token(token: JsonField) = apply { this.token = token }
/** Globally unique identifier for the account holder. */
fun accountHolderToken(accountHolderToken: String) =
accountHolderToken(JsonField.of(accountHolderToken))
/** Globally unique identifier for the account holder. */
@JsonProperty("account_holder_token")
@ExcludeMissing
fun accountHolderToken(accountHolderToken: JsonField) = apply {
this.accountHolderToken = accountHolderToken
}
/** Type of documentation to be submitted for verification. */
fun documentType(documentType: DocumentType) = documentType(JsonField.of(documentType))
/** Type of documentation to be submitted for verification. */
@JsonProperty("document_type")
@ExcludeMissing
fun documentType(documentType: JsonField) = apply {
this.documentType = documentType
}
/** List of required document images to upload. */
fun requiredDocumentUploads(requiredDocumentUploads: List) =
requiredDocumentUploads(JsonField.of(requiredDocumentUploads))
/** List of required document images to upload. */
@JsonProperty("required_document_uploads")
@ExcludeMissing
fun requiredDocumentUploads(
requiredDocumentUploads: JsonField>
) = apply { this.requiredDocumentUploads = requiredDocumentUploads }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}
@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): AccountHolderSimulateEnrollmentDocumentReviewResponse =
AccountHolderSimulateEnrollmentDocumentReviewResponse(
token,
accountHolderToken,
documentType,
requiredDocumentUploads.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable(),
)
}
class DocumentType
@JsonCreator
private constructor(
private val value: JsonField,
) : Enum {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is DocumentType && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val COMMERCIAL_LICENSE = DocumentType(JsonField.of("commercial_license"))
val DRIVERS_LICENSE = DocumentType(JsonField.of("drivers_license"))
val PASSPORT = DocumentType(JsonField.of("passport"))
val PASSPORT_CARD = DocumentType(JsonField.of("passport_card"))
val VISA = DocumentType(JsonField.of("visa"))
fun of(value: String) = DocumentType(JsonField.of(value))
}
enum class Known {
COMMERCIAL_LICENSE,
DRIVERS_LICENSE,
PASSPORT,
PASSPORT_CARD,
VISA,
}
enum class Value {
COMMERCIAL_LICENSE,
DRIVERS_LICENSE,
PASSPORT,
PASSPORT_CARD,
VISA,
_UNKNOWN,
}
fun value(): Value =
when (this) {
COMMERCIAL_LICENSE -> Value.COMMERCIAL_LICENSE
DRIVERS_LICENSE -> Value.DRIVERS_LICENSE
PASSPORT -> Value.PASSPORT
PASSPORT_CARD -> Value.PASSPORT_CARD
VISA -> Value.VISA
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
COMMERCIAL_LICENSE -> Known.COMMERCIAL_LICENSE
DRIVERS_LICENSE -> Known.DRIVERS_LICENSE
PASSPORT -> Known.PASSPORT
PASSPORT_CARD -> Known.PASSPORT_CARD
VISA -> Known.VISA
else -> throw LithicInvalidDataException("Unknown DocumentType: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
/** Represents a single image of the document to upload. */
@JsonDeserialize(builder = RequiredDocumentUpload.Builder::class)
@NoAutoDetect
class RequiredDocumentUpload
private constructor(
private val imageType: JsonField,
private val status: JsonField,
private val statusReasons: JsonField>,
private val uploadUrl: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** Type of image to upload. */
fun imageType(): ImageType? = imageType.getNullable("image_type")
/** Status of document image upload. */
fun status(): Status? = status.getNullable("status")
/** Reasons for document image upload status. */
fun statusReasons(): List? = statusReasons.getNullable("status_reasons")
/**
* URL to upload document image to.
*
* Note that the upload URLs expire after 7 days. If an upload URL expires, you can refresh
* the URLs by retrieving the document upload from `GET
* /account_holders/{account_holder_token}/documents`.
*/
fun uploadUrl(): String? = uploadUrl.getNullable("upload_url")
/** Type of image to upload. */
@JsonProperty("image_type") @ExcludeMissing fun _imageType() = imageType
/** Status of document image upload. */
@JsonProperty("status") @ExcludeMissing fun _status() = status
/** Reasons for document image upload status. */
@JsonProperty("status_reasons") @ExcludeMissing fun _statusReasons() = statusReasons
/**
* URL to upload document image to.
*
* Note that the upload URLs expire after 7 days. If an upload URL expires, you can refresh
* the URLs by retrieving the document upload from `GET
* /account_holders/{account_holder_token}/documents`.
*/
@JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl() = uploadUrl
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): RequiredDocumentUpload = apply {
if (!validated) {
imageType()
status()
statusReasons()
uploadUrl()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is RequiredDocumentUpload &&
this.imageType == other.imageType &&
this.status == other.status &&
this.statusReasons == other.statusReasons &&
this.uploadUrl == other.uploadUrl &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
imageType,
status,
statusReasons,
uploadUrl,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"RequiredDocumentUpload{imageType=$imageType, status=$status, statusReasons=$statusReasons, uploadUrl=$uploadUrl, additionalProperties=$additionalProperties}"
companion object {
fun builder() = Builder()
}
class Builder {
private var imageType: JsonField = JsonMissing.of()
private var status: JsonField = JsonMissing.of()
private var statusReasons: JsonField> = JsonMissing.of()
private var uploadUrl: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(requiredDocumentUpload: RequiredDocumentUpload) = apply {
this.imageType = requiredDocumentUpload.imageType
this.status = requiredDocumentUpload.status
this.statusReasons = requiredDocumentUpload.statusReasons
this.uploadUrl = requiredDocumentUpload.uploadUrl
additionalProperties(requiredDocumentUpload.additionalProperties)
}
/** Type of image to upload. */
fun imageType(imageType: ImageType) = imageType(JsonField.of(imageType))
/** Type of image to upload. */
@JsonProperty("image_type")
@ExcludeMissing
fun imageType(imageType: JsonField) = apply { this.imageType = imageType }
/** Status of document image upload. */
fun status(status: Status) = status(JsonField.of(status))
/** Status of document image upload. */
@JsonProperty("status")
@ExcludeMissing
fun status(status: JsonField) = apply { this.status = status }
/** Reasons for document image upload status. */
fun statusReasons(statusReasons: List) =
statusReasons(JsonField.of(statusReasons))
/** Reasons for document image upload status. */
@JsonProperty("status_reasons")
@ExcludeMissing
fun statusReasons(statusReasons: JsonField>) = apply {
this.statusReasons = statusReasons
}
/**
* URL to upload document image to.
*
* Note that the upload URLs expire after 7 days. If an upload URL expires, you can
* refresh the URLs by retrieving the document upload from `GET
* /account_holders/{account_holder_token}/documents`.
*/
fun uploadUrl(uploadUrl: String) = uploadUrl(JsonField.of(uploadUrl))
/**
* URL to upload document image to.
*
* Note that the upload URLs expire after 7 days. If an upload URL expires, you can
* refresh the URLs by retrieving the document upload from `GET
* /account_holders/{account_holder_token}/documents`.
*/
@JsonProperty("upload_url")
@ExcludeMissing
fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}
@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): RequiredDocumentUpload =
RequiredDocumentUpload(
imageType,
status,
statusReasons.map { it.toUnmodifiable() },
uploadUrl,
additionalProperties.toUnmodifiable(),
)
}
class ImageType
@JsonCreator
private constructor(
private val value: JsonField,
) : Enum {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is ImageType && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val BACK = ImageType(JsonField.of("back"))
val FRONT = ImageType(JsonField.of("front"))
fun of(value: String) = ImageType(JsonField.of(value))
}
enum class Known {
BACK,
FRONT,
}
enum class Value {
BACK,
FRONT,
_UNKNOWN,
}
fun value(): Value =
when (this) {
BACK -> Value.BACK
FRONT -> Value.FRONT
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
BACK -> Known.BACK
FRONT -> Known.FRONT
else -> throw LithicInvalidDataException("Unknown ImageType: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class Status
@JsonCreator
private constructor(
private val value: JsonField,
) : Enum {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Status && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val COMPLETED = Status(JsonField.of("COMPLETED"))
val FAILED = Status(JsonField.of("FAILED"))
val PENDING = Status(JsonField.of("PENDING"))
val UPLOADED = Status(JsonField.of("UPLOADED"))
fun of(value: String) = Status(JsonField.of(value))
}
enum class Known {
COMPLETED,
FAILED,
PENDING,
UPLOADED,
}
enum class Value {
COMPLETED,
FAILED,
PENDING,
UPLOADED,
_UNKNOWN,
}
fun value(): Value =
when (this) {
COMPLETED -> Value.COMPLETED
FAILED -> Value.FAILED
PENDING -> Value.PENDING
UPLOADED -> Value.UPLOADED
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
COMPLETED -> Known.COMPLETED
FAILED -> Known.FAILED
PENDING -> Known.PENDING
UPLOADED -> Known.UPLOADED
else -> throw LithicInvalidDataException("Unknown Status: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class StatusReason
@JsonCreator
private constructor(
private val value: JsonField,
) : Enum {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is StatusReason && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val BACK_IMAGE_BLURRY = StatusReason(JsonField.of("BACK_IMAGE_BLURRY"))
val FILE_SIZE_TOO_LARGE = StatusReason(JsonField.of("FILE_SIZE_TOO_LARGE"))
val FRONT_IMAGE_BLURRY = StatusReason(JsonField.of("FRONT_IMAGE_BLURRY"))
val FRONT_IMAGE_GLARE = StatusReason(JsonField.of("FRONT_IMAGE_GLARE"))
val INVALID_FILE_TYPE = StatusReason(JsonField.of("INVALID_FILE_TYPE"))
val UNKNOWN_ERROR = StatusReason(JsonField.of("UNKNOWN_ERROR"))
fun of(value: String) = StatusReason(JsonField.of(value))
}
enum class Known {
BACK_IMAGE_BLURRY,
FILE_SIZE_TOO_LARGE,
FRONT_IMAGE_BLURRY,
FRONT_IMAGE_GLARE,
INVALID_FILE_TYPE,
UNKNOWN_ERROR,
}
enum class Value {
BACK_IMAGE_BLURRY,
FILE_SIZE_TOO_LARGE,
FRONT_IMAGE_BLURRY,
FRONT_IMAGE_GLARE,
INVALID_FILE_TYPE,
UNKNOWN_ERROR,
_UNKNOWN,
}
fun value(): Value =
when (this) {
BACK_IMAGE_BLURRY -> Value.BACK_IMAGE_BLURRY
FILE_SIZE_TOO_LARGE -> Value.FILE_SIZE_TOO_LARGE
FRONT_IMAGE_BLURRY -> Value.FRONT_IMAGE_BLURRY
FRONT_IMAGE_GLARE -> Value.FRONT_IMAGE_GLARE
INVALID_FILE_TYPE -> Value.INVALID_FILE_TYPE
UNKNOWN_ERROR -> Value.UNKNOWN_ERROR
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
BACK_IMAGE_BLURRY -> Known.BACK_IMAGE_BLURRY
FILE_SIZE_TOO_LARGE -> Known.FILE_SIZE_TOO_LARGE
FRONT_IMAGE_BLURRY -> Known.FRONT_IMAGE_BLURRY
FRONT_IMAGE_GLARE -> Known.FRONT_IMAGE_GLARE
INVALID_FILE_TYPE -> Known.INVALID_FILE_TYPE
UNKNOWN_ERROR -> Known.UNKNOWN_ERROR
else -> throw LithicInvalidDataException("Unknown StatusReason: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
}
}