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

com.lithic.api.models.TokenizationSimulateParams.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.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.http.Headers
import com.lithic.api.core.http.QueryParams
import com.lithic.api.core.toImmutable
import com.lithic.api.errors.LithicInvalidDataException
import com.lithic.api.models.*
import java.util.Objects

class TokenizationSimulateParams
constructor(
    private val cvv: String,
    private val expirationDate: String,
    private val pan: String,
    private val tokenizationSource: TokenizationSource,
    private val accountScore: Long?,
    private val deviceScore: Long?,
    private val entity: String?,
    private val walletRecommendedDecision: WalletRecommendedDecision?,
    private val additionalHeaders: Headers,
    private val additionalQueryParams: QueryParams,
    private val additionalBodyProperties: Map,
) {

    fun cvv(): String = cvv

    fun expirationDate(): String = expirationDate

    fun pan(): String = pan

    fun tokenizationSource(): TokenizationSource = tokenizationSource

    fun accountScore(): Long? = accountScore

    fun deviceScore(): Long? = deviceScore

    fun entity(): String? = entity

    fun walletRecommendedDecision(): WalletRecommendedDecision? = walletRecommendedDecision

    internal fun getBody(): TokenizationSimulateBody {
        return TokenizationSimulateBody(
            cvv,
            expirationDate,
            pan,
            tokenizationSource,
            accountScore,
            deviceScore,
            entity,
            walletRecommendedDecision,
            additionalBodyProperties,
        )
    }

    internal fun getHeaders(): Headers = additionalHeaders

    internal fun getQueryParams(): QueryParams = additionalQueryParams

    @JsonDeserialize(builder = TokenizationSimulateBody.Builder::class)
    @NoAutoDetect
    class TokenizationSimulateBody
    internal constructor(
        private val cvv: String?,
        private val expirationDate: String?,
        private val pan: String?,
        private val tokenizationSource: TokenizationSource?,
        private val accountScore: Long?,
        private val deviceScore: Long?,
        private val entity: String?,
        private val walletRecommendedDecision: WalletRecommendedDecision?,
        private val additionalProperties: Map,
    ) {

        /** The three digit cvv for the card. */
        @JsonProperty("cvv") fun cvv(): String? = cvv

        /** The expiration date of the card in 'MM/YY' format. */
        @JsonProperty("expiration_date") fun expirationDate(): String? = expirationDate

        /** The sixteen digit card number. */
        @JsonProperty("pan") fun pan(): String? = pan

        /** The source of the tokenization request. */
        @JsonProperty("tokenization_source")
        fun tokenizationSource(): TokenizationSource? = tokenizationSource

        /**
         * The account score (1-5) that represents how the Digital Wallet's view on how reputable an
         * end user's account is.
         */
        @JsonProperty("account_score") fun accountScore(): Long? = accountScore

        /**
         * The device score (1-5) that represents how the Digital Wallet's view on how reputable an
         * end user's device is.
         */
        @JsonProperty("device_score") fun deviceScore(): Long? = deviceScore

        /**
         * Optional field to specify the token requestor name for a merchant token simulation.
         * Ignored when tokenization_source is not MERCHANT.
         */
        @JsonProperty("entity") fun entity(): String? = entity

        /** The decision that the Digital Wallet's recommend */
        @JsonProperty("wallet_recommended_decision")
        fun walletRecommendedDecision(): WalletRecommendedDecision? = walletRecommendedDecision

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

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var cvv: String? = null
            private var expirationDate: String? = null
            private var pan: String? = null
            private var tokenizationSource: TokenizationSource? = null
            private var accountScore: Long? = null
            private var deviceScore: Long? = null
            private var entity: String? = null
            private var walletRecommendedDecision: WalletRecommendedDecision? = null
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(tokenizationSimulateBody: TokenizationSimulateBody) = apply {
                this.cvv = tokenizationSimulateBody.cvv
                this.expirationDate = tokenizationSimulateBody.expirationDate
                this.pan = tokenizationSimulateBody.pan
                this.tokenizationSource = tokenizationSimulateBody.tokenizationSource
                this.accountScore = tokenizationSimulateBody.accountScore
                this.deviceScore = tokenizationSimulateBody.deviceScore
                this.entity = tokenizationSimulateBody.entity
                this.walletRecommendedDecision = tokenizationSimulateBody.walletRecommendedDecision
                additionalProperties(tokenizationSimulateBody.additionalProperties)
            }

            /** The three digit cvv for the card. */
            @JsonProperty("cvv") fun cvv(cvv: String) = apply { this.cvv = cvv }

            /** The expiration date of the card in 'MM/YY' format. */
            @JsonProperty("expiration_date")
            fun expirationDate(expirationDate: String) = apply {
                this.expirationDate = expirationDate
            }

            /** The sixteen digit card number. */
            @JsonProperty("pan") fun pan(pan: String) = apply { this.pan = pan }

            /** The source of the tokenization request. */
            @JsonProperty("tokenization_source")
            fun tokenizationSource(tokenizationSource: TokenizationSource) = apply {
                this.tokenizationSource = tokenizationSource
            }

            /**
             * The account score (1-5) that represents how the Digital Wallet's view on how
             * reputable an end user's account is.
             */
            @JsonProperty("account_score")
            fun accountScore(accountScore: Long) = apply { this.accountScore = accountScore }

            /**
             * The device score (1-5) that represents how the Digital Wallet's view on how reputable
             * an end user's device is.
             */
            @JsonProperty("device_score")
            fun deviceScore(deviceScore: Long) = apply { this.deviceScore = deviceScore }

            /**
             * Optional field to specify the token requestor name for a merchant token simulation.
             * Ignored when tokenization_source is not MERCHANT.
             */
            @JsonProperty("entity") fun entity(entity: String) = apply { this.entity = entity }

            /** The decision that the Digital Wallet's recommend */
            @JsonProperty("wallet_recommended_decision")
            fun walletRecommendedDecision(walletRecommendedDecision: WalletRecommendedDecision) =
                apply {
                    this.walletRecommendedDecision = walletRecommendedDecision
                }

            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(): TokenizationSimulateBody =
                TokenizationSimulateBody(
                    checkNotNull(cvv) { "`cvv` is required but was not set" },
                    checkNotNull(expirationDate) { "`expirationDate` is required but was not set" },
                    checkNotNull(pan) { "`pan` is required but was not set" },
                    checkNotNull(tokenizationSource) {
                        "`tokenizationSource` is required but was not set"
                    },
                    accountScore,
                    deviceScore,
                    entity,
                    walletRecommendedDecision,
                    additionalProperties.toImmutable(),
                )
        }

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

            return /* spotless:off */ other is TokenizationSimulateBody && this.cvv == other.cvv && this.expirationDate == other.expirationDate && this.pan == other.pan && this.tokenizationSource == other.tokenizationSource && this.accountScore == other.accountScore && this.deviceScore == other.deviceScore && this.entity == other.entity && this.walletRecommendedDecision == other.walletRecommendedDecision && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(cvv, expirationDate, pan, tokenizationSource, accountScore, deviceScore, entity, walletRecommendedDecision, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "TokenizationSimulateBody{cvv=$cvv, expirationDate=$expirationDate, pan=$pan, tokenizationSource=$tokenizationSource, accountScore=$accountScore, deviceScore=$deviceScore, entity=$entity, walletRecommendedDecision=$walletRecommendedDecision, additionalProperties=$additionalProperties}"
    }

    fun _additionalHeaders(): Headers = additionalHeaders

    fun _additionalQueryParams(): QueryParams = additionalQueryParams

    fun _additionalBodyProperties(): Map = additionalBodyProperties

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

        return /* spotless:off */ other is TokenizationSimulateParams && this.cvv == other.cvv && this.expirationDate == other.expirationDate && this.pan == other.pan && this.tokenizationSource == other.tokenizationSource && this.accountScore == other.accountScore && this.deviceScore == other.deviceScore && this.entity == other.entity && this.walletRecommendedDecision == other.walletRecommendedDecision && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
    }

    override fun hashCode(): Int {
        return /* spotless:off */ Objects.hash(cvv, expirationDate, pan, tokenizationSource, accountScore, deviceScore, entity, walletRecommendedDecision, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
    }

    override fun toString() =
        "TokenizationSimulateParams{cvv=$cvv, expirationDate=$expirationDate, pan=$pan, tokenizationSource=$tokenizationSource, accountScore=$accountScore, deviceScore=$deviceScore, entity=$entity, walletRecommendedDecision=$walletRecommendedDecision, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"

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

    companion object {

        fun builder() = Builder()
    }

    @NoAutoDetect
    class Builder {

        private var cvv: String? = null
        private var expirationDate: String? = null
        private var pan: String? = null
        private var tokenizationSource: TokenizationSource? = null
        private var accountScore: Long? = null
        private var deviceScore: Long? = null
        private var entity: String? = null
        private var walletRecommendedDecision: WalletRecommendedDecision? = null
        private var additionalHeaders: Headers.Builder = Headers.builder()
        private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
        private var additionalBodyProperties: MutableMap = mutableMapOf()

        internal fun from(tokenizationSimulateParams: TokenizationSimulateParams) = apply {
            this.cvv = tokenizationSimulateParams.cvv
            this.expirationDate = tokenizationSimulateParams.expirationDate
            this.pan = tokenizationSimulateParams.pan
            this.tokenizationSource = tokenizationSimulateParams.tokenizationSource
            this.accountScore = tokenizationSimulateParams.accountScore
            this.deviceScore = tokenizationSimulateParams.deviceScore
            this.entity = tokenizationSimulateParams.entity
            this.walletRecommendedDecision = tokenizationSimulateParams.walletRecommendedDecision
            additionalHeaders(tokenizationSimulateParams.additionalHeaders)
            additionalQueryParams(tokenizationSimulateParams.additionalQueryParams)
            additionalBodyProperties(tokenizationSimulateParams.additionalBodyProperties)
        }

        /** The three digit cvv for the card. */
        fun cvv(cvv: String) = apply { this.cvv = cvv }

        /** The expiration date of the card in 'MM/YY' format. */
        fun expirationDate(expirationDate: String) = apply { this.expirationDate = expirationDate }

        /** The sixteen digit card number. */
        fun pan(pan: String) = apply { this.pan = pan }

        /** The source of the tokenization request. */
        fun tokenizationSource(tokenizationSource: TokenizationSource) = apply {
            this.tokenizationSource = tokenizationSource
        }

        /**
         * The account score (1-5) that represents how the Digital Wallet's view on how reputable an
         * end user's account is.
         */
        fun accountScore(accountScore: Long) = apply { this.accountScore = accountScore }

        /**
         * The device score (1-5) that represents how the Digital Wallet's view on how reputable an
         * end user's device is.
         */
        fun deviceScore(deviceScore: Long) = apply { this.deviceScore = deviceScore }

        /**
         * Optional field to specify the token requestor name for a merchant token simulation.
         * Ignored when tokenization_source is not MERCHANT.
         */
        fun entity(entity: String) = apply { this.entity = entity }

        /** The decision that the Digital Wallet's recommend */
        fun walletRecommendedDecision(walletRecommendedDecision: WalletRecommendedDecision) =
            apply {
                this.walletRecommendedDecision = walletRecommendedDecision
            }

        fun additionalHeaders(additionalHeaders: Headers) = apply {
            this.additionalHeaders.clear()
            putAllAdditionalHeaders(additionalHeaders)
        }

        fun additionalHeaders(additionalHeaders: Map>) = apply {
            this.additionalHeaders.clear()
            putAllAdditionalHeaders(additionalHeaders)
        }

        fun putAdditionalHeader(name: String, value: String) = apply {
            additionalHeaders.put(name, value)
        }

        fun putAdditionalHeaders(name: String, values: Iterable) = apply {
            additionalHeaders.put(name, values)
        }

        fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
            this.additionalHeaders.putAll(additionalHeaders)
        }

        fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
            this.additionalHeaders.putAll(additionalHeaders)
        }

        fun replaceAdditionalHeaders(name: String, value: String) = apply {
            additionalHeaders.replace(name, value)
        }

        fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
            additionalHeaders.replace(name, values)
        }

        fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
            this.additionalHeaders.replaceAll(additionalHeaders)
        }

        fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
            this.additionalHeaders.replaceAll(additionalHeaders)
        }

        fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }

        fun removeAllAdditionalHeaders(names: Set) = apply {
            additionalHeaders.removeAll(names)
        }

        fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
            this.additionalQueryParams.clear()
            putAllAdditionalQueryParams(additionalQueryParams)
        }

        fun additionalQueryParams(additionalQueryParams: Map>) = apply {
            this.additionalQueryParams.clear()
            putAllAdditionalQueryParams(additionalQueryParams)
        }

        fun putAdditionalQueryParam(key: String, value: String) = apply {
            additionalQueryParams.put(key, value)
        }

        fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
            additionalQueryParams.put(key, values)
        }

        fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
            this.additionalQueryParams.putAll(additionalQueryParams)
        }

        fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
            apply {
                this.additionalQueryParams.putAll(additionalQueryParams)
            }

        fun replaceAdditionalQueryParams(key: String, value: String) = apply {
            additionalQueryParams.replace(key, value)
        }

        fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
            additionalQueryParams.replace(key, values)
        }

        fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
            this.additionalQueryParams.replaceAll(additionalQueryParams)
        }

        fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
            apply {
                this.additionalQueryParams.replaceAll(additionalQueryParams)
            }

        fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }

        fun removeAllAdditionalQueryParams(keys: Set) = apply {
            additionalQueryParams.removeAll(keys)
        }

        fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
            this.additionalBodyProperties.clear()
            putAllAdditionalBodyProperties(additionalBodyProperties)
        }

        fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
            additionalBodyProperties.put(key, value)
        }

        fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
            apply {
                this.additionalBodyProperties.putAll(additionalBodyProperties)
            }

        fun removeAdditionalBodyProperty(key: String) = apply {
            additionalBodyProperties.remove(key)
        }

        fun removeAllAdditionalBodyProperties(keys: Set) = apply {
            keys.forEach(::removeAdditionalBodyProperty)
        }

        fun build(): TokenizationSimulateParams =
            TokenizationSimulateParams(
                checkNotNull(cvv) { "`cvv` is required but was not set" },
                checkNotNull(expirationDate) { "`expirationDate` is required but was not set" },
                checkNotNull(pan) { "`pan` is required but was not set" },
                checkNotNull(tokenizationSource) {
                    "`tokenizationSource` is required but was not set"
                },
                accountScore,
                deviceScore,
                entity,
                walletRecommendedDecision,
                additionalHeaders.build(),
                additionalQueryParams.build(),
                additionalBodyProperties.toImmutable(),
            )
    }

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

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val APPLE_PAY = TokenizationSource(JsonField.of("APPLE_PAY"))

            val GOOGLE = TokenizationSource(JsonField.of("GOOGLE"))

            val SAMSUNG_PAY = TokenizationSource(JsonField.of("SAMSUNG_PAY"))

            val MERCHANT = TokenizationSource(JsonField.of("MERCHANT"))

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

        enum class Known {
            APPLE_PAY,
            GOOGLE,
            SAMSUNG_PAY,
            MERCHANT,
        }

        enum class Value {
            APPLE_PAY,
            GOOGLE,
            SAMSUNG_PAY,
            MERCHANT,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                APPLE_PAY -> Value.APPLE_PAY
                GOOGLE -> Value.GOOGLE
                SAMSUNG_PAY -> Value.SAMSUNG_PAY
                MERCHANT -> Value.MERCHANT
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                APPLE_PAY -> Known.APPLE_PAY
                GOOGLE -> Known.GOOGLE
                SAMSUNG_PAY -> Known.SAMSUNG_PAY
                MERCHANT -> Known.MERCHANT
                else -> throw LithicInvalidDataException("Unknown TokenizationSource: $value")
            }

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

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

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

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

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

            val REQUIRE_ADDITIONAL_AUTHENTICATION =
                WalletRecommendedDecision(JsonField.of("REQUIRE_ADDITIONAL_AUTHENTICATION"))

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

        enum class Known {
            APPROVED,
            DECLINED,
            REQUIRE_ADDITIONAL_AUTHENTICATION,
        }

        enum class Value {
            APPROVED,
            DECLINED,
            REQUIRE_ADDITIONAL_AUTHENTICATION,
            _UNKNOWN,
        }

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy