All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lithic.api.models.ManagementOperationTransaction.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.

The newest version!
// 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.toImmutable
import com.lithic.api.errors.LithicInvalidDataException
import java.time.LocalDate
import java.time.OffsetDateTime
import java.util.Objects

@JsonDeserialize(builder = ManagementOperationTransaction.Builder::class)
@NoAutoDetect
class ManagementOperationTransaction
private constructor(
    private val token: JsonField,
    private val result: JsonField,
    private val category: JsonField,
    private val status: JsonField,
    private val settledAmount: JsonField,
    private val pendingAmount: JsonField,
    private val currency: JsonField,
    private val events: JsonField>,
    private val created: JsonField,
    private val updated: JsonField,
    private val userDefinedId: JsonField,
    private val financialAccountToken: JsonField,
    private val direction: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    fun token(): String = token.getRequired("token")

    fun result(): TransactionResult = result.getRequired("result")

    fun category(): ManagementOperationCategory = category.getRequired("category")

    fun status(): TransactionStatus = status.getRequired("status")

    fun settledAmount(): Long = settledAmount.getRequired("settled_amount")

    fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount")

    fun currency(): String = currency.getRequired("currency")

    fun events(): List = events.getRequired("events")

    fun created(): OffsetDateTime = created.getRequired("created")

    fun updated(): OffsetDateTime = updated.getRequired("updated")

    fun userDefinedId(): String? = userDefinedId.getNullable("user_defined_id")

    fun financialAccountToken(): String =
        financialAccountToken.getRequired("financial_account_token")

    fun direction(): ManagementOperationDirection = direction.getRequired("direction")

    @JsonProperty("token") @ExcludeMissing fun _token() = token

    @JsonProperty("result") @ExcludeMissing fun _result() = result

    @JsonProperty("category") @ExcludeMissing fun _category() = category

    @JsonProperty("status") @ExcludeMissing fun _status() = status

    @JsonProperty("settled_amount") @ExcludeMissing fun _settledAmount() = settledAmount

    @JsonProperty("pending_amount") @ExcludeMissing fun _pendingAmount() = pendingAmount

    @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

    @JsonProperty("events") @ExcludeMissing fun _events() = events

    @JsonProperty("created") @ExcludeMissing fun _created() = created

    @JsonProperty("updated") @ExcludeMissing fun _updated() = updated

    @JsonProperty("user_defined_id") @ExcludeMissing fun _userDefinedId() = userDefinedId

    @JsonProperty("financial_account_token")
    @ExcludeMissing
    fun _financialAccountToken() = financialAccountToken

    @JsonProperty("direction") @ExcludeMissing fun _direction() = direction

    @JsonAnyGetter
    @ExcludeMissing
    fun _additionalProperties(): Map = additionalProperties

    fun validate(): ManagementOperationTransaction = apply {
        if (!validated) {
            token()
            result()
            category()
            status()
            settledAmount()
            pendingAmount()
            currency()
            events().forEach { it.validate() }
            created()
            updated()
            userDefinedId()
            financialAccountToken()
            direction()
            validated = true
        }
    }

    fun toBuilder() = Builder().from(this)

    companion object {

        fun builder() = Builder()
    }

    class Builder {

        private var token: JsonField = JsonMissing.of()
        private var result: JsonField = JsonMissing.of()
        private var category: JsonField = JsonMissing.of()
        private var status: JsonField = JsonMissing.of()
        private var settledAmount: JsonField = JsonMissing.of()
        private var pendingAmount: JsonField = JsonMissing.of()
        private var currency: JsonField = JsonMissing.of()
        private var events: JsonField> = JsonMissing.of()
        private var created: JsonField = JsonMissing.of()
        private var updated: JsonField = JsonMissing.of()
        private var userDefinedId: JsonField = JsonMissing.of()
        private var financialAccountToken: JsonField = JsonMissing.of()
        private var direction: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        internal fun from(managementOperationTransaction: ManagementOperationTransaction) = apply {
            this.token = managementOperationTransaction.token
            this.result = managementOperationTransaction.result
            this.category = managementOperationTransaction.category
            this.status = managementOperationTransaction.status
            this.settledAmount = managementOperationTransaction.settledAmount
            this.pendingAmount = managementOperationTransaction.pendingAmount
            this.currency = managementOperationTransaction.currency
            this.events = managementOperationTransaction.events
            this.created = managementOperationTransaction.created
            this.updated = managementOperationTransaction.updated
            this.userDefinedId = managementOperationTransaction.userDefinedId
            this.financialAccountToken = managementOperationTransaction.financialAccountToken
            this.direction = managementOperationTransaction.direction
            additionalProperties(managementOperationTransaction.additionalProperties)
        }

        fun token(token: String) = token(JsonField.of(token))

        @JsonProperty("token")
        @ExcludeMissing
        fun token(token: JsonField) = apply { this.token = token }

        fun result(result: TransactionResult) = result(JsonField.of(result))

        @JsonProperty("result")
        @ExcludeMissing
        fun result(result: JsonField) = apply { this.result = result }

        fun category(category: ManagementOperationCategory) = category(JsonField.of(category))

        @JsonProperty("category")
        @ExcludeMissing
        fun category(category: JsonField) = apply {
            this.category = category
        }

        fun status(status: TransactionStatus) = status(JsonField.of(status))

        @JsonProperty("status")
        @ExcludeMissing
        fun status(status: JsonField) = apply { this.status = status }

        fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))

        @JsonProperty("settled_amount")
        @ExcludeMissing
        fun settledAmount(settledAmount: JsonField) = apply {
            this.settledAmount = settledAmount
        }

        fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount))

        @JsonProperty("pending_amount")
        @ExcludeMissing
        fun pendingAmount(pendingAmount: JsonField) = apply {
            this.pendingAmount = pendingAmount
        }

        fun currency(currency: String) = currency(JsonField.of(currency))

        @JsonProperty("currency")
        @ExcludeMissing
        fun currency(currency: JsonField) = apply { this.currency = currency }

        fun events(events: List) = events(JsonField.of(events))

        @JsonProperty("events")
        @ExcludeMissing
        fun events(events: JsonField>) = apply {
            this.events = events
        }

        fun created(created: OffsetDateTime) = created(JsonField.of(created))

        @JsonProperty("created")
        @ExcludeMissing
        fun created(created: JsonField) = apply { this.created = created }

        fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))

        @JsonProperty("updated")
        @ExcludeMissing
        fun updated(updated: JsonField) = apply { this.updated = updated }

        fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId))

        @JsonProperty("user_defined_id")
        @ExcludeMissing
        fun userDefinedId(userDefinedId: JsonField) = apply {
            this.userDefinedId = userDefinedId
        }

        fun financialAccountToken(financialAccountToken: String) =
            financialAccountToken(JsonField.of(financialAccountToken))

        @JsonProperty("financial_account_token")
        @ExcludeMissing
        fun financialAccountToken(financialAccountToken: JsonField) = apply {
            this.financialAccountToken = financialAccountToken
        }

        fun direction(direction: ManagementOperationDirection) = direction(JsonField.of(direction))

        @JsonProperty("direction")
        @ExcludeMissing
        fun direction(direction: JsonField) = apply {
            this.direction = direction
        }

        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(): ManagementOperationTransaction =
            ManagementOperationTransaction(
                token,
                result,
                category,
                status,
                settledAmount,
                pendingAmount,
                currency,
                events.map { it.toImmutable() },
                created,
                updated,
                userDefinedId,
                financialAccountToken,
                direction,
                additionalProperties.toImmutable(),
            )
    }

    class ManagementOperationCategory
    @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 /* spotless:off */ other is ManagementOperationCategory && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val MANAGEMENT_FEE = ManagementOperationCategory(JsonField.of("MANAGEMENT_FEE"))

            val MANAGEMENT_DISPUTE = ManagementOperationCategory(JsonField.of("MANAGEMENT_DISPUTE"))

            val MANAGEMENT_REWARD = ManagementOperationCategory(JsonField.of("MANAGEMENT_REWARD"))

            val MANAGEMENT_ADJUSTMENT =
                ManagementOperationCategory(JsonField.of("MANAGEMENT_ADJUSTMENT"))

            fun of(value: String) = ManagementOperationCategory(JsonField.of(value))
        }

        enum class Known {
            MANAGEMENT_FEE,
            MANAGEMENT_DISPUTE,
            MANAGEMENT_REWARD,
            MANAGEMENT_ADJUSTMENT,
        }

        enum class Value {
            MANAGEMENT_FEE,
            MANAGEMENT_DISPUTE,
            MANAGEMENT_REWARD,
            MANAGEMENT_ADJUSTMENT,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                MANAGEMENT_FEE -> Value.MANAGEMENT_FEE
                MANAGEMENT_DISPUTE -> Value.MANAGEMENT_DISPUTE
                MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD
                MANAGEMENT_ADJUSTMENT -> Value.MANAGEMENT_ADJUSTMENT
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                MANAGEMENT_FEE -> Known.MANAGEMENT_FEE
                MANAGEMENT_DISPUTE -> Known.MANAGEMENT_DISPUTE
                MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD
                MANAGEMENT_ADJUSTMENT -> Known.MANAGEMENT_ADJUSTMENT
                else ->
                    throw LithicInvalidDataException("Unknown ManagementOperationCategory: $value")
            }

        fun asString(): String = _value().asStringOrThrow()
    }

    class ManagementOperationDirection
    @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 /* spotless:off */ other is ManagementOperationDirection && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val CREDIT = ManagementOperationDirection(JsonField.of("CREDIT"))

            val DEBIT = ManagementOperationDirection(JsonField.of("DEBIT"))

            fun of(value: String) = ManagementOperationDirection(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 ManagementOperationDirection: $value")
            }

        fun asString(): String = _value().asStringOrThrow()
    }

    @JsonDeserialize(builder = ManagementOperationEvent.Builder::class)
    @NoAutoDetect
    class ManagementOperationEvent
    private constructor(
        private val amount: JsonField,
        private val type: JsonField,
        private val subtype: JsonField,
        private val result: JsonField,
        private val detailedResults: JsonField>,
        private val created: JsonField,
        private val token: JsonField,
        private val memo: JsonField,
        private val effectiveDate: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        fun amount(): Long = amount.getRequired("amount")

        fun type(): ManagementOperationEventType = type.getRequired("type")

        fun subtype(): String? = subtype.getNullable("subtype")

        fun result(): TransactionResult = result.getRequired("result")

        fun detailedResults(): List =
            detailedResults.getRequired("detailed_results")

        fun created(): OffsetDateTime = created.getRequired("created")

        fun token(): String = token.getRequired("token")

        fun memo(): String = memo.getRequired("memo")

        fun effectiveDate(): LocalDate = effectiveDate.getRequired("effective_date")

        @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

        @JsonProperty("type") @ExcludeMissing fun _type() = type

        @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype

        @JsonProperty("result") @ExcludeMissing fun _result() = result

        @JsonProperty("detailed_results") @ExcludeMissing fun _detailedResults() = detailedResults

        @JsonProperty("created") @ExcludeMissing fun _created() = created

        @JsonProperty("token") @ExcludeMissing fun _token() = token

        @JsonProperty("memo") @ExcludeMissing fun _memo() = memo

        @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): ManagementOperationEvent = apply {
            if (!validated) {
                amount()
                type()
                subtype()
                result()
                detailedResults()
                created()
                token()
                memo()
                effectiveDate()
                validated = true
            }
        }

        fun toBuilder() = Builder().from(this)

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var amount: JsonField = JsonMissing.of()
            private var type: JsonField = JsonMissing.of()
            private var subtype: JsonField = JsonMissing.of()
            private var result: JsonField = JsonMissing.of()
            private var detailedResults: JsonField> = JsonMissing.of()
            private var created: JsonField = JsonMissing.of()
            private var token: JsonField = JsonMissing.of()
            private var memo: JsonField = JsonMissing.of()
            private var effectiveDate: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(managementOperationEvent: ManagementOperationEvent) = apply {
                this.amount = managementOperationEvent.amount
                this.type = managementOperationEvent.type
                this.subtype = managementOperationEvent.subtype
                this.result = managementOperationEvent.result
                this.detailedResults = managementOperationEvent.detailedResults
                this.created = managementOperationEvent.created
                this.token = managementOperationEvent.token
                this.memo = managementOperationEvent.memo
                this.effectiveDate = managementOperationEvent.effectiveDate
                additionalProperties(managementOperationEvent.additionalProperties)
            }

            fun amount(amount: Long) = amount(JsonField.of(amount))

            @JsonProperty("amount")
            @ExcludeMissing
            fun amount(amount: JsonField) = apply { this.amount = amount }

            fun type(type: ManagementOperationEventType) = type(JsonField.of(type))

            @JsonProperty("type")
            @ExcludeMissing
            fun type(type: JsonField) = apply { this.type = type }

            fun subtype(subtype: String) = subtype(JsonField.of(subtype))

            @JsonProperty("subtype")
            @ExcludeMissing
            fun subtype(subtype: JsonField) = apply { this.subtype = subtype }

            fun result(result: TransactionResult) = result(JsonField.of(result))

            @JsonProperty("result")
            @ExcludeMissing
            fun result(result: JsonField) = apply { this.result = result }

            fun detailedResults(detailedResults: List) =
                detailedResults(JsonField.of(detailedResults))

            @JsonProperty("detailed_results")
            @ExcludeMissing
            fun detailedResults(detailedResults: JsonField>) = apply {
                this.detailedResults = detailedResults
            }

            fun created(created: OffsetDateTime) = created(JsonField.of(created))

            @JsonProperty("created")
            @ExcludeMissing
            fun created(created: JsonField) = apply { this.created = created }

            fun token(token: String) = token(JsonField.of(token))

            @JsonProperty("token")
            @ExcludeMissing
            fun token(token: JsonField) = apply { this.token = token }

            fun memo(memo: String) = memo(JsonField.of(memo))

            @JsonProperty("memo")
            @ExcludeMissing
            fun memo(memo: JsonField) = apply { this.memo = memo }

            fun effectiveDate(effectiveDate: LocalDate) = effectiveDate(JsonField.of(effectiveDate))

            @JsonProperty("effective_date")
            @ExcludeMissing
            fun effectiveDate(effectiveDate: JsonField) = apply {
                this.effectiveDate = effectiveDate
            }

            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(): ManagementOperationEvent =
                ManagementOperationEvent(
                    amount,
                    type,
                    subtype,
                    result,
                    detailedResults.map { it.toImmutable() },
                    created,
                    token,
                    memo,
                    effectiveDate,
                    additionalProperties.toImmutable(),
                )
        }

        class DetailedResults
        @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 /* spotless:off */ other is DetailedResults && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val APPROVED = DetailedResults(JsonField.of("APPROVED"))

                fun of(value: String) = DetailedResults(JsonField.of(value))
            }

            enum class Known {
                APPROVED,
            }

            enum class Value {
                APPROVED,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    APPROVED -> Value.APPROVED
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    APPROVED -> Known.APPROVED
                    else -> throw LithicInvalidDataException("Unknown DetailedResults: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class TransactionResult
        @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 /* spotless:off */ other is TransactionResult && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val APPROVED = TransactionResult(JsonField.of("APPROVED"))

                val DECLINED = TransactionResult(JsonField.of("DECLINED"))

                fun of(value: String) = TransactionResult(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 TransactionResult: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class ManagementOperationEventType
        @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 /* spotless:off */ other is ManagementOperationEventType && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val CASH_BACK = ManagementOperationEventType(JsonField.of("CASH_BACK"))

                val CURRENCY_CONVERSION =
                    ManagementOperationEventType(JsonField.of("CURRENCY_CONVERSION"))

                val INTEREST = ManagementOperationEventType(JsonField.of("INTEREST"))

                val LATE_PAYMENT = ManagementOperationEventType(JsonField.of("LATE_PAYMENT"))

                val BILLING_ERROR = ManagementOperationEventType(JsonField.of("BILLING_ERROR"))

                val PROVISIONAL_CREDIT =
                    ManagementOperationEventType(JsonField.of("PROVISIONAL_CREDIT"))

                val CASH_BACK_REVERSAL =
                    ManagementOperationEventType(JsonField.of("CASH_BACK_REVERSAL"))

                val CURRENCY_CONVERSION_REVERSAL =
                    ManagementOperationEventType(JsonField.of("CURRENCY_CONVERSION_REVERSAL"))

                val INTEREST_REVERSAL =
                    ManagementOperationEventType(JsonField.of("INTEREST_REVERSAL"))

                val LATE_PAYMENT_REVERSAL =
                    ManagementOperationEventType(JsonField.of("LATE_PAYMENT_REVERSAL"))

                val BILLING_ERROR_REVERSAL =
                    ManagementOperationEventType(JsonField.of("BILLING_ERROR_REVERSAL"))

                val PROVISIONAL_CREDIT_REVERSAL =
                    ManagementOperationEventType(JsonField.of("PROVISIONAL_CREDIT_REVERSAL"))

                fun of(value: String) = ManagementOperationEventType(JsonField.of(value))
            }

            enum class Known {
                CASH_BACK,
                CURRENCY_CONVERSION,
                INTEREST,
                LATE_PAYMENT,
                BILLING_ERROR,
                PROVISIONAL_CREDIT,
                CASH_BACK_REVERSAL,
                CURRENCY_CONVERSION_REVERSAL,
                INTEREST_REVERSAL,
                LATE_PAYMENT_REVERSAL,
                BILLING_ERROR_REVERSAL,
                PROVISIONAL_CREDIT_REVERSAL,
            }

            enum class Value {
                CASH_BACK,
                CURRENCY_CONVERSION,
                INTEREST,
                LATE_PAYMENT,
                BILLING_ERROR,
                PROVISIONAL_CREDIT,
                CASH_BACK_REVERSAL,
                CURRENCY_CONVERSION_REVERSAL,
                INTEREST_REVERSAL,
                LATE_PAYMENT_REVERSAL,
                BILLING_ERROR_REVERSAL,
                PROVISIONAL_CREDIT_REVERSAL,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    CASH_BACK -> Value.CASH_BACK
                    CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION
                    INTEREST -> Value.INTEREST
                    LATE_PAYMENT -> Value.LATE_PAYMENT
                    BILLING_ERROR -> Value.BILLING_ERROR
                    PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
                    CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL
                    CURRENCY_CONVERSION_REVERSAL -> Value.CURRENCY_CONVERSION_REVERSAL
                    INTEREST_REVERSAL -> Value.INTEREST_REVERSAL
                    LATE_PAYMENT_REVERSAL -> Value.LATE_PAYMENT_REVERSAL
                    BILLING_ERROR_REVERSAL -> Value.BILLING_ERROR_REVERSAL
                    PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    CASH_BACK -> Known.CASH_BACK
                    CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION
                    INTEREST -> Known.INTEREST
                    LATE_PAYMENT -> Known.LATE_PAYMENT
                    BILLING_ERROR -> Known.BILLING_ERROR
                    PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
                    CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL
                    CURRENCY_CONVERSION_REVERSAL -> Known.CURRENCY_CONVERSION_REVERSAL
                    INTEREST_REVERSAL -> Known.INTEREST_REVERSAL
                    LATE_PAYMENT_REVERSAL -> Known.LATE_PAYMENT_REVERSAL
                    BILLING_ERROR_REVERSAL -> Known.BILLING_ERROR_REVERSAL
                    PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL
                    else ->
                        throw LithicInvalidDataException(
                            "Unknown ManagementOperationEventType: $value"
                        )
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return /* spotless:off */ other is ManagementOperationEvent && this.amount == other.amount && this.type == other.type && this.subtype == other.subtype && this.result == other.result && this.detailedResults == other.detailedResults && this.created == other.created && this.token == other.token && this.memo == other.memo && this.effectiveDate == other.effectiveDate && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(amount, type, subtype, result, detailedResults, created, token, memo, effectiveDate, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "ManagementOperationEvent{amount=$amount, type=$type, subtype=$subtype, result=$result, detailedResults=$detailedResults, created=$created, token=$token, memo=$memo, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}"
    }

    class TransactionResult
    @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 /* spotless:off */ other is TransactionResult && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val APPROVED = TransactionResult(JsonField.of("APPROVED"))

            val DECLINED = TransactionResult(JsonField.of("DECLINED"))

            fun of(value: String) = TransactionResult(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 TransactionResult: $value")
            }

        fun asString(): String = _value().asStringOrThrow()
    }

    class TransactionStatus
    @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 /* spotless:off */ other is TransactionStatus && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val PENDING = TransactionStatus(JsonField.of("PENDING"))

            val SETTLED = TransactionStatus(JsonField.of("SETTLED"))

            val DECLINED = TransactionStatus(JsonField.of("DECLINED"))

            val REVERSED = TransactionStatus(JsonField.of("REVERSED"))

            val CANCELED = TransactionStatus(JsonField.of("CANCELED"))

            fun of(value: String) = TransactionStatus(JsonField.of(value))
        }

        enum class Known {
            PENDING,
            SETTLED,
            DECLINED,
            REVERSED,
            CANCELED,
        }

        enum class Value {
            PENDING,
            SETTLED,
            DECLINED,
            REVERSED,
            CANCELED,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                PENDING -> Value.PENDING
                SETTLED -> Value.SETTLED
                DECLINED -> Value.DECLINED
                REVERSED -> Value.REVERSED
                CANCELED -> Value.CANCELED
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                PENDING -> Known.PENDING
                SETTLED -> Known.SETTLED
                DECLINED -> Known.DECLINED
                REVERSED -> Known.REVERSED
                CANCELED -> Known.CANCELED
                else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value")
            }

        fun asString(): String = _value().asStringOrThrow()
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        }

        return /* spotless:off */ other is ManagementOperationTransaction && this.token == other.token && this.result == other.result && this.category == other.category && this.status == other.status && this.settledAmount == other.settledAmount && this.pendingAmount == other.pendingAmount && this.currency == other.currency && this.events == other.events && this.created == other.created && this.updated == other.updated && this.userDefinedId == other.userDefinedId && this.financialAccountToken == other.financialAccountToken && this.direction == other.direction && this.additionalProperties == other.additionalProperties /* spotless:on */
    }

    private var hashCode: Int = 0

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode = /* spotless:off */ Objects.hash(token, result, category, status, settledAmount, pendingAmount, currency, events, created, updated, userDefinedId, financialAccountToken, direction, additionalProperties) /* spotless:on */
        }
        return hashCode
    }

    override fun toString() =
        "ManagementOperationTransaction{token=$token, result=$result, category=$category, status=$status, settledAmount=$settledAmount, pendingAmount=$pendingAmount, currency=$currency, events=$events, created=$created, updated=$updated, userDefinedId=$userDefinedId, financialAccountToken=$financialAccountToken, direction=$direction, additionalProperties=$additionalProperties}"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy