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

com.moderntreasury.api.models.Transaction.kt Maven / Gradle / Ivy

// File generated from our OpenAPI spec by Stainless.

package com.moderntreasury.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.moderntreasury.api.core.Enum
import com.moderntreasury.api.core.ExcludeMissing
import com.moderntreasury.api.core.JsonField
import com.moderntreasury.api.core.JsonMissing
import com.moderntreasury.api.core.JsonValue
import com.moderntreasury.api.core.NoAutoDetect
import com.moderntreasury.api.core.toImmutable
import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException
import java.time.LocalDate
import java.time.OffsetDateTime
import java.util.Objects

@JsonDeserialize(builder = Transaction.Builder::class)
@NoAutoDetect
class Transaction
private constructor(
    private val id: JsonField,
    private val object_: JsonField,
    private val liveMode: JsonField,
    private val createdAt: JsonField,
    private val updatedAt: JsonField,
    private val discardedAt: JsonField,
    private val amount: JsonField,
    private val currency: JsonField,
    private val direction: JsonField,
    private val vendorDescription: JsonField,
    private val vendorCode: JsonField,
    private val vendorCodeType: JsonField,
    private val vendorId: JsonField,
    private val asOfDate: JsonField,
    private val asOfTime: JsonField,
    private val asOfTimezone: JsonField,
    private val internalAccountId: JsonField,
    private val metadata: JsonField,
    private val posted: JsonField,
    private val vendorCustomerId: JsonField,
    private val reconciled: JsonField,
    private val details: JsonField
, private val type: JsonField, private val foreignExchangeRate: JsonField, private val customIdentifiers: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false fun id(): String = id.getRequired("id") fun object_(): String = object_.getRequired("object") /** * This field will be true if this object exists in the live environment or false if it exists * in the test environment. */ fun liveMode(): Boolean = liveMode.getRequired("live_mode") fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") fun discardedAt(): OffsetDateTime? = discardedAt.getNullable("discarded_at") /** Value in specified currency's smallest unit. e.g. $10 would be represented as 1000. */ fun amount(): Long = amount.getRequired("amount") /** Currency that this transaction is denominated in. */ fun currency(): Currency = currency.getRequired("currency") /** Either `credit` or `debit`. */ fun direction(): String = direction.getRequired("direction") /** * The transaction detail text that often appears in on your bank statement and in your banking * portal. */ fun vendorDescription(): String? = vendorDescription.getNullable("vendor_description") /** * When applicable, the bank-given code that determines the transaction's category. For most * banks this is the BAI2/BTRS transaction code. */ fun vendorCode(): String? = vendorCode.getNullable("vendor_code") /** * The type of `vendor_code` being reported. Can be one of `bai2`, `bankprov`, `bnk_dev`, * `cleartouch`, `currencycloud`, `cross_river`, `dc_bank`, `dwolla`, `evolve`, `goldman_sachs`, * `iso20022`, `jpmc`, `mx`, `signet`, `silvergate`, `swift`, `us_bank`, or others. */ fun vendorCodeType(): VendorCodeType? = vendorCodeType.getNullable("vendor_code_type") /** An identifier given to this transaction by the bank. */ fun vendorId(): String? = vendorId.getNullable("vendor_id") /** The date on which the transaction occurred. */ fun asOfDate(): LocalDate? = asOfDate.getNullable("as_of_date") /** * The time on which the transaction occurred. Depending on the granularity of the timestamp * information received from the bank, it may be `null`. */ fun asOfTime(): String? = asOfTime.getNullable("as_of_time") /** * The timezone in which the `as_of_time` is represented. Can be `null` if the bank does not * provide timezone info. */ fun asOfTimezone(): String? = asOfTimezone.getNullable("as_of_timezone") /** The ID of the relevant Internal Account. */ fun internalAccountId(): String = internalAccountId.getRequired("internal_account_id") /** Additional data represented as key-value pairs. Both the key and value must be strings. */ fun metadata(): Metadata = metadata.getRequired("metadata") /** This field will be `true` if the transaction has posted to the account. */ fun posted(): Boolean = posted.getRequired("posted") /** An identifier given to this transaction by the bank, often `null`. */ fun vendorCustomerId(): String? = vendorCustomerId.getNullable("vendor_customer_id") /** * This field will be `true` if a transaction is reconciled by the Modern Treasury system. This * means that it has transaction line items that sum up to the transaction's amount. */ fun reconciled(): Boolean = reconciled.getRequired("reconciled") /** * This field contains additional information that the bank provided about the transaction. This * is structured data. Some of the data in here might overlap with what is in the * `vendor_description`. For example, the OBI could be a part of the vendor description, and it * would also be included in here. The attributes that are passed through the details field will * vary based on your banking partner. Currently, the following keys may be in the details * object: `originator_name`, `originator_to_beneficiary_information`. */ fun details(): Details? = details.getNullable("details") /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, `book`, * or `sen`. */ fun type(): Type = type.getRequired("type") /** Associated serialized foreign exchange rate information. */ fun foreignExchangeRate(): ForeignExchangeRate? = foreignExchangeRate.getNullable("foreign_exchange_rate") /** * An object containing key-value pairs, each with a custom identifier as the key and a string * value. */ fun customIdentifiers(): CustomIdentifiers = customIdentifiers.getRequired("custom_identifiers") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("object") @ExcludeMissing fun _object_() = object_ /** * This field will be true if this object exists in the live environment or false if it exists * in the test environment. */ @JsonProperty("live_mode") @ExcludeMissing fun _liveMode() = liveMode @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt @JsonProperty("updated_at") @ExcludeMissing fun _updatedAt() = updatedAt @JsonProperty("discarded_at") @ExcludeMissing fun _discardedAt() = discardedAt /** Value in specified currency's smallest unit. e.g. $10 would be represented as 1000. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** Currency that this transaction is denominated in. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency /** Either `credit` or `debit`. */ @JsonProperty("direction") @ExcludeMissing fun _direction() = direction /** * The transaction detail text that often appears in on your bank statement and in your banking * portal. */ @JsonProperty("vendor_description") @ExcludeMissing fun _vendorDescription() = vendorDescription /** * When applicable, the bank-given code that determines the transaction's category. For most * banks this is the BAI2/BTRS transaction code. */ @JsonProperty("vendor_code") @ExcludeMissing fun _vendorCode() = vendorCode /** * The type of `vendor_code` being reported. Can be one of `bai2`, `bankprov`, `bnk_dev`, * `cleartouch`, `currencycloud`, `cross_river`, `dc_bank`, `dwolla`, `evolve`, `goldman_sachs`, * `iso20022`, `jpmc`, `mx`, `signet`, `silvergate`, `swift`, `us_bank`, or others. */ @JsonProperty("vendor_code_type") @ExcludeMissing fun _vendorCodeType() = vendorCodeType /** An identifier given to this transaction by the bank. */ @JsonProperty("vendor_id") @ExcludeMissing fun _vendorId() = vendorId /** The date on which the transaction occurred. */ @JsonProperty("as_of_date") @ExcludeMissing fun _asOfDate() = asOfDate /** * The time on which the transaction occurred. Depending on the granularity of the timestamp * information received from the bank, it may be `null`. */ @JsonProperty("as_of_time") @ExcludeMissing fun _asOfTime() = asOfTime /** * The timezone in which the `as_of_time` is represented. Can be `null` if the bank does not * provide timezone info. */ @JsonProperty("as_of_timezone") @ExcludeMissing fun _asOfTimezone() = asOfTimezone /** The ID of the relevant Internal Account. */ @JsonProperty("internal_account_id") @ExcludeMissing fun _internalAccountId() = internalAccountId /** Additional data represented as key-value pairs. Both the key and value must be strings. */ @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** This field will be `true` if the transaction has posted to the account. */ @JsonProperty("posted") @ExcludeMissing fun _posted() = posted /** An identifier given to this transaction by the bank, often `null`. */ @JsonProperty("vendor_customer_id") @ExcludeMissing fun _vendorCustomerId() = vendorCustomerId /** * This field will be `true` if a transaction is reconciled by the Modern Treasury system. This * means that it has transaction line items that sum up to the transaction's amount. */ @JsonProperty("reconciled") @ExcludeMissing fun _reconciled() = reconciled /** * This field contains additional information that the bank provided about the transaction. This * is structured data. Some of the data in here might overlap with what is in the * `vendor_description`. For example, the OBI could be a part of the vendor description, and it * would also be included in here. The attributes that are passed through the details field will * vary based on your banking partner. Currently, the following keys may be in the details * object: `originator_name`, `originator_to_beneficiary_information`. */ @JsonProperty("details") @ExcludeMissing fun _details() = details /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, `book`, * or `sen`. */ @JsonProperty("type") @ExcludeMissing fun _type() = type /** Associated serialized foreign exchange rate information. */ @JsonProperty("foreign_exchange_rate") @ExcludeMissing fun _foreignExchangeRate() = foreignExchangeRate /** * An object containing key-value pairs, each with a custom identifier as the key and a string * value. */ @JsonProperty("custom_identifiers") @ExcludeMissing fun _customIdentifiers() = customIdentifiers @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): Transaction = apply { if (!validated) { id() object_() liveMode() createdAt() updatedAt() discardedAt() amount() currency() direction() vendorDescription() vendorCode() vendorCodeType() vendorId() asOfDate() asOfTime() asOfTimezone() internalAccountId() metadata().validate() posted() vendorCustomerId() reconciled() details()?.validate() type() foreignExchangeRate()?.validate() customIdentifiers().validate() validated = true } } fun toBuilder() = Builder().from(this) companion object { fun builder() = Builder() } class Builder { private var id: JsonField = JsonMissing.of() private var object_: JsonField = JsonMissing.of() private var liveMode: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() private var updatedAt: JsonField = JsonMissing.of() private var discardedAt: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var direction: JsonField = JsonMissing.of() private var vendorDescription: JsonField = JsonMissing.of() private var vendorCode: JsonField = JsonMissing.of() private var vendorCodeType: JsonField = JsonMissing.of() private var vendorId: JsonField = JsonMissing.of() private var asOfDate: JsonField = JsonMissing.of() private var asOfTime: JsonField = JsonMissing.of() private var asOfTimezone: JsonField = JsonMissing.of() private var internalAccountId: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() private var posted: JsonField = JsonMissing.of() private var vendorCustomerId: JsonField = JsonMissing.of() private var reconciled: JsonField = JsonMissing.of() private var details: JsonField
= JsonMissing.of() private var type: JsonField = JsonMissing.of() private var foreignExchangeRate: JsonField = JsonMissing.of() private var customIdentifiers: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(transaction: Transaction) = apply { this.id = transaction.id this.object_ = transaction.object_ this.liveMode = transaction.liveMode this.createdAt = transaction.createdAt this.updatedAt = transaction.updatedAt this.discardedAt = transaction.discardedAt this.amount = transaction.amount this.currency = transaction.currency this.direction = transaction.direction this.vendorDescription = transaction.vendorDescription this.vendorCode = transaction.vendorCode this.vendorCodeType = transaction.vendorCodeType this.vendorId = transaction.vendorId this.asOfDate = transaction.asOfDate this.asOfTime = transaction.asOfTime this.asOfTimezone = transaction.asOfTimezone this.internalAccountId = transaction.internalAccountId this.metadata = transaction.metadata this.posted = transaction.posted this.vendorCustomerId = transaction.vendorCustomerId this.reconciled = transaction.reconciled this.details = transaction.details this.type = transaction.type this.foreignExchangeRate = transaction.foreignExchangeRate this.customIdentifiers = transaction.customIdentifiers additionalProperties(transaction.additionalProperties) } fun id(id: String) = id(JsonField.of(id)) @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } fun object_(object_: String) = object_(JsonField.of(object_)) @JsonProperty("object") @ExcludeMissing fun object_(object_: JsonField) = apply { this.object_ = object_ } /** * This field will be true if this object exists in the live environment or false if it * exists in the test environment. */ fun liveMode(liveMode: Boolean) = liveMode(JsonField.of(liveMode)) /** * This field will be true if this object exists in the live environment or false if it * exists in the test environment. */ @JsonProperty("live_mode") @ExcludeMissing fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @JsonProperty("created_at") @ExcludeMissing fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) @JsonProperty("updated_at") @ExcludeMissing fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } fun discardedAt(discardedAt: OffsetDateTime) = discardedAt(JsonField.of(discardedAt)) @JsonProperty("discarded_at") @ExcludeMissing fun discardedAt(discardedAt: JsonField) = apply { this.discardedAt = discardedAt } /** Value in specified currency's smallest unit. e.g. $10 would be represented as 1000. */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** Value in specified currency's smallest unit. e.g. $10 would be represented as 1000. */ @JsonProperty("amount") @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } /** Currency that this transaction is denominated in. */ fun currency(currency: Currency) = currency(JsonField.of(currency)) /** Currency that this transaction is denominated in. */ @JsonProperty("currency") @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } /** Either `credit` or `debit`. */ fun direction(direction: String) = direction(JsonField.of(direction)) /** Either `credit` or `debit`. */ @JsonProperty("direction") @ExcludeMissing fun direction(direction: JsonField) = apply { this.direction = direction } /** * The transaction detail text that often appears in on your bank statement and in your * banking portal. */ fun vendorDescription(vendorDescription: String) = vendorDescription(JsonField.of(vendorDescription)) /** * The transaction detail text that often appears in on your bank statement and in your * banking portal. */ @JsonProperty("vendor_description") @ExcludeMissing fun vendorDescription(vendorDescription: JsonField) = apply { this.vendorDescription = vendorDescription } /** * When applicable, the bank-given code that determines the transaction's category. For most * banks this is the BAI2/BTRS transaction code. */ fun vendorCode(vendorCode: String) = vendorCode(JsonField.of(vendorCode)) /** * When applicable, the bank-given code that determines the transaction's category. For most * banks this is the BAI2/BTRS transaction code. */ @JsonProperty("vendor_code") @ExcludeMissing fun vendorCode(vendorCode: JsonField) = apply { this.vendorCode = vendorCode } /** * The type of `vendor_code` being reported. Can be one of `bai2`, `bankprov`, `bnk_dev`, * `cleartouch`, `currencycloud`, `cross_river`, `dc_bank`, `dwolla`, `evolve`, * `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `signet`, `silvergate`, `swift`, `us_bank`, or * others. */ fun vendorCodeType(vendorCodeType: VendorCodeType) = vendorCodeType(JsonField.of(vendorCodeType)) /** * The type of `vendor_code` being reported. Can be one of `bai2`, `bankprov`, `bnk_dev`, * `cleartouch`, `currencycloud`, `cross_river`, `dc_bank`, `dwolla`, `evolve`, * `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `signet`, `silvergate`, `swift`, `us_bank`, or * others. */ @JsonProperty("vendor_code_type") @ExcludeMissing fun vendorCodeType(vendorCodeType: JsonField) = apply { this.vendorCodeType = vendorCodeType } /** An identifier given to this transaction by the bank. */ fun vendorId(vendorId: String) = vendorId(JsonField.of(vendorId)) /** An identifier given to this transaction by the bank. */ @JsonProperty("vendor_id") @ExcludeMissing fun vendorId(vendorId: JsonField) = apply { this.vendorId = vendorId } /** The date on which the transaction occurred. */ fun asOfDate(asOfDate: LocalDate) = asOfDate(JsonField.of(asOfDate)) /** The date on which the transaction occurred. */ @JsonProperty("as_of_date") @ExcludeMissing fun asOfDate(asOfDate: JsonField) = apply { this.asOfDate = asOfDate } /** * The time on which the transaction occurred. Depending on the granularity of the timestamp * information received from the bank, it may be `null`. */ fun asOfTime(asOfTime: String) = asOfTime(JsonField.of(asOfTime)) /** * The time on which the transaction occurred. Depending on the granularity of the timestamp * information received from the bank, it may be `null`. */ @JsonProperty("as_of_time") @ExcludeMissing fun asOfTime(asOfTime: JsonField) = apply { this.asOfTime = asOfTime } /** * The timezone in which the `as_of_time` is represented. Can be `null` if the bank does not * provide timezone info. */ fun asOfTimezone(asOfTimezone: String) = asOfTimezone(JsonField.of(asOfTimezone)) /** * The timezone in which the `as_of_time` is represented. Can be `null` if the bank does not * provide timezone info. */ @JsonProperty("as_of_timezone") @ExcludeMissing fun asOfTimezone(asOfTimezone: JsonField) = apply { this.asOfTimezone = asOfTimezone } /** The ID of the relevant Internal Account. */ fun internalAccountId(internalAccountId: String) = internalAccountId(JsonField.of(internalAccountId)) /** The ID of the relevant Internal Account. */ @JsonProperty("internal_account_id") @ExcludeMissing fun internalAccountId(internalAccountId: JsonField) = apply { this.internalAccountId = internalAccountId } /** * Additional data represented as key-value pairs. Both the key and value must be strings. */ fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** * Additional data represented as key-value pairs. Both the key and value must be strings. */ @JsonProperty("metadata") @ExcludeMissing fun metadata(metadata: JsonField) = apply { this.metadata = metadata } /** This field will be `true` if the transaction has posted to the account. */ fun posted(posted: Boolean) = posted(JsonField.of(posted)) /** This field will be `true` if the transaction has posted to the account. */ @JsonProperty("posted") @ExcludeMissing fun posted(posted: JsonField) = apply { this.posted = posted } /** An identifier given to this transaction by the bank, often `null`. */ fun vendorCustomerId(vendorCustomerId: String) = vendorCustomerId(JsonField.of(vendorCustomerId)) /** An identifier given to this transaction by the bank, often `null`. */ @JsonProperty("vendor_customer_id") @ExcludeMissing fun vendorCustomerId(vendorCustomerId: JsonField) = apply { this.vendorCustomerId = vendorCustomerId } /** * This field will be `true` if a transaction is reconciled by the Modern Treasury system. * This means that it has transaction line items that sum up to the transaction's amount. */ fun reconciled(reconciled: Boolean) = reconciled(JsonField.of(reconciled)) /** * This field will be `true` if a transaction is reconciled by the Modern Treasury system. * This means that it has transaction line items that sum up to the transaction's amount. */ @JsonProperty("reconciled") @ExcludeMissing fun reconciled(reconciled: JsonField) = apply { this.reconciled = reconciled } /** * This field contains additional information that the bank provided about the transaction. * This is structured data. Some of the data in here might overlap with what is in the * `vendor_description`. For example, the OBI could be a part of the vendor description, and * it would also be included in here. The attributes that are passed through the details * field will vary based on your banking partner. Currently, the following keys may be in * the details object: `originator_name`, `originator_to_beneficiary_information`. */ fun details(details: Details) = details(JsonField.of(details)) /** * This field contains additional information that the bank provided about the transaction. * This is structured data. Some of the data in here might overlap with what is in the * `vendor_description`. For example, the OBI could be a part of the vendor description, and * it would also be included in here. The attributes that are passed through the details * field will vary based on your banking partner. Currently, the following keys may be in * the details object: `originator_name`, `originator_to_beneficiary_information`. */ @JsonProperty("details") @ExcludeMissing fun details(details: JsonField
) = apply { this.details = details } /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, * `book`, or `sen`. */ fun type(type: Type) = type(JsonField.of(type)) /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, * `book`, or `sen`. */ @JsonProperty("type") @ExcludeMissing fun type(type: JsonField) = apply { this.type = type } /** Associated serialized foreign exchange rate information. */ fun foreignExchangeRate(foreignExchangeRate: ForeignExchangeRate) = foreignExchangeRate(JsonField.of(foreignExchangeRate)) /** Associated serialized foreign exchange rate information. */ @JsonProperty("foreign_exchange_rate") @ExcludeMissing fun foreignExchangeRate(foreignExchangeRate: JsonField) = apply { this.foreignExchangeRate = foreignExchangeRate } /** * An object containing key-value pairs, each with a custom identifier as the key and a * string value. */ fun customIdentifiers(customIdentifiers: CustomIdentifiers) = customIdentifiers(JsonField.of(customIdentifiers)) /** * An object containing key-value pairs, each with a custom identifier as the key and a * string value. */ @JsonProperty("custom_identifiers") @ExcludeMissing fun customIdentifiers(customIdentifiers: JsonField) = apply { this.customIdentifiers = customIdentifiers } 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(): Transaction = Transaction( id, object_, liveMode, createdAt, updatedAt, discardedAt, amount, currency, direction, vendorDescription, vendorCode, vendorCodeType, vendorId, asOfDate, asOfTime, asOfTimezone, internalAccountId, metadata, posted, vendorCustomerId, reconciled, details, type, foreignExchangeRate, customIdentifiers, additionalProperties.toImmutable(), ) } /** * An object containing key-value pairs, each with a custom identifier as the key and a string * value. */ @JsonDeserialize(builder = CustomIdentifiers.Builder::class) @NoAutoDetect class CustomIdentifiers private constructor( private val additionalProperties: Map, ) { private var validated: Boolean = false @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): CustomIdentifiers = apply { if (!validated) { validated = true } } fun toBuilder() = Builder().from(this) companion object { fun builder() = Builder() } class Builder { private var additionalProperties: MutableMap = mutableMapOf() internal fun from(customIdentifiers: CustomIdentifiers) = apply { additionalProperties(customIdentifiers.additionalProperties) } 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(): CustomIdentifiers = CustomIdentifiers(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is CustomIdentifiers && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ private val hashCode: Int by lazy { Objects.hash(additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = "CustomIdentifiers{additionalProperties=$additionalProperties}" } /** Associated serialized foreign exchange rate information. */ @JsonDeserialize(builder = ForeignExchangeRate.Builder::class) @NoAutoDetect class ForeignExchangeRate private constructor( private val baseAmount: JsonField, private val baseCurrency: JsonField, private val exponent: JsonField, private val rateString: JsonField, private val targetAmount: JsonField, private val targetCurrency: JsonField, private val value: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false /** * Amount in the lowest denomination of the `base_currency` to convert, often called the * "sell" amount. */ fun baseAmount(): Long = baseAmount.getRequired("base_amount") /** Currency to convert, often called the "sell" currency. */ fun baseCurrency(): Currency = baseCurrency.getRequired("base_currency") /** * The exponent component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ fun exponent(): Long = exponent.getRequired("exponent") /** A string representation of the rate. */ fun rateString(): String = rateString.getRequired("rate_string") /** * Amount in the lowest denomination of the `target_currency`, often called the "buy" * amount. */ fun targetAmount(): Long = targetAmount.getRequired("target_amount") /** Currency to convert the `base_currency` to, often called the "buy" currency. */ fun targetCurrency(): Currency = targetCurrency.getRequired("target_currency") /** * The whole number component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ fun value(): Long = value.getRequired("value") /** * Amount in the lowest denomination of the `base_currency` to convert, often called the * "sell" amount. */ @JsonProperty("base_amount") @ExcludeMissing fun _baseAmount() = baseAmount /** Currency to convert, often called the "sell" currency. */ @JsonProperty("base_currency") @ExcludeMissing fun _baseCurrency() = baseCurrency /** * The exponent component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ @JsonProperty("exponent") @ExcludeMissing fun _exponent() = exponent /** A string representation of the rate. */ @JsonProperty("rate_string") @ExcludeMissing fun _rateString() = rateString /** * Amount in the lowest denomination of the `target_currency`, often called the "buy" * amount. */ @JsonProperty("target_amount") @ExcludeMissing fun _targetAmount() = targetAmount /** Currency to convert the `base_currency` to, often called the "buy" currency. */ @JsonProperty("target_currency") @ExcludeMissing fun _targetCurrency() = targetCurrency /** * The whole number component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ @JsonProperty("value") @ExcludeMissing fun _value() = value @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): ForeignExchangeRate = apply { if (!validated) { baseAmount() baseCurrency() exponent() rateString() targetAmount() targetCurrency() value() validated = true } } fun toBuilder() = Builder().from(this) companion object { fun builder() = Builder() } class Builder { private var baseAmount: JsonField = JsonMissing.of() private var baseCurrency: JsonField = JsonMissing.of() private var exponent: JsonField = JsonMissing.of() private var rateString: JsonField = JsonMissing.of() private var targetAmount: JsonField = JsonMissing.of() private var targetCurrency: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(foreignExchangeRate: ForeignExchangeRate) = apply { this.baseAmount = foreignExchangeRate.baseAmount this.baseCurrency = foreignExchangeRate.baseCurrency this.exponent = foreignExchangeRate.exponent this.rateString = foreignExchangeRate.rateString this.targetAmount = foreignExchangeRate.targetAmount this.targetCurrency = foreignExchangeRate.targetCurrency this.value = foreignExchangeRate.value additionalProperties(foreignExchangeRate.additionalProperties) } /** * Amount in the lowest denomination of the `base_currency` to convert, often called the * "sell" amount. */ fun baseAmount(baseAmount: Long) = baseAmount(JsonField.of(baseAmount)) /** * Amount in the lowest denomination of the `base_currency` to convert, often called the * "sell" amount. */ @JsonProperty("base_amount") @ExcludeMissing fun baseAmount(baseAmount: JsonField) = apply { this.baseAmount = baseAmount } /** Currency to convert, often called the "sell" currency. */ fun baseCurrency(baseCurrency: Currency) = baseCurrency(JsonField.of(baseCurrency)) /** Currency to convert, often called the "sell" currency. */ @JsonProperty("base_currency") @ExcludeMissing fun baseCurrency(baseCurrency: JsonField) = apply { this.baseCurrency = baseCurrency } /** * The exponent component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ fun exponent(exponent: Long) = exponent(JsonField.of(exponent)) /** * The exponent component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ @JsonProperty("exponent") @ExcludeMissing fun exponent(exponent: JsonField) = apply { this.exponent = exponent } /** A string representation of the rate. */ fun rateString(rateString: String) = rateString(JsonField.of(rateString)) /** A string representation of the rate. */ @JsonProperty("rate_string") @ExcludeMissing fun rateString(rateString: JsonField) = apply { this.rateString = rateString } /** * Amount in the lowest denomination of the `target_currency`, often called the "buy" * amount. */ fun targetAmount(targetAmount: Long) = targetAmount(JsonField.of(targetAmount)) /** * Amount in the lowest denomination of the `target_currency`, often called the "buy" * amount. */ @JsonProperty("target_amount") @ExcludeMissing fun targetAmount(targetAmount: JsonField) = apply { this.targetAmount = targetAmount } /** Currency to convert the `base_currency` to, often called the "buy" currency. */ fun targetCurrency(targetCurrency: Currency) = targetCurrency(JsonField.of(targetCurrency)) /** Currency to convert the `base_currency` to, often called the "buy" currency. */ @JsonProperty("target_currency") @ExcludeMissing fun targetCurrency(targetCurrency: JsonField) = apply { this.targetCurrency = targetCurrency } /** * The whole number component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ fun value(value: Long) = value(JsonField.of(value)) /** * The whole number component of the rate. The decimal is calculated as `value` / (10 ^ * `exponent`). */ @JsonProperty("value") @ExcludeMissing fun value(value: JsonField) = apply { this.value = value } 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(): ForeignExchangeRate = ForeignExchangeRate( baseAmount, baseCurrency, exponent, rateString, targetAmount, targetCurrency, value, additionalProperties.toImmutable(), ) } override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is ForeignExchangeRate && baseAmount == other.baseAmount && baseCurrency == other.baseCurrency && exponent == other.exponent && rateString == other.rateString && targetAmount == other.targetAmount && targetCurrency == other.targetCurrency && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ private val hashCode: Int by lazy { Objects.hash(baseAmount, baseCurrency, exponent, rateString, targetAmount, targetCurrency, value, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = "ForeignExchangeRate{baseAmount=$baseAmount, baseCurrency=$baseCurrency, exponent=$exponent, rateString=$rateString, targetAmount=$targetAmount, targetCurrency=$targetCurrency, value=$value, additionalProperties=$additionalProperties}" } /** Additional data represented as key-value pairs. Both the key and value must be strings. */ @JsonDeserialize(builder = Metadata.Builder::class) @NoAutoDetect class Metadata private constructor( private val additionalProperties: Map, ) { private var validated: Boolean = false @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): Metadata = apply { if (!validated) { validated = true } } fun toBuilder() = Builder().from(this) companion object { fun builder() = Builder() } class Builder { private var additionalProperties: MutableMap = mutableMapOf() internal fun from(metadata: Metadata) = apply { additionalProperties(metadata.additionalProperties) } 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(): Metadata = Metadata(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ private val hashCode: Int by lazy { Objects.hash(additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } class Type @JsonCreator private constructor( private val value: JsonField, ) : Enum { @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { val ACH = of("ach") val AU_BECS = of("au_becs") val BACS = of("bacs") val BOOK = of("book") val CARD = of("card") val CHATS = of("chats") val CHECK = of("check") val CROSS_BORDER = of("cross_border") val DK_NETS = of("dk_nets") val EFT = of("eft") val HU_ICS = of("hu_ics") val INTERAC = of("interac") val MASAV = of("masav") val MX_CCEN = of("mx_ccen") val NEFT = of("neft") val NICS = of("nics") val NZ_BECS = of("nz_becs") val PL_ELIXIR = of("pl_elixir") val PROVXCHANGE = of("provxchange") val RO_SENT = of("ro_sent") val RTP = of("rtp") val SE_BANKGIROT = of("se_bankgirot") val SEN = of("sen") val SEPA = of("sepa") val SG_GIRO = of("sg_giro") val SIC = of("sic") val SIGNET = of("signet") val SKNBI = of("sknbi") val WIRE = of("wire") val ZENGIN = of("zengin") val OTHER = of("other") fun of(value: String) = Type(JsonField.of(value)) } enum class Known { ACH, AU_BECS, BACS, BOOK, CARD, CHATS, CHECK, CROSS_BORDER, DK_NETS, EFT, HU_ICS, INTERAC, MASAV, MX_CCEN, NEFT, NICS, NZ_BECS, PL_ELIXIR, PROVXCHANGE, RO_SENT, RTP, SE_BANKGIROT, SEN, SEPA, SG_GIRO, SIC, SIGNET, SKNBI, WIRE, ZENGIN, OTHER, } enum class Value { ACH, AU_BECS, BACS, BOOK, CARD, CHATS, CHECK, CROSS_BORDER, DK_NETS, EFT, HU_ICS, INTERAC, MASAV, MX_CCEN, NEFT, NICS, NZ_BECS, PL_ELIXIR, PROVXCHANGE, RO_SENT, RTP, SE_BANKGIROT, SEN, SEPA, SG_GIRO, SIC, SIGNET, SKNBI, WIRE, ZENGIN, OTHER, _UNKNOWN, } fun value(): Value = when (this) { ACH -> Value.ACH AU_BECS -> Value.AU_BECS BACS -> Value.BACS BOOK -> Value.BOOK CARD -> Value.CARD CHATS -> Value.CHATS CHECK -> Value.CHECK CROSS_BORDER -> Value.CROSS_BORDER DK_NETS -> Value.DK_NETS EFT -> Value.EFT HU_ICS -> Value.HU_ICS INTERAC -> Value.INTERAC MASAV -> Value.MASAV MX_CCEN -> Value.MX_CCEN NEFT -> Value.NEFT NICS -> Value.NICS NZ_BECS -> Value.NZ_BECS PL_ELIXIR -> Value.PL_ELIXIR PROVXCHANGE -> Value.PROVXCHANGE RO_SENT -> Value.RO_SENT RTP -> Value.RTP SE_BANKGIROT -> Value.SE_BANKGIROT SEN -> Value.SEN SEPA -> Value.SEPA SG_GIRO -> Value.SG_GIRO SIC -> Value.SIC SIGNET -> Value.SIGNET SKNBI -> Value.SKNBI WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN OTHER -> Value.OTHER else -> Value._UNKNOWN } fun known(): Known = when (this) { ACH -> Known.ACH AU_BECS -> Known.AU_BECS BACS -> Known.BACS BOOK -> Known.BOOK CARD -> Known.CARD CHATS -> Known.CHATS CHECK -> Known.CHECK CROSS_BORDER -> Known.CROSS_BORDER DK_NETS -> Known.DK_NETS EFT -> Known.EFT HU_ICS -> Known.HU_ICS INTERAC -> Known.INTERAC MASAV -> Known.MASAV MX_CCEN -> Known.MX_CCEN NEFT -> Known.NEFT NICS -> Known.NICS NZ_BECS -> Known.NZ_BECS PL_ELIXIR -> Known.PL_ELIXIR PROVXCHANGE -> Known.PROVXCHANGE RO_SENT -> Known.RO_SENT RTP -> Known.RTP SE_BANKGIROT -> Known.SE_BANKGIROT SEN -> Known.SEN SEPA -> Known.SEPA SG_GIRO -> Known.SG_GIRO SIC -> Known.SIC SIGNET -> Known.SIGNET SKNBI -> Known.SKNBI WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN OTHER -> Known.OTHER else -> throw ModernTreasuryInvalidDataException("Unknown Type: $value") } fun asString(): String = _value().asStringOrThrow() override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is Type && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() } class VendorCodeType @JsonCreator private constructor( private val value: JsonField, ) : Enum { @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { val BAI2 = of("bai2") val BANKPROV = of("bankprov") val BNK_DEV = of("bnk_dev") val CLEARTOUCH = of("cleartouch") val COLUMN = of("column") val CROSS_RIVER = of("cross_river") val CURRENCYCLOUD = of("currencycloud") val DC_BANK = of("dc_bank") val DWOLLA = of("dwolla") val EVOLVE = of("evolve") val GOLDMAN_SACHS = of("goldman_sachs") val ISO20022 = of("iso20022") val JPMC = of("jpmc") val MX = of("mx") val PLAID = of("plaid") val PNC = of("pnc") val RSPEC_VENDOR = of("rspec_vendor") val SIGNET = of("signet") val SILVERGATE = of("silvergate") val SWIFT = of("swift") val US_BANK = of("us_bank") val USER = of("user") fun of(value: String) = VendorCodeType(JsonField.of(value)) } enum class Known { BAI2, BANKPROV, BNK_DEV, CLEARTOUCH, COLUMN, CROSS_RIVER, CURRENCYCLOUD, DC_BANK, DWOLLA, EVOLVE, GOLDMAN_SACHS, ISO20022, JPMC, MX, PLAID, PNC, RSPEC_VENDOR, SIGNET, SILVERGATE, SWIFT, US_BANK, USER, } enum class Value { BAI2, BANKPROV, BNK_DEV, CLEARTOUCH, COLUMN, CROSS_RIVER, CURRENCYCLOUD, DC_BANK, DWOLLA, EVOLVE, GOLDMAN_SACHS, ISO20022, JPMC, MX, PLAID, PNC, RSPEC_VENDOR, SIGNET, SILVERGATE, SWIFT, US_BANK, USER, _UNKNOWN, } fun value(): Value = when (this) { BAI2 -> Value.BAI2 BANKPROV -> Value.BANKPROV BNK_DEV -> Value.BNK_DEV CLEARTOUCH -> Value.CLEARTOUCH COLUMN -> Value.COLUMN CROSS_RIVER -> Value.CROSS_RIVER CURRENCYCLOUD -> Value.CURRENCYCLOUD DC_BANK -> Value.DC_BANK DWOLLA -> Value.DWOLLA EVOLVE -> Value.EVOLVE GOLDMAN_SACHS -> Value.GOLDMAN_SACHS ISO20022 -> Value.ISO20022 JPMC -> Value.JPMC MX -> Value.MX PLAID -> Value.PLAID PNC -> Value.PNC RSPEC_VENDOR -> Value.RSPEC_VENDOR SIGNET -> Value.SIGNET SILVERGATE -> Value.SILVERGATE SWIFT -> Value.SWIFT US_BANK -> Value.US_BANK USER -> Value.USER else -> Value._UNKNOWN } fun known(): Known = when (this) { BAI2 -> Known.BAI2 BANKPROV -> Known.BANKPROV BNK_DEV -> Known.BNK_DEV CLEARTOUCH -> Known.CLEARTOUCH COLUMN -> Known.COLUMN CROSS_RIVER -> Known.CROSS_RIVER CURRENCYCLOUD -> Known.CURRENCYCLOUD DC_BANK -> Known.DC_BANK DWOLLA -> Known.DWOLLA EVOLVE -> Known.EVOLVE GOLDMAN_SACHS -> Known.GOLDMAN_SACHS ISO20022 -> Known.ISO20022 JPMC -> Known.JPMC MX -> Known.MX PLAID -> Known.PLAID PNC -> Known.PNC RSPEC_VENDOR -> Known.RSPEC_VENDOR SIGNET -> Known.SIGNET SILVERGATE -> Known.SILVERGATE SWIFT -> Known.SWIFT US_BANK -> Known.US_BANK USER -> Known.USER else -> throw ModernTreasuryInvalidDataException("Unknown VendorCodeType: $value") } fun asString(): String = _value().asStringOrThrow() override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is VendorCodeType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() } /** * This field contains additional information that the bank provided about the transaction. This * is structured data. Some of the data in here might overlap with what is in the * `vendor_description`. For example, the OBI could be a part of the vendor description, and it * would also be included in here. The attributes that are passed through the details field will * vary based on your banking partner. Currently, the following keys may be in the details * object: `originator_name`, `originator_to_beneficiary_information`. */ @JsonDeserialize(builder = Details.Builder::class) @NoAutoDetect class Details private constructor( private val additionalProperties: Map, ) { private var validated: Boolean = false @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): Details = apply { if (!validated) { validated = true } } fun toBuilder() = Builder().from(this) companion object { fun builder() = Builder() } class Builder { private var additionalProperties: MutableMap = mutableMapOf() internal fun from(details: Details) = apply { additionalProperties(details.additionalProperties) } 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(): Details = Details(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is Details && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ private val hashCode: Int by lazy { Objects.hash(additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = "Details{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is Transaction && id == other.id && object_ == other.object_ && liveMode == other.liveMode && createdAt == other.createdAt && updatedAt == other.updatedAt && discardedAt == other.discardedAt && amount == other.amount && currency == other.currency && direction == other.direction && vendorDescription == other.vendorDescription && vendorCode == other.vendorCode && vendorCodeType == other.vendorCodeType && vendorId == other.vendorId && asOfDate == other.asOfDate && asOfTime == other.asOfTime && asOfTimezone == other.asOfTimezone && internalAccountId == other.internalAccountId && metadata == other.metadata && posted == other.posted && vendorCustomerId == other.vendorCustomerId && reconciled == other.reconciled && details == other.details && type == other.type && foreignExchangeRate == other.foreignExchangeRate && customIdentifiers == other.customIdentifiers && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ private val hashCode: Int by lazy { Objects.hash(id, object_, liveMode, createdAt, updatedAt, discardedAt, amount, currency, direction, vendorDescription, vendorCode, vendorCodeType, vendorId, asOfDate, asOfTime, asOfTimezone, internalAccountId, metadata, posted, vendorCustomerId, reconciled, details, type, foreignExchangeRate, customIdentifiers, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = "Transaction{id=$id, object_=$object_, liveMode=$liveMode, createdAt=$createdAt, updatedAt=$updatedAt, discardedAt=$discardedAt, amount=$amount, currency=$currency, direction=$direction, vendorDescription=$vendorDescription, vendorCode=$vendorCode, vendorCodeType=$vendorCodeType, vendorId=$vendorId, asOfDate=$asOfDate, asOfTime=$asOfTime, asOfTimezone=$asOfTimezone, internalAccountId=$internalAccountId, metadata=$metadata, posted=$posted, vendorCustomerId=$vendorCustomerId, reconciled=$reconciled, details=$details, type=$type, foreignExchangeRate=$foreignExchangeRate, customIdentifiers=$customIdentifiers, additionalProperties=$additionalProperties}" }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy