Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.lithic.api.models.Payment.kt Maven / Gradle / Ivy
Go to download
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.time.OffsetDateTime
import java.util.Objects
@JsonDeserialize(builder = Payment.Builder::class)
@NoAutoDetect
class Payment
private constructor(
private val category: JsonField,
private val created: JsonField,
private val currency: JsonField,
private val descriptor: JsonField,
private val events: JsonField>,
private val pendingAmount: JsonField,
private val result: JsonField,
private val settledAmount: JsonField,
private val status: JsonField,
private val token: JsonField,
private val updated: JsonField,
private val direction: JsonField,
private val financialAccountToken: JsonField,
private val externalBankAccountToken: JsonField,
private val method: JsonField,
private val methodAttributes: JsonField,
private val source: JsonField,
private val userDefinedId: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** Payment category */
fun category(): Category = category.getRequired("category")
/** Date and time when the payment first occurred. UTC time zone. */
fun created(): OffsetDateTime = created.getRequired("created")
/** 3-digit alphabetic ISO 4217 code for the settling currency of the payment. */
fun currency(): String = currency.getRequired("currency")
/** A string that provides a description of the payment; may be useful to display to users. */
fun descriptor(): String = descriptor.getRequired("descriptor")
/** A list of all payment events that have modified this payment. */
fun events(): List = events.getRequired("events")
/**
* Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of
* this field will go to zero over time once the payment is settled.
*/
fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount")
/**
* APPROVED payments were successful while DECLINED payments were declined by Lithic or
* returned.
*/
fun result(): Result = result.getRequired("result")
/**
* Amount of the payment that has been settled in the currency's smallest unit (e.g., cents).
*/
fun settledAmount(): Long = settledAmount.getRequired("settled_amount")
/**
* Status types:
* - `DECLINED` - The payment was declined.
* - `PENDING` - The payment is being processed and has yet to settle or release (origination
* debit).
* - `RETURNED` - The payment has been returned.
* - `SETTLED` - The payment is completed.
*/
fun status(): Status = status.getRequired("status")
/** Globally unique identifier. */
fun token(): String = token.getRequired("token")
/** Date and time when the financial transaction was last updated. UTC time zone. */
fun updated(): OffsetDateTime = updated.getRequired("updated")
fun direction(): Direction = direction.getRequired("direction")
fun financialAccountToken(): String =
financialAccountToken.getRequired("financial_account_token")
fun externalBankAccountToken(): String? =
externalBankAccountToken.getNullable("external_bank_account_token")
fun method(): Method = method.getRequired("method")
fun methodAttributes(): PaymentMethodAttributes =
methodAttributes.getRequired("method_attributes")
fun source(): Source = source.getRequired("source")
fun userDefinedId(): String? = userDefinedId.getNullable("user_defined_id")
/** Payment category */
@JsonProperty("category") @ExcludeMissing fun _category() = category
/** Date and time when the payment first occurred. UTC time zone. */
@JsonProperty("created") @ExcludeMissing fun _created() = created
/** 3-digit alphabetic ISO 4217 code for the settling currency of the payment. */
@JsonProperty("currency") @ExcludeMissing fun _currency() = currency
/** A string that provides a description of the payment; may be useful to display to users. */
@JsonProperty("descriptor") @ExcludeMissing fun _descriptor() = descriptor
/** A list of all payment events that have modified this payment. */
@JsonProperty("events") @ExcludeMissing fun _events() = events
/**
* Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of
* this field will go to zero over time once the payment is settled.
*/
@JsonProperty("pending_amount") @ExcludeMissing fun _pendingAmount() = pendingAmount
/**
* APPROVED payments were successful while DECLINED payments were declined by Lithic or
* returned.
*/
@JsonProperty("result") @ExcludeMissing fun _result() = result
/**
* Amount of the payment that has been settled in the currency's smallest unit (e.g., cents).
*/
@JsonProperty("settled_amount") @ExcludeMissing fun _settledAmount() = settledAmount
/**
* Status types:
* - `DECLINED` - The payment was declined.
* - `PENDING` - The payment is being processed and has yet to settle or release (origination
* debit).
* - `RETURNED` - The payment has been returned.
* - `SETTLED` - The payment is completed.
*/
@JsonProperty("status") @ExcludeMissing fun _status() = status
/** Globally unique identifier. */
@JsonProperty("token") @ExcludeMissing fun _token() = token
/** Date and time when the financial transaction was last updated. UTC time zone. */
@JsonProperty("updated") @ExcludeMissing fun _updated() = updated
@JsonProperty("direction") @ExcludeMissing fun _direction() = direction
@JsonProperty("financial_account_token")
@ExcludeMissing
fun _financialAccountToken() = financialAccountToken
@JsonProperty("external_bank_account_token")
@ExcludeMissing
fun _externalBankAccountToken() = externalBankAccountToken
@JsonProperty("method") @ExcludeMissing fun _method() = method
@JsonProperty("method_attributes") @ExcludeMissing fun _methodAttributes() = methodAttributes
@JsonProperty("source") @ExcludeMissing fun _source() = source
@JsonProperty("user_defined_id") @ExcludeMissing fun _userDefinedId() = userDefinedId
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): Payment = apply {
if (!validated) {
category()
created()
currency()
descriptor()
events().forEach { it.validate() }
pendingAmount()
result()
settledAmount()
status()
token()
updated()
direction()
financialAccountToken()
externalBankAccountToken()
method()
methodAttributes().validate()
source()
userDefinedId()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Payment &&
this.category == other.category &&
this.created == other.created &&
this.currency == other.currency &&
this.descriptor == other.descriptor &&
this.events == other.events &&
this.pendingAmount == other.pendingAmount &&
this.result == other.result &&
this.settledAmount == other.settledAmount &&
this.status == other.status &&
this.token == other.token &&
this.updated == other.updated &&
this.direction == other.direction &&
this.financialAccountToken == other.financialAccountToken &&
this.externalBankAccountToken == other.externalBankAccountToken &&
this.method == other.method &&
this.methodAttributes == other.methodAttributes &&
this.source == other.source &&
this.userDefinedId == other.userDefinedId &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
category,
created,
currency,
descriptor,
events,
pendingAmount,
result,
settledAmount,
status,
token,
updated,
direction,
financialAccountToken,
externalBankAccountToken,
method,
methodAttributes,
source,
userDefinedId,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"Payment{category=$category, created=$created, currency=$currency, descriptor=$descriptor, events=$events, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, token=$token, updated=$updated, direction=$direction, financialAccountToken=$financialAccountToken, externalBankAccountToken=$externalBankAccountToken, method=$method, methodAttributes=$methodAttributes, source=$source, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}"
companion object {
fun builder() = Builder()
}
class Builder {
private var category: JsonField = JsonMissing.of()
private var created: JsonField = JsonMissing.of()
private var currency: JsonField = JsonMissing.of()
private var descriptor: JsonField = JsonMissing.of()
private var events: JsonField> = JsonMissing.of()
private var pendingAmount: JsonField = JsonMissing.of()
private var result: JsonField = JsonMissing.of()
private var settledAmount: JsonField = JsonMissing.of()
private var status: JsonField = JsonMissing.of()
private var token: JsonField = JsonMissing.of()
private var updated: JsonField = JsonMissing.of()
private var direction: JsonField = JsonMissing.of()
private var financialAccountToken: JsonField = JsonMissing.of()
private var externalBankAccountToken: JsonField = JsonMissing.of()
private var method: JsonField = JsonMissing.of()
private var methodAttributes: JsonField = JsonMissing.of()
private var source: JsonField = JsonMissing.of()
private var userDefinedId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(payment: Payment) = apply {
this.category = payment.category
this.created = payment.created
this.currency = payment.currency
this.descriptor = payment.descriptor
this.events = payment.events
this.pendingAmount = payment.pendingAmount
this.result = payment.result
this.settledAmount = payment.settledAmount
this.status = payment.status
this.token = payment.token
this.updated = payment.updated
this.direction = payment.direction
this.financialAccountToken = payment.financialAccountToken
this.externalBankAccountToken = payment.externalBankAccountToken
this.method = payment.method
this.methodAttributes = payment.methodAttributes
this.source = payment.source
this.userDefinedId = payment.userDefinedId
additionalProperties(payment.additionalProperties)
}
/** Payment category */
fun category(category: Category) = category(JsonField.of(category))
/** Payment category */
@JsonProperty("category")
@ExcludeMissing
fun category(category: JsonField) = apply { this.category = category }
/** Date and time when the payment first occurred. UTC time zone. */
fun created(created: OffsetDateTime) = created(JsonField.of(created))
/** Date and time when the payment first occurred. UTC time zone. */
@JsonProperty("created")
@ExcludeMissing
fun created(created: JsonField) = apply { this.created = created }
/** 3-digit alphabetic ISO 4217 code for the settling currency of the payment. */
fun currency(currency: String) = currency(JsonField.of(currency))
/** 3-digit alphabetic ISO 4217 code for the settling currency of the payment. */
@JsonProperty("currency")
@ExcludeMissing
fun currency(currency: JsonField) = apply { this.currency = currency }
/**
* A string that provides a description of the payment; may be useful to display to users.
*/
fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor))
/**
* A string that provides a description of the payment; may be useful to display to users.
*/
@JsonProperty("descriptor")
@ExcludeMissing
fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor }
/** A list of all payment events that have modified this payment. */
fun events(events: List) = events(JsonField.of(events))
/** A list of all payment events that have modified this payment. */
@JsonProperty("events")
@ExcludeMissing
fun events(events: JsonField>) = apply { this.events = events }
/**
* Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of
* this field will go to zero over time once the payment is settled.
*/
fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount))
/**
* Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of
* this field will go to zero over time once the payment is settled.
*/
@JsonProperty("pending_amount")
@ExcludeMissing
fun pendingAmount(pendingAmount: JsonField) = apply {
this.pendingAmount = pendingAmount
}
/**
* APPROVED payments were successful while DECLINED payments were declined by Lithic or
* returned.
*/
fun result(result: Result) = result(JsonField.of(result))
/**
* APPROVED payments were successful while DECLINED payments were declined by Lithic or
* returned.
*/
@JsonProperty("result")
@ExcludeMissing
fun result(result: JsonField) = apply { this.result = result }
/**
* Amount of the payment that has been settled in the currency's smallest unit (e.g.,
* cents).
*/
fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))
/**
* Amount of the payment that has been settled in the currency's smallest unit (e.g.,
* cents).
*/
@JsonProperty("settled_amount")
@ExcludeMissing
fun settledAmount(settledAmount: JsonField) = apply {
this.settledAmount = settledAmount
}
/**
* Status types:
* - `DECLINED` - The payment was declined.
* - `PENDING` - The payment is being processed and has yet to settle or release
* (origination debit).
* - `RETURNED` - The payment has been returned.
* - `SETTLED` - The payment is completed.
*/
fun status(status: Status) = status(JsonField.of(status))
/**
* Status types:
* - `DECLINED` - The payment was declined.
* - `PENDING` - The payment is being processed and has yet to settle or release
* (origination debit).
* - `RETURNED` - The payment has been returned.
* - `SETTLED` - The payment is completed.
*/
@JsonProperty("status")
@ExcludeMissing
fun status(status: JsonField) = apply { this.status = status }
/** Globally unique identifier. */
fun token(token: String) = token(JsonField.of(token))
/** Globally unique identifier. */
@JsonProperty("token")
@ExcludeMissing
fun token(token: JsonField) = apply { this.token = token }
/** Date and time when the financial transaction was last updated. UTC time zone. */
fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))
/** Date and time when the financial transaction was last updated. UTC time zone. */
@JsonProperty("updated")
@ExcludeMissing
fun updated(updated: JsonField) = apply { this.updated = updated }
fun direction(direction: Direction) = direction(JsonField.of(direction))
@JsonProperty("direction")
@ExcludeMissing
fun direction(direction: JsonField) = apply { this.direction = direction }
fun financialAccountToken(financialAccountToken: String) =
financialAccountToken(JsonField.of(financialAccountToken))
@JsonProperty("financial_account_token")
@ExcludeMissing
fun financialAccountToken(financialAccountToken: JsonField) = apply {
this.financialAccountToken = financialAccountToken
}
fun externalBankAccountToken(externalBankAccountToken: String) =
externalBankAccountToken(JsonField.of(externalBankAccountToken))
@JsonProperty("external_bank_account_token")
@ExcludeMissing
fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply {
this.externalBankAccountToken = externalBankAccountToken
}
fun method(method: Method) = method(JsonField.of(method))
@JsonProperty("method")
@ExcludeMissing
fun method(method: JsonField) = apply { this.method = method }
fun methodAttributes(methodAttributes: PaymentMethodAttributes) =
methodAttributes(JsonField.of(methodAttributes))
@JsonProperty("method_attributes")
@ExcludeMissing
fun methodAttributes(methodAttributes: JsonField) = apply {
this.methodAttributes = methodAttributes
}
fun source(source: Source) = source(JsonField.of(source))
@JsonProperty("source")
@ExcludeMissing
fun source(source: JsonField) = apply { this.source = source }
fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId))
@JsonProperty("user_defined_id")
@ExcludeMissing
fun userDefinedId(userDefinedId: JsonField) = apply {
this.userDefinedId = userDefinedId
}
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(): Payment =
Payment(
category,
created,
currency,
descriptor,
events.map { it.toUnmodifiable() },
pendingAmount,
result,
settledAmount,
status,
token,
updated,
direction,
financialAccountToken,
externalBankAccountToken,
method,
methodAttributes,
source,
userDefinedId,
additionalProperties.toUnmodifiable(),
)
}
class Category
@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 Category && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val ACH = Category(JsonField.of("ACH"))
fun of(value: String) = Category(JsonField.of(value))
}
enum class Known {
ACH,
}
enum class Value {
ACH,
_UNKNOWN,
}
fun value(): Value =
when (this) {
ACH -> Value.ACH
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
ACH -> Known.ACH
else -> throw LithicInvalidDataException("Unknown Category: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class Direction
@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 Direction && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val CREDIT = Direction(JsonField.of("CREDIT"))
val DEBIT = Direction(JsonField.of("DEBIT"))
fun of(value: String) = Direction(JsonField.of(value))
}
enum class Known {
CREDIT,
DEBIT,
}
enum class Value {
CREDIT,
DEBIT,
_UNKNOWN,
}
fun value(): Value =
when (this) {
CREDIT -> Value.CREDIT
DEBIT -> Value.DEBIT
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
CREDIT -> Known.CREDIT
DEBIT -> Known.DEBIT
else -> throw LithicInvalidDataException("Unknown Direction: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
@JsonDeserialize(builder = PaymentEvent.Builder::class)
@NoAutoDetect
class PaymentEvent
private constructor(
private val amount: JsonField,
private val created: JsonField,
private val detailedResults: JsonField>,
private val result: JsonField,
private val token: JsonField,
private val type: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/**
* Amount of the financial event that has been settled in the currency's smallest unit
* (e.g., cents).
*/
fun amount(): Long = amount.getRequired("amount")
/** Date and time when the financial event occurred. UTC time zone. */
fun created(): OffsetDateTime = created.getRequired("created")
/** More detailed reasons for the event */
fun detailedResults(): List? =
detailedResults.getNullable("detailed_results")
/**
* APPROVED financial events were successful while DECLINED financial events were declined
* by user, Lithic, or the network.
*/
fun result(): Result = result.getRequired("result")
/** Globally unique identifier. */
fun token(): String = token.getRequired("token")
/**
* Event types:
* - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release
* from an ACH hold.
* - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process.
* - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled.
* - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed.
* - `ACH_ORIGINATION_SETTLED` - ACH origination has settled.
* - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available
* balance.
* - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial
* Institution.
* - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder.
* - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt.
* - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled.
* - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance.
*/
fun type(): PaymentEventType = type.getRequired("type")
/**
* Amount of the financial event that has been settled in the currency's smallest unit
* (e.g., cents).
*/
@JsonProperty("amount") @ExcludeMissing fun _amount() = amount
/** Date and time when the financial event occurred. UTC time zone. */
@JsonProperty("created") @ExcludeMissing fun _created() = created
/** More detailed reasons for the event */
@JsonProperty("detailed_results") @ExcludeMissing fun _detailedResults() = detailedResults
/**
* APPROVED financial events were successful while DECLINED financial events were declined
* by user, Lithic, or the network.
*/
@JsonProperty("result") @ExcludeMissing fun _result() = result
/** Globally unique identifier. */
@JsonProperty("token") @ExcludeMissing fun _token() = token
/**
* Event types:
* - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release
* from an ACH hold.
* - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process.
* - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled.
* - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed.
* - `ACH_ORIGINATION_SETTLED` - ACH origination has settled.
* - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available
* balance.
* - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial
* Institution.
* - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder.
* - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt.
* - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled.
* - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance.
*/
@JsonProperty("type") @ExcludeMissing fun _type() = type
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): PaymentEvent = apply {
if (!validated) {
amount()
created()
detailedResults()
result()
token()
type()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is PaymentEvent &&
this.amount == other.amount &&
this.created == other.created &&
this.detailedResults == other.detailedResults &&
this.result == other.result &&
this.token == other.token &&
this.type == other.type &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
amount,
created,
detailedResults,
result,
token,
type,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"PaymentEvent{amount=$amount, created=$created, detailedResults=$detailedResults, result=$result, token=$token, type=$type, additionalProperties=$additionalProperties}"
companion object {
fun builder() = Builder()
}
class Builder {
private var amount: JsonField = JsonMissing.of()
private var created: JsonField = JsonMissing.of()
private var detailedResults: JsonField> = JsonMissing.of()
private var result: JsonField = JsonMissing.of()
private var token: JsonField = JsonMissing.of()
private var type: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(paymentEvent: PaymentEvent) = apply {
this.amount = paymentEvent.amount
this.created = paymentEvent.created
this.detailedResults = paymentEvent.detailedResults
this.result = paymentEvent.result
this.token = paymentEvent.token
this.type = paymentEvent.type
additionalProperties(paymentEvent.additionalProperties)
}
/**
* Amount of the financial event that has been settled in the currency's smallest unit
* (e.g., cents).
*/
fun amount(amount: Long) = amount(JsonField.of(amount))
/**
* Amount of the financial event that has been settled in the currency's smallest unit
* (e.g., cents).
*/
@JsonProperty("amount")
@ExcludeMissing
fun amount(amount: JsonField) = apply { this.amount = amount }
/** Date and time when the financial event occurred. UTC time zone. */
fun created(created: OffsetDateTime) = created(JsonField.of(created))
/** Date and time when the financial event occurred. UTC time zone. */
@JsonProperty("created")
@ExcludeMissing
fun created(created: JsonField) = apply { this.created = created }
/** More detailed reasons for the event */
fun detailedResults(detailedResults: List) =
detailedResults(JsonField.of(detailedResults))
/** More detailed reasons for the event */
@JsonProperty("detailed_results")
@ExcludeMissing
fun detailedResults(detailedResults: JsonField>) = apply {
this.detailedResults = detailedResults
}
/**
* APPROVED financial events were successful while DECLINED financial events were
* declined by user, Lithic, or the network.
*/
fun result(result: Result) = result(JsonField.of(result))
/**
* APPROVED financial events were successful while DECLINED financial events were
* declined by user, Lithic, or the network.
*/
@JsonProperty("result")
@ExcludeMissing
fun result(result: JsonField) = apply { this.result = result }
/** Globally unique identifier. */
fun token(token: String) = token(JsonField.of(token))
/** Globally unique identifier. */
@JsonProperty("token")
@ExcludeMissing
fun token(token: JsonField) = apply { this.token = token }
/**
* Event types:
* - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release
* from an ACH hold.
* - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process.
* - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled.
* - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the
* fed.
* - `ACH_ORIGINATION_SETTLED` - ACH origination has settled.
* - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available
* balance.
* - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository
* Financial Institution.
* - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder.
* - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt.
* - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled.
* - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance.
*/
fun type(type: PaymentEventType) = type(JsonField.of(type))
/**
* Event types:
* - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release
* from an ACH hold.
* - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process.
* - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled.
* - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the
* fed.
* - `ACH_ORIGINATION_SETTLED` - ACH origination has settled.
* - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available
* balance.
* - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository
* Financial Institution.
* - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder.
* - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt.
* - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled.
* - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance.
*/
@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField) = apply { this.type = type }
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(): PaymentEvent =
PaymentEvent(
amount,
created,
detailedResults.map { it.toUnmodifiable() },
result,
token,
type,
additionalProperties.toUnmodifiable(),
)
}
class Result
@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 Result && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val APPROVED = Result(JsonField.of("APPROVED"))
val DECLINED = Result(JsonField.of("DECLINED"))
fun of(value: String) = Result(JsonField.of(value))
}
enum class Known {
APPROVED,
DECLINED,
}
enum class Value {
APPROVED,
DECLINED,
_UNKNOWN,
}
fun value(): Value =
when (this) {
APPROVED -> Value.APPROVED
DECLINED -> Value.DECLINED
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
APPROVED -> Known.APPROVED
DECLINED -> Known.DECLINED
else -> throw LithicInvalidDataException("Unknown Result: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class PaymentEventType
@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 PaymentEventType && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val ACH_ORIGINATION_CANCELLED =
PaymentEventType(JsonField.of("ACH_ORIGINATION_CANCELLED"))
val ACH_ORIGINATION_INITIATED =
PaymentEventType(JsonField.of("ACH_ORIGINATION_INITIATED"))
val ACH_ORIGINATION_PROCESSED =
PaymentEventType(JsonField.of("ACH_ORIGINATION_PROCESSED"))
val ACH_ORIGINATION_SETTLED =
PaymentEventType(JsonField.of("ACH_ORIGINATION_SETTLED"))
val ACH_ORIGINATION_RELEASED =
PaymentEventType(JsonField.of("ACH_ORIGINATION_RELEASED"))
val ACH_ORIGINATION_REVIEWED =
PaymentEventType(JsonField.of("ACH_ORIGINATION_REVIEWED"))
val ACH_RECEIPT_PROCESSED = PaymentEventType(JsonField.of("ACH_RECEIPT_PROCESSED"))
val ACH_RECEIPT_SETTLED = PaymentEventType(JsonField.of("ACH_RECEIPT_SETTLED"))
val ACH_RETURN_INITIATED = PaymentEventType(JsonField.of("ACH_RETURN_INITIATED"))
val ACH_RETURN_PROCESSED = PaymentEventType(JsonField.of("ACH_RETURN_PROCESSED"))
fun of(value: String) = PaymentEventType(JsonField.of(value))
}
enum class Known {
ACH_ORIGINATION_CANCELLED,
ACH_ORIGINATION_INITIATED,
ACH_ORIGINATION_PROCESSED,
ACH_ORIGINATION_SETTLED,
ACH_ORIGINATION_RELEASED,
ACH_ORIGINATION_REVIEWED,
ACH_RECEIPT_PROCESSED,
ACH_RECEIPT_SETTLED,
ACH_RETURN_INITIATED,
ACH_RETURN_PROCESSED,
}
enum class Value {
ACH_ORIGINATION_CANCELLED,
ACH_ORIGINATION_INITIATED,
ACH_ORIGINATION_PROCESSED,
ACH_ORIGINATION_SETTLED,
ACH_ORIGINATION_RELEASED,
ACH_ORIGINATION_REVIEWED,
ACH_RECEIPT_PROCESSED,
ACH_RECEIPT_SETTLED,
ACH_RETURN_INITIATED,
ACH_RETURN_PROCESSED,
_UNKNOWN,
}
fun value(): Value =
when (this) {
ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED
ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED
ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED
ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED
ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED
ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED
ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED
ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED
ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED
ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED
ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED
ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED
ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED
ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED
ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED
ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED
ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED
ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED
ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED
else -> throw LithicInvalidDataException("Unknown PaymentEventType: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class DetailedResult
@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 DetailedResult && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val APPROVED = DetailedResult(JsonField.of("APPROVED"))
val FUNDS_INSUFFICIENT = DetailedResult(JsonField.of("FUNDS_INSUFFICIENT"))
val ACCOUNT_INVALID = DetailedResult(JsonField.of("ACCOUNT_INVALID"))
val PROGRAM_TRANSACTION_LIMIT_EXCEEDED =
DetailedResult(JsonField.of("PROGRAM_TRANSACTION_LIMIT_EXCEEDED"))
val PROGRAM_DAILY_LIMIT_EXCEEDED =
DetailedResult(JsonField.of("PROGRAM_DAILY_LIMIT_EXCEEDED"))
val PROGRAM_MONTHLY_LIMIT_EXCEEDED =
DetailedResult(JsonField.of("PROGRAM_MONTHLY_LIMIT_EXCEEDED"))
fun of(value: String) = DetailedResult(JsonField.of(value))
}
enum class Known {
APPROVED,
FUNDS_INSUFFICIENT,
ACCOUNT_INVALID,
PROGRAM_TRANSACTION_LIMIT_EXCEEDED,
PROGRAM_DAILY_LIMIT_EXCEEDED,
PROGRAM_MONTHLY_LIMIT_EXCEEDED,
}
enum class Value {
APPROVED,
FUNDS_INSUFFICIENT,
ACCOUNT_INVALID,
PROGRAM_TRANSACTION_LIMIT_EXCEEDED,
PROGRAM_DAILY_LIMIT_EXCEEDED,
PROGRAM_MONTHLY_LIMIT_EXCEEDED,
_UNKNOWN,
}
fun value(): Value =
when (this) {
APPROVED -> Value.APPROVED
FUNDS_INSUFFICIENT -> Value.FUNDS_INSUFFICIENT
ACCOUNT_INVALID -> Value.ACCOUNT_INVALID
PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> Value.PROGRAM_TRANSACTION_LIMIT_EXCEEDED
PROGRAM_DAILY_LIMIT_EXCEEDED -> Value.PROGRAM_DAILY_LIMIT_EXCEEDED
PROGRAM_MONTHLY_LIMIT_EXCEEDED -> Value.PROGRAM_MONTHLY_LIMIT_EXCEEDED
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
APPROVED -> Known.APPROVED
FUNDS_INSUFFICIENT -> Known.FUNDS_INSUFFICIENT
ACCOUNT_INVALID -> Known.ACCOUNT_INVALID
PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> Known.PROGRAM_TRANSACTION_LIMIT_EXCEEDED
PROGRAM_DAILY_LIMIT_EXCEEDED -> Known.PROGRAM_DAILY_LIMIT_EXCEEDED
PROGRAM_MONTHLY_LIMIT_EXCEEDED -> Known.PROGRAM_MONTHLY_LIMIT_EXCEEDED
else -> throw LithicInvalidDataException("Unknown DetailedResult: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
}
class Method
@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 Method && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val ACH_NEXT_DAY = Method(JsonField.of("ACH_NEXT_DAY"))
val ACH_SAME_DAY = Method(JsonField.of("ACH_SAME_DAY"))
fun of(value: String) = Method(JsonField.of(value))
}
enum class Known {
ACH_NEXT_DAY,
ACH_SAME_DAY,
}
enum class Value {
ACH_NEXT_DAY,
ACH_SAME_DAY,
_UNKNOWN,
}
fun value(): Value =
when (this) {
ACH_NEXT_DAY -> Value.ACH_NEXT_DAY
ACH_SAME_DAY -> Value.ACH_SAME_DAY
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
ACH_NEXT_DAY -> Known.ACH_NEXT_DAY
ACH_SAME_DAY -> Known.ACH_SAME_DAY
else -> throw LithicInvalidDataException("Unknown Method: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
@JsonDeserialize(builder = PaymentMethodAttributes.Builder::class)
@NoAutoDetect
class PaymentMethodAttributes
private constructor(
private val companyId: JsonField,
private val receiptRoutingNumber: JsonField,
private val retries: JsonField,
private val returnReasonCode: JsonField,
private val secCode: JsonField,
private val traceNumbers: JsonField>,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
fun companyId(): String? = companyId.getNullable("company_id")
fun receiptRoutingNumber(): String? =
receiptRoutingNumber.getNullable("receipt_routing_number")
fun retries(): Long? = retries.getNullable("retries")
fun returnReasonCode(): String? = returnReasonCode.getNullable("return_reason_code")
fun secCode(): SecCode = secCode.getRequired("sec_code")
fun traceNumbers(): List = traceNumbers.getRequired("trace_numbers")
@JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId
@JsonProperty("receipt_routing_number")
@ExcludeMissing
fun _receiptRoutingNumber() = receiptRoutingNumber
@JsonProperty("retries") @ExcludeMissing fun _retries() = retries
@JsonProperty("return_reason_code")
@ExcludeMissing
fun _returnReasonCode() = returnReasonCode
@JsonProperty("sec_code") @ExcludeMissing fun _secCode() = secCode
@JsonProperty("trace_numbers") @ExcludeMissing fun _traceNumbers() = traceNumbers
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): PaymentMethodAttributes = apply {
if (!validated) {
companyId()
receiptRoutingNumber()
retries()
returnReasonCode()
secCode()
traceNumbers()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is PaymentMethodAttributes &&
this.companyId == other.companyId &&
this.receiptRoutingNumber == other.receiptRoutingNumber &&
this.retries == other.retries &&
this.returnReasonCode == other.returnReasonCode &&
this.secCode == other.secCode &&
this.traceNumbers == other.traceNumbers &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
companyId,
receiptRoutingNumber,
retries,
returnReasonCode,
secCode,
traceNumbers,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"PaymentMethodAttributes{companyId=$companyId, receiptRoutingNumber=$receiptRoutingNumber, retries=$retries, returnReasonCode=$returnReasonCode, secCode=$secCode, traceNumbers=$traceNumbers, additionalProperties=$additionalProperties}"
companion object {
fun builder() = Builder()
}
class Builder {
private var companyId: JsonField = JsonMissing.of()
private var receiptRoutingNumber: JsonField = JsonMissing.of()
private var retries: JsonField = JsonMissing.of()
private var returnReasonCode: JsonField = JsonMissing.of()
private var secCode: JsonField = JsonMissing.of()
private var traceNumbers: JsonField> = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(paymentMethodAttributes: PaymentMethodAttributes) = apply {
this.companyId = paymentMethodAttributes.companyId
this.receiptRoutingNumber = paymentMethodAttributes.receiptRoutingNumber
this.retries = paymentMethodAttributes.retries
this.returnReasonCode = paymentMethodAttributes.returnReasonCode
this.secCode = paymentMethodAttributes.secCode
this.traceNumbers = paymentMethodAttributes.traceNumbers
additionalProperties(paymentMethodAttributes.additionalProperties)
}
fun companyId(companyId: String) = companyId(JsonField.of(companyId))
@JsonProperty("company_id")
@ExcludeMissing
fun companyId(companyId: JsonField) = apply { this.companyId = companyId }
fun receiptRoutingNumber(receiptRoutingNumber: String) =
receiptRoutingNumber(JsonField.of(receiptRoutingNumber))
@JsonProperty("receipt_routing_number")
@ExcludeMissing
fun receiptRoutingNumber(receiptRoutingNumber: JsonField) = apply {
this.receiptRoutingNumber = receiptRoutingNumber
}
fun retries(retries: Long) = retries(JsonField.of(retries))
@JsonProperty("retries")
@ExcludeMissing
fun retries(retries: JsonField) = apply { this.retries = retries }
fun returnReasonCode(returnReasonCode: String) =
returnReasonCode(JsonField.of(returnReasonCode))
@JsonProperty("return_reason_code")
@ExcludeMissing
fun returnReasonCode(returnReasonCode: JsonField) = apply {
this.returnReasonCode = returnReasonCode
}
fun secCode(secCode: SecCode) = secCode(JsonField.of(secCode))
@JsonProperty("sec_code")
@ExcludeMissing
fun secCode(secCode: JsonField) = apply { this.secCode = secCode }
fun traceNumbers(traceNumbers: List) = traceNumbers(JsonField.of(traceNumbers))
@JsonProperty("trace_numbers")
@ExcludeMissing
fun traceNumbers(traceNumbers: JsonField>) = apply {
this.traceNumbers = traceNumbers
}
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(): PaymentMethodAttributes =
PaymentMethodAttributes(
companyId,
receiptRoutingNumber,
retries,
returnReasonCode,
secCode,
traceNumbers.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable(),
)
}
class SecCode
@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 SecCode && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val CCD = SecCode(JsonField.of("CCD"))
val PPD = SecCode(JsonField.of("PPD"))
val WEB = SecCode(JsonField.of("WEB"))
fun of(value: String) = SecCode(JsonField.of(value))
}
enum class Known {
CCD,
PPD,
WEB,
}
enum class Value {
CCD,
PPD,
WEB,
_UNKNOWN,
}
fun value(): Value =
when (this) {
CCD -> Value.CCD
PPD -> Value.PPD
WEB -> Value.WEB
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
CCD -> Known.CCD
PPD -> Known.PPD
WEB -> Known.WEB
else -> throw LithicInvalidDataException("Unknown SecCode: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
}
class Result
@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 Result && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val APPROVED = Result(JsonField.of("APPROVED"))
val DECLINED = Result(JsonField.of("DECLINED"))
fun of(value: String) = Result(JsonField.of(value))
}
enum class Known {
APPROVED,
DECLINED,
}
enum class Value {
APPROVED,
DECLINED,
_UNKNOWN,
}
fun value(): Value =
when (this) {
APPROVED -> Value.APPROVED
DECLINED -> Value.DECLINED
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
APPROVED -> Known.APPROVED
DECLINED -> Known.DECLINED
else -> throw LithicInvalidDataException("Unknown Result: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class Source
@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 Source && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val CUSTOMER = Source(JsonField.of("CUSTOMER"))
val LITHIC = Source(JsonField.of("LITHIC"))
fun of(value: String) = Source(JsonField.of(value))
}
enum class Known {
CUSTOMER,
LITHIC,
}
enum class Value {
CUSTOMER,
LITHIC,
_UNKNOWN,
}
fun value(): Value =
when (this) {
CUSTOMER -> Value.CUSTOMER
LITHIC -> Value.LITHIC
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
CUSTOMER -> Known.CUSTOMER
LITHIC -> Known.LITHIC
else -> throw LithicInvalidDataException("Unknown Source: $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 DECLINED = Status(JsonField.of("DECLINED"))
val PENDING = Status(JsonField.of("PENDING"))
val RETURNED = Status(JsonField.of("RETURNED"))
val SETTLED = Status(JsonField.of("SETTLED"))
fun of(value: String) = Status(JsonField.of(value))
}
enum class Known {
DECLINED,
PENDING,
RETURNED,
SETTLED,
}
enum class Value {
DECLINED,
PENDING,
RETURNED,
SETTLED,
_UNKNOWN,
}
fun value(): Value =
when (this) {
DECLINED -> Value.DECLINED
PENDING -> Value.PENDING
RETURNED -> Value.RETURNED
SETTLED -> Value.SETTLED
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
DECLINED -> Known.DECLINED
PENDING -> Known.PENDING
RETURNED -> Known.RETURNED
SETTLED -> Known.SETTLED
else -> throw LithicInvalidDataException("Unknown Status: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
}