com.lithic.api.models.SettlementSummaryDetails.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lithic-java-core Show documentation
Show all versions of lithic-java-core Show documentation
The Lithic Developer API is designed to provide a predictable programmatic
interface for accessing your Lithic account through an API and transaction
webhooks. Note that your API key is a secret and should be treated as such.
Don't share it with anyone, including us. We will never ask you for it.
// File generated from our OpenAPI spec by Stainless.
package com.lithic.api.models
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.lithic.api.core.Enum
import com.lithic.api.core.ExcludeMissing
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import com.lithic.api.errors.LithicInvalidDataException
import java.util.Objects
import java.util.Optional
@JsonDeserialize(builder = SettlementSummaryDetails.Builder::class)
@NoAutoDetect
class SettlementSummaryDetails
private constructor(
private val disputesGrossAmount: JsonField,
private val institution: JsonField,
private val interchangeGrossAmount: JsonField,
private val network: JsonField,
private val otherFeesGrossAmount: JsonField,
private val settledNetAmount: JsonField,
private val transactionsGrossAmount: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** The total gross amount of disputes settlements. */
fun disputesGrossAmount(): Optional =
Optional.ofNullable(disputesGrossAmount.getNullable("disputes_gross_amount"))
/** The most granular ID the network settles with (e.g., ICA for Mastercard, FTSRE for Visa). */
fun institution(): Optional =
Optional.ofNullable(institution.getNullable("institution"))
/** The total amount of interchange. */
fun interchangeGrossAmount(): Optional =
Optional.ofNullable(interchangeGrossAmount.getNullable("interchange_gross_amount"))
/** Card network where the transaction took place */
fun network(): Optional = Optional.ofNullable(network.getNullable("network"))
/** Total amount of gross other fees outside of interchange. */
fun otherFeesGrossAmount(): Optional =
Optional.ofNullable(otherFeesGrossAmount.getNullable("other_fees_gross_amount"))
/**
* The total net amount of cash moved. (net value of settled_gross_amount, interchange, fees).
*/
fun settledNetAmount(): Optional =
Optional.ofNullable(settledNetAmount.getNullable("settled_net_amount"))
/**
* The total amount of settlement impacting transactions (excluding interchange, fees, and
* disputes).
*/
fun transactionsGrossAmount(): Optional =
Optional.ofNullable(transactionsGrossAmount.getNullable("transactions_gross_amount"))
/** The total gross amount of disputes settlements. */
@JsonProperty("disputes_gross_amount")
@ExcludeMissing
fun _disputesGrossAmount() = disputesGrossAmount
/** The most granular ID the network settles with (e.g., ICA for Mastercard, FTSRE for Visa). */
@JsonProperty("institution") @ExcludeMissing fun _institution() = institution
/** The total amount of interchange. */
@JsonProperty("interchange_gross_amount")
@ExcludeMissing
fun _interchangeGrossAmount() = interchangeGrossAmount
/** Card network where the transaction took place */
@JsonProperty("network") @ExcludeMissing fun _network() = network
/** Total amount of gross other fees outside of interchange. */
@JsonProperty("other_fees_gross_amount")
@ExcludeMissing
fun _otherFeesGrossAmount() = otherFeesGrossAmount
/**
* The total net amount of cash moved. (net value of settled_gross_amount, interchange, fees).
*/
@JsonProperty("settled_net_amount") @ExcludeMissing fun _settledNetAmount() = settledNetAmount
/**
* The total amount of settlement impacting transactions (excluding interchange, fees, and
* disputes).
*/
@JsonProperty("transactions_gross_amount")
@ExcludeMissing
fun _transactionsGrossAmount() = transactionsGrossAmount
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): SettlementSummaryDetails = apply {
if (!validated) {
disputesGrossAmount()
institution()
interchangeGrossAmount()
network()
otherFeesGrossAmount()
settledNetAmount()
transactionsGrossAmount()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is SettlementSummaryDetails &&
this.disputesGrossAmount == other.disputesGrossAmount &&
this.institution == other.institution &&
this.interchangeGrossAmount == other.interchangeGrossAmount &&
this.network == other.network &&
this.otherFeesGrossAmount == other.otherFeesGrossAmount &&
this.settledNetAmount == other.settledNetAmount &&
this.transactionsGrossAmount == other.transactionsGrossAmount &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
disputesGrossAmount,
institution,
interchangeGrossAmount,
network,
otherFeesGrossAmount,
settledNetAmount,
transactionsGrossAmount,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"SettlementSummaryDetails{disputesGrossAmount=$disputesGrossAmount, institution=$institution, interchangeGrossAmount=$interchangeGrossAmount, network=$network, otherFeesGrossAmount=$otherFeesGrossAmount, settledNetAmount=$settledNetAmount, transactionsGrossAmount=$transactionsGrossAmount, additionalProperties=$additionalProperties}"
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var disputesGrossAmount: JsonField = JsonMissing.of()
private var institution: JsonField = JsonMissing.of()
private var interchangeGrossAmount: JsonField = JsonMissing.of()
private var network: JsonField = JsonMissing.of()
private var otherFeesGrossAmount: JsonField = JsonMissing.of()
private var settledNetAmount: JsonField = JsonMissing.of()
private var transactionsGrossAmount: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(settlementSummaryDetails: SettlementSummaryDetails) = apply {
this.disputesGrossAmount = settlementSummaryDetails.disputesGrossAmount
this.institution = settlementSummaryDetails.institution
this.interchangeGrossAmount = settlementSummaryDetails.interchangeGrossAmount
this.network = settlementSummaryDetails.network
this.otherFeesGrossAmount = settlementSummaryDetails.otherFeesGrossAmount
this.settledNetAmount = settlementSummaryDetails.settledNetAmount
this.transactionsGrossAmount = settlementSummaryDetails.transactionsGrossAmount
additionalProperties(settlementSummaryDetails.additionalProperties)
}
/** The total gross amount of disputes settlements. */
fun disputesGrossAmount(disputesGrossAmount: Long) =
disputesGrossAmount(JsonField.of(disputesGrossAmount))
/** The total gross amount of disputes settlements. */
@JsonProperty("disputes_gross_amount")
@ExcludeMissing
fun disputesGrossAmount(disputesGrossAmount: JsonField) = apply {
this.disputesGrossAmount = disputesGrossAmount
}
/**
* The most granular ID the network settles with (e.g., ICA for Mastercard, FTSRE for Visa).
*/
fun institution(institution: String) = institution(JsonField.of(institution))
/**
* The most granular ID the network settles with (e.g., ICA for Mastercard, FTSRE for Visa).
*/
@JsonProperty("institution")
@ExcludeMissing
fun institution(institution: JsonField) = apply { this.institution = institution }
/** The total amount of interchange. */
fun interchangeGrossAmount(interchangeGrossAmount: Long) =
interchangeGrossAmount(JsonField.of(interchangeGrossAmount))
/** The total amount of interchange. */
@JsonProperty("interchange_gross_amount")
@ExcludeMissing
fun interchangeGrossAmount(interchangeGrossAmount: JsonField) = apply {
this.interchangeGrossAmount = interchangeGrossAmount
}
/** Card network where the transaction took place */
fun network(network: Network) = network(JsonField.of(network))
/** Card network where the transaction took place */
@JsonProperty("network")
@ExcludeMissing
fun network(network: JsonField) = apply { this.network = network }
/** Total amount of gross other fees outside of interchange. */
fun otherFeesGrossAmount(otherFeesGrossAmount: Long) =
otherFeesGrossAmount(JsonField.of(otherFeesGrossAmount))
/** Total amount of gross other fees outside of interchange. */
@JsonProperty("other_fees_gross_amount")
@ExcludeMissing
fun otherFeesGrossAmount(otherFeesGrossAmount: JsonField) = apply {
this.otherFeesGrossAmount = otherFeesGrossAmount
}
/**
* The total net amount of cash moved. (net value of settled_gross_amount, interchange,
* fees).
*/
fun settledNetAmount(settledNetAmount: Long) =
settledNetAmount(JsonField.of(settledNetAmount))
/**
* The total net amount of cash moved. (net value of settled_gross_amount, interchange,
* fees).
*/
@JsonProperty("settled_net_amount")
@ExcludeMissing
fun settledNetAmount(settledNetAmount: JsonField) = apply {
this.settledNetAmount = settledNetAmount
}
/**
* The total amount of settlement impacting transactions (excluding interchange, fees, and
* disputes).
*/
fun transactionsGrossAmount(transactionsGrossAmount: Long) =
transactionsGrossAmount(JsonField.of(transactionsGrossAmount))
/**
* The total amount of settlement impacting transactions (excluding interchange, fees, and
* disputes).
*/
@JsonProperty("transactions_gross_amount")
@ExcludeMissing
fun transactionsGrossAmount(transactionsGrossAmount: JsonField) = apply {
this.transactionsGrossAmount = transactionsGrossAmount
}
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(): SettlementSummaryDetails =
SettlementSummaryDetails(
disputesGrossAmount,
institution,
interchangeGrossAmount,
network,
otherFeesGrossAmount,
settledNetAmount,
transactionsGrossAmount,
additionalProperties.toUnmodifiable(),
)
}
class Network
@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 Network && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
@JvmField val INTERLINK = Network(JsonField.of("INTERLINK"))
@JvmField val MAESTRO = Network(JsonField.of("MAESTRO"))
@JvmField val MASTERCARD = Network(JsonField.of("MASTERCARD"))
@JvmField val UNKNOWN = Network(JsonField.of("UNKNOWN"))
@JvmField val VISA = Network(JsonField.of("VISA"))
@JvmStatic fun of(value: String) = Network(JsonField.of(value))
}
enum class Known {
INTERLINK,
MAESTRO,
MASTERCARD,
UNKNOWN,
VISA,
}
enum class Value {
INTERLINK,
MAESTRO,
MASTERCARD,
UNKNOWN,
VISA,
_UNKNOWN,
}
fun value(): Value =
when (this) {
INTERLINK -> Value.INTERLINK
MAESTRO -> Value.MAESTRO
MASTERCARD -> Value.MASTERCARD
UNKNOWN -> Value.UNKNOWN
VISA -> Value.VISA
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
INTERLINK -> Known.INTERLINK
MAESTRO -> Known.MAESTRO
MASTERCARD -> Known.MASTERCARD
UNKNOWN -> Known.UNKNOWN
VISA -> Known.VISA
else -> throw LithicInvalidDataException("Unknown Network: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
}