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

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

There is a newer version: 0.71.0
Show 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.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
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 java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional

@JsonDeserialize(builder = CardProgram.Builder::class)
@NoAutoDetect
class CardProgram
private constructor(
    private val cardholderCurrency: JsonField,
    private val created: JsonField,
    private val name: JsonField,
    private val panRangeEnd: JsonField,
    private val panRangeStart: JsonField,
    private val settlementCurrencies: JsonField>,
    private val token: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    /** 3-digit alphabetic ISO 4217 code for the currency of the cardholder. */
    fun cardholderCurrency(): Optional =
        Optional.ofNullable(cardholderCurrency.getNullable("cardholder_currency"))

    /** Timestamp of when the card program was created. */
    fun created(): OffsetDateTime = created.getRequired("created")

    /** The name of the card program. */
    fun name(): String = name.getRequired("name")

    /** The first digits of the card number that this card program ends with. */
    fun panRangeEnd(): String = panRangeEnd.getRequired("pan_range_end")

    /** The first digits of the card number that this card program starts with. */
    fun panRangeStart(): String = panRangeStart.getRequired("pan_range_start")

    /**
     * List of 3-digit alphabetic ISO 4217 codes for the currencies that the card program supports
     * for settlement.
     */
    fun settlementCurrencies(): Optional> =
        Optional.ofNullable(settlementCurrencies.getNullable("settlement_currencies"))

    /** Globally unique identifier. */
    fun token(): String = token.getRequired("token")

    /** 3-digit alphabetic ISO 4217 code for the currency of the cardholder. */
    @JsonProperty("cardholder_currency")
    @ExcludeMissing
    fun _cardholderCurrency() = cardholderCurrency

    /** Timestamp of when the card program was created. */
    @JsonProperty("created") @ExcludeMissing fun _created() = created

    /** The name of the card program. */
    @JsonProperty("name") @ExcludeMissing fun _name() = name

    /** The first digits of the card number that this card program ends with. */
    @JsonProperty("pan_range_end") @ExcludeMissing fun _panRangeEnd() = panRangeEnd

    /** The first digits of the card number that this card program starts with. */
    @JsonProperty("pan_range_start") @ExcludeMissing fun _panRangeStart() = panRangeStart

    /**
     * List of 3-digit alphabetic ISO 4217 codes for the currencies that the card program supports
     * for settlement.
     */
    @JsonProperty("settlement_currencies")
    @ExcludeMissing
    fun _settlementCurrencies() = settlementCurrencies

    /** Globally unique identifier. */
    @JsonProperty("token") @ExcludeMissing fun _token() = token

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

    fun validate(): CardProgram = apply {
        if (!validated) {
            cardholderCurrency()
            created()
            name()
            panRangeEnd()
            panRangeStart()
            settlementCurrencies()
            token()
            validated = true
        }
    }

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

    companion object {

        @JvmStatic fun builder() = Builder()
    }

    class Builder {

        private var cardholderCurrency: JsonField = JsonMissing.of()
        private var created: JsonField = JsonMissing.of()
        private var name: JsonField = JsonMissing.of()
        private var panRangeEnd: JsonField = JsonMissing.of()
        private var panRangeStart: JsonField = JsonMissing.of()
        private var settlementCurrencies: JsonField> = JsonMissing.of()
        private var token: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        @JvmSynthetic
        internal fun from(cardProgram: CardProgram) = apply {
            this.cardholderCurrency = cardProgram.cardholderCurrency
            this.created = cardProgram.created
            this.name = cardProgram.name
            this.panRangeEnd = cardProgram.panRangeEnd
            this.panRangeStart = cardProgram.panRangeStart
            this.settlementCurrencies = cardProgram.settlementCurrencies
            this.token = cardProgram.token
            additionalProperties(cardProgram.additionalProperties)
        }

        /** 3-digit alphabetic ISO 4217 code for the currency of the cardholder. */
        fun cardholderCurrency(cardholderCurrency: String) =
            cardholderCurrency(JsonField.of(cardholderCurrency))

        /** 3-digit alphabetic ISO 4217 code for the currency of the cardholder. */
        @JsonProperty("cardholder_currency")
        @ExcludeMissing
        fun cardholderCurrency(cardholderCurrency: JsonField) = apply {
            this.cardholderCurrency = cardholderCurrency
        }

        /** Timestamp of when the card program was created. */
        fun created(created: OffsetDateTime) = created(JsonField.of(created))

        /** Timestamp of when the card program was created. */
        @JsonProperty("created")
        @ExcludeMissing
        fun created(created: JsonField) = apply { this.created = created }

        /** The name of the card program. */
        fun name(name: String) = name(JsonField.of(name))

        /** The name of the card program. */
        @JsonProperty("name")
        @ExcludeMissing
        fun name(name: JsonField) = apply { this.name = name }

        /** The first digits of the card number that this card program ends with. */
        fun panRangeEnd(panRangeEnd: String) = panRangeEnd(JsonField.of(panRangeEnd))

        /** The first digits of the card number that this card program ends with. */
        @JsonProperty("pan_range_end")
        @ExcludeMissing
        fun panRangeEnd(panRangeEnd: JsonField) = apply { this.panRangeEnd = panRangeEnd }

        /** The first digits of the card number that this card program starts with. */
        fun panRangeStart(panRangeStart: String) = panRangeStart(JsonField.of(panRangeStart))

        /** The first digits of the card number that this card program starts with. */
        @JsonProperty("pan_range_start")
        @ExcludeMissing
        fun panRangeStart(panRangeStart: JsonField) = apply {
            this.panRangeStart = panRangeStart
        }

        /**
         * List of 3-digit alphabetic ISO 4217 codes for the currencies that the card program
         * supports for settlement.
         */
        fun settlementCurrencies(settlementCurrencies: List) =
            settlementCurrencies(JsonField.of(settlementCurrencies))

        /**
         * List of 3-digit alphabetic ISO 4217 codes for the currencies that the card program
         * supports for settlement.
         */
        @JsonProperty("settlement_currencies")
        @ExcludeMissing
        fun settlementCurrencies(settlementCurrencies: JsonField>) = apply {
            this.settlementCurrencies = settlementCurrencies
        }

        /** 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 }

        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(): CardProgram =
            CardProgram(
                cardholderCurrency,
                created,
                name,
                panRangeEnd,
                panRangeStart,
                settlementCurrencies.map { it.toUnmodifiable() },
                token,
                additionalProperties.toUnmodifiable(),
            )
    }

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

        return /* spotless:off */ other is CardProgram && this.cardholderCurrency == other.cardholderCurrency && this.created == other.created && this.name == other.name && this.panRangeEnd == other.panRangeEnd && this.panRangeStart == other.panRangeStart && this.settlementCurrencies == other.settlementCurrencies && this.token == other.token && this.additionalProperties == other.additionalProperties /* spotless:on */
    }

    private var hashCode: Int = 0

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode = /* spotless:off */ Objects.hash(cardholderCurrency, created, name, panRangeEnd, panRangeStart, settlementCurrencies, token, additionalProperties) /* spotless:on */
        }
        return hashCode
    }

    override fun toString() =
        "CardProgram{cardholderCurrency=$cardholderCurrency, created=$created, name=$name, panRangeEnd=$panRangeEnd, panRangeStart=$panRangeStart, settlementCurrencies=$settlementCurrencies, token=$token, additionalProperties=$additionalProperties}"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy