com.lithic.api.models.PaymentRetryResponse.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lithic-kotlin-core Show documentation
Show all versions of lithic-kotlin-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.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
@JsonDeserialize(builder = PaymentRetryResponse.Builder::class)
@NoAutoDetect
class PaymentRetryResponse
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 balance: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** Payment category */
fun category(): Payment.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(): Payment.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(): Payment.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(): Payment.Direction = direction.getRequired("direction")
fun financialAccountToken(): String =
financialAccountToken.getRequired("financial_account_token")
fun externalBankAccountToken(): String? =
externalBankAccountToken.getNullable("external_bank_account_token")
fun method(): Payment.Method = method.getRequired("method")
fun methodAttributes(): Payment.PaymentMethodAttributes =
methodAttributes.getRequired("method_attributes")
fun source(): Payment.Source = source.getRequired("source")
fun userDefinedId(): String? = userDefinedId.getNullable("user_defined_id")
/** Balance */
fun balance(): Balance? = balance.getNullable("balance")
fun toPayment(): Payment =
Payment.builder()
.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)
.build()
/** 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
/** Balance */
@JsonProperty("balance") @ExcludeMissing fun _balance() = balance
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): PaymentRetryResponse = 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()
balance()?.validate()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is PaymentRetryResponse &&
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.balance == other.balance &&
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,
balance,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"PaymentRetryResponse{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, balance=$balance, 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 balance: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(paymentRetryResponse: PaymentRetryResponse) = apply {
this.category = paymentRetryResponse.category
this.created = paymentRetryResponse.created
this.currency = paymentRetryResponse.currency
this.descriptor = paymentRetryResponse.descriptor
this.events = paymentRetryResponse.events
this.pendingAmount = paymentRetryResponse.pendingAmount
this.result = paymentRetryResponse.result
this.settledAmount = paymentRetryResponse.settledAmount
this.status = paymentRetryResponse.status
this.token = paymentRetryResponse.token
this.updated = paymentRetryResponse.updated
this.direction = paymentRetryResponse.direction
this.financialAccountToken = paymentRetryResponse.financialAccountToken
this.externalBankAccountToken = paymentRetryResponse.externalBankAccountToken
this.method = paymentRetryResponse.method
this.methodAttributes = paymentRetryResponse.methodAttributes
this.source = paymentRetryResponse.source
this.userDefinedId = paymentRetryResponse.userDefinedId
this.balance = paymentRetryResponse.balance
additionalProperties(paymentRetryResponse.additionalProperties)
}
/** Payment category */
fun category(category: Payment.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: Payment.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: Payment.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: Payment.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: Payment.Method) = method(JsonField.of(method))
@JsonProperty("method")
@ExcludeMissing
fun method(method: JsonField) = apply { this.method = method }
fun methodAttributes(methodAttributes: Payment.PaymentMethodAttributes) =
methodAttributes(JsonField.of(methodAttributes))
@JsonProperty("method_attributes")
@ExcludeMissing
fun methodAttributes(methodAttributes: JsonField) = apply {
this.methodAttributes = methodAttributes
}
fun source(source: Payment.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
}
/** Balance */
fun balance(balance: Balance) = balance(JsonField.of(balance))
/** Balance */
@JsonProperty("balance")
@ExcludeMissing
fun balance(balance: JsonField) = apply { this.balance = balance }
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(): PaymentRetryResponse =
PaymentRetryResponse(
category,
created,
currency,
descriptor,
events.map { it.toUnmodifiable() },
pendingAmount,
result,
settledAmount,
status,
token,
updated,
direction,
financialAccountToken,
externalBankAccountToken,
method,
methodAttributes,
source,
userDefinedId,
balance,
additionalProperties.toUnmodifiable(),
)
}
}